Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 38 additions & 30 deletions packages/web/src/components/comments/CommentThread.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,37 +97,45 @@ export const CommentThread = ({ commentId }: { commentId: ID }) => {
: messages.hideReplies}
</PlainButton>
</Box>
{hiddenReplies[rootComment.id] ? null : (
<Flex
direction='column'
gap='l'
as='ul'
aria-label={messages.replies}
>
{replies.map((reply: ReplyComment) => (
<Flex w='100%' key={reply.id} as='li'>
<CommentBlock
commentId={reply.id}
parentCommentId={rootComment.id}
/>
</Flex>
))}
</Flex>
)}

{hasMoreReplies && !hiddenReplies[rootComment.id] ? (
<PlainButton
onClick={handleLoadMoreReplies}
variant='subdued'
css={{ width: 'max-content' }}
disabled={isFetchingReplies}
>
{messages.showMoreReplies}
{isFetchingReplies ? (
<LoadingSpinner css={{ width: 20, height: 20 }} />
<Box

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting solution, where you get this from?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that flex box could do this, but after trying it didn't work out so after some googling i saw that grid worked in the way that I wanted

css={{
display: 'grid',
gridTemplateRows: hiddenReplies[rootComment.id] ? '0fr' : '1fr',
transition: 'grid-template-rows 0.25s ease-out'
}}
>
<Flex direction='column' gap='l' css={{ overflow: 'hidden' }}>
<Flex
direction='column'
gap='l'
as='ul'
aria-label={messages.replies}
>
{replies.map((reply: ReplyComment) => (
<Flex w='100%' key={reply.id} as='li'>
<CommentBlock
commentId={reply.id}
parentCommentId={rootComment.id}
/>
</Flex>
))}
</Flex>

{hasMoreReplies ? (
<PlainButton
onClick={handleLoadMoreReplies}
variant='subdued'
css={{ width: 'max-content' }}
disabled={isFetchingReplies}
>
{messages.showMoreReplies}
{isFetchingReplies ? (
<LoadingSpinner css={{ width: 20, height: 20 }} />
) : null}
</PlainButton>
) : null}
</PlainButton>
) : null}
</Flex>
</Box>
</Flex>
) : null}
</Flex>
Expand Down
10 changes: 9 additions & 1 deletion packages/web/src/components/composer-input/ComposerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,15 @@ export const ComposerInput = (props: ComposerInputProps) => {
submittedRef.current = false
setUserMentions([])
setUserIdMap({})
}, [getUserMentions, linkEntities, onSubmit, restoreLinks, userIdMap, value])
}, [
blurOnSubmit,
getUserMentions,
linkEntities,
onSubmit,
restoreLinks,
userIdMap,
value
])

// Submit when pressing enter while not holding shift
const handleKeyDown = useCallback(
Expand Down