@@ -11,11 +11,17 @@ import {
11
11
} from "~/components/ui/dropdown-menu/dropdown-menu"
12
12
import { useSortedEntryActions } from "~/hooks/biz/useEntryActions"
13
13
import { COMMAND_ID } from "~/modules/command/commands/id"
14
- import { useCommand } from "~/modules/command/hooks/use-command"
14
+ import { hasCommand , useCommand } from "~/modules/command/hooks/use-command"
15
15
import type { FollowCommandId } from "~/modules/command/types"
16
16
17
17
export const MoreActions = ( { entryId, view } : { entryId : string ; view ?: FeedViewType } ) => {
18
- const { moreAction : actionConfigs } = useSortedEntryActions ( { entryId, view } )
18
+ const { moreAction } = useSortedEntryActions ( { entryId, view } )
19
+
20
+ const actionConfigs = useMemo (
21
+ ( ) => moreAction . filter ( ( action ) => hasCommand ( action . id ) ) ,
22
+ [ moreAction ] ,
23
+ )
24
+
19
25
const availableActions = useMemo (
20
26
( ) => actionConfigs . filter ( ( item ) => item . id !== COMMAND_ID . settings . customizeToolbar ) ,
21
27
[ actionConfigs ] ,
@@ -26,7 +32,7 @@ export const MoreActions = ({ entryId, view }: { entryId: string; view?: FeedVie
26
32
[ actionConfigs ] ,
27
33
)
28
34
29
- if ( availableActions . length === 0 ) {
35
+ if ( availableActions . length === 0 && extraAction . length === 0 ) {
30
36
return null
31
37
}
32
38
@@ -44,7 +50,7 @@ export const MoreActions = ({ entryId, view }: { entryId: string; view?: FeedVie
44
50
active = { config . active }
45
51
/>
46
52
) ) }
47
- < DropdownMenuSeparator />
53
+ { availableActions . length > 0 && < DropdownMenuSeparator /> }
48
54
{ extraAction . map ( ( config ) => (
49
55
< CommandDropdownMenuItem
50
56
key = { config . id }
0 commit comments