File tree Expand file tree Collapse file tree 5 files changed +23
-4
lines changed
Expand file tree Collapse file tree 5 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 77 FeedPostContent ,
88 mapFeedContentTypeToContentType ,
99} from '@/types/feed' ;
10+ import { shouldShowCommentButton } from '@/components/Feed/lib/feedUtils' ;
1011import { FeedItemHeader } from '@/components/Feed/FeedItemHeader' ;
1112import { FeedItemActions } from '@/components/Feed/FeedItemActions' ;
1213import { CardWrapper } from './CardWrapper' ;
@@ -417,7 +418,7 @@ export const BaseFeedItem: FC<BaseFeedItemProps> = ({
417418 onFeedItemClick = { onFeedItemClick }
418419 bounties = { showBountyInfo ? undefined : content . bounties }
419420 hideReportButton = { hideReportButton }
420- hideCommentButton = { ( entry . metrics ?. comments ?? 0 ) === 0 }
421+ hideCommentButton = { ! shouldShowCommentButton ( entry . metrics , Boolean ( href ) ) }
421422 />
422423 </ div >
423424 ) }
Original file line number Diff line number Diff line change @@ -422,7 +422,7 @@ export const FeedItemActions: FC<FeedItemActionsProps> = ({
422422 return (
423423 < >
424424 < div className = "flex items-center justify-between w-full" >
425- < div className = "flex items-center space-x-3 md:space-x-4 flex-nowrap overflow-x-auto " >
425+ < div className = "flex items-center space-x-3 md:space-x-4 flex-nowrap overflow-visible " >
426426 < div
427427 className = { cn (
428428 'flex items-center h-8 border rounded-full bg-white transition-all' ,
Original file line number Diff line number Diff line change 22
33import { FC , useState } from 'react' ;
44import { FeedEntry , FeedBountyContent } from '@/types/feed' ;
5+ import { shouldShowCommentButton } from '@/components/Feed/lib/feedUtils' ;
56import { Topic } from '@/types/topic' ;
67import { FeedItemHeader } from '@/components/Feed/FeedItemHeader' ;
78import { FeedItemActions } from '@/components/Feed/FeedItemActions' ;
@@ -424,7 +425,7 @@ export const FeedItemBountyComment: FC<FeedItemBountyCommentProps> = ({
424425 entry . relatedWork ?. unifiedDocumentId ?. toString ( ) || undefined
425426 }
426427 onFeedItemClick = { onFeedItemClick }
427- hideCommentButton = { ( entry . metrics ?. comments ?? 0 ) === 0 }
428+ hideCommentButton = { ! shouldShowCommentButton ( entry . metrics , Boolean ( onReply ) ) }
428429 />
429430 </ div >
430431 ) }
Original file line number Diff line number Diff line change 33import { FC , useState } from 'react' ;
44import React from 'react' ;
55import { FeedEntry , FeedCommentContent , ParentCommentPreview } from '@/types/feed' ;
6+ import { shouldShowCommentButton } from '@/components/Feed/lib/feedUtils' ;
67import { FeedItemHeader } from '@/components/Feed/FeedItemHeader' ;
78import { FeedItemActions } from '@/components/Feed/FeedItemActions' ;
89import { CommentReadOnly } from '@/components/Comment/CommentReadOnly' ;
@@ -255,7 +256,7 @@ export const FeedItemComment: FC<FeedItemCommentProps> = ({
255256 tips = { entry . tips }
256257 relatedDocumentTopics = { entry . relatedWork ?. topics }
257258 onFeedItemClick = { onFeedItemClick }
258- hideCommentButton = { ( entry . metrics ?. comments ?? 0 ) === 0 }
259+ hideCommentButton = { ! shouldShowCommentButton ( entry . metrics , Boolean ( onReply ) ) }
259260 />
260261 </ div >
261262 </ div >
Original file line number Diff line number Diff line change 1+ import { ContentMetrics } from '@/types/metrics' ;
2+
3+ /**
4+ * Determines if the comment/reply button should be shown.
5+ * Show the button if there are comments to view OR the user can add one.
6+ *
7+ * @param metrics - The content metrics containing comment count
8+ * @param hasCommentAction - Whether the user has a way to comment (via callback or navigation)
9+ */
10+ export function shouldShowCommentButton (
11+ metrics : ContentMetrics | undefined ,
12+ hasCommentAction : boolean
13+ ) : boolean {
14+ const hasComments = ( metrics ?. comments ?? 0 ) > 0 ;
15+ return hasComments || hasCommentAction ;
16+ }
You can’t perform that action at this time.
0 commit comments