@@ -78,45 +78,43 @@ export const CommentQuickActions = observer(function CommentQuickActions(props:
7878 icon : TrashIcon ,
7979 shouldRender : canDelete ,
8080 } ,
81- ] ;
81+ ] . filter ( ( item ) => item . shouldRender !== false ) ;
8282 } ,
8383 [ t , setEditMode , canEdit , showCopyLinkOption , activityOperations , comment , showAccessSpecifier , canDelete ]
8484 ) ;
8585
86+ if ( MENU_ITEMS . length === 0 ) return null ;
87+
8688 return (
8789 < CustomMenu customButton = { < IconButton icon = { MoreHorizontal } variant = "ghost" size = "sm" /> } closeOnSelect >
88- { MENU_ITEMS . map ( ( item ) => {
89- if ( item . shouldRender === false ) return null ;
90-
91- return (
92- < CustomMenu . MenuItem
93- key = { item . key }
94- onClick = { ( ) => item . action ( ) }
95- className = { cn (
96- "flex items-center gap-2" ,
97- {
98- "text-placeholder" : item . disabled ,
99- } ,
100- item . className
90+ { MENU_ITEMS . map ( ( item ) => (
91+ < CustomMenu . MenuItem
92+ key = { item . key }
93+ onClick = { ( ) => item . action ( ) }
94+ className = { cn (
95+ "flex items-center gap-2" ,
96+ {
97+ "text-placeholder" : item . disabled ,
98+ } ,
99+ item . className
100+ ) }
101+ disabled = { item . disabled }
102+ >
103+ { item . icon && < item . icon className = { cn ( "size-3 shrink-0" , item . iconClassName ) } /> }
104+ < div >
105+ < h5 > { item . title } </ h5 >
106+ { item . description && (
107+ < p
108+ className = { cn ( "whitespace-pre-line text-tertiary" , {
109+ "text-placeholder" : item . disabled ,
110+ } ) }
111+ >
112+ { item . description }
113+ </ p >
101114 ) }
102- disabled = { item . disabled }
103- >
104- { item . icon && < item . icon className = { cn ( "size-3 shrink-0" , item . iconClassName ) } /> }
105- < div >
106- < h5 > { item . title } </ h5 >
107- { item . description && (
108- < p
109- className = { cn ( "whitespace-pre-line text-tertiary" , {
110- "text-placeholder" : item . disabled ,
111- } ) }
112- >
113- { item . description }
114- </ p >
115- ) }
116- </ div >
117- </ CustomMenu . MenuItem >
118- ) ;
119- } ) }
115+ </ div >
116+ </ CustomMenu . MenuItem >
117+ ) ) }
120118 </ CustomMenu >
121119 ) ;
122120} ) ;
0 commit comments