-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor RecordShowActionMenu to use contextual actions (#9023)
Closes #8736
- Loading branch information
1 parent
224b6d1
commit 2c4a77a
Showing
3 changed files
with
57 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenuButtons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { actionMenuEntriesComponentSelector } from '@/action-menu/states/actionMenuEntriesComponentSelector'; | ||
import { PageHeaderOpenCommandMenuButton } from '@/ui/layout/page-header/components/PageHeaderOpenCommandMenuButton'; | ||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2'; | ||
import { Button, useIsMobile } from 'twenty-ui'; | ||
|
||
export const RecordShowActionMenuButtons = () => { | ||
const actionMenuEntries = useRecoilComponentValueV2( | ||
actionMenuEntriesComponentSelector, | ||
); | ||
|
||
const pinnedEntries = actionMenuEntries.filter((entry) => entry.isPinned); | ||
|
||
const isMobile = useIsMobile(); | ||
|
||
return ( | ||
<> | ||
{!isMobile && | ||
pinnedEntries.map((entry, index) => ( | ||
<Button | ||
key={index} | ||
Icon={entry.Icon} | ||
size="small" | ||
variant="secondary" | ||
accent="default" | ||
title={entry.label} | ||
onClick={() => entry.onClick?.()} | ||
ariaLabel={entry.label} | ||
/> | ||
))} | ||
<PageHeaderOpenCommandMenuButton key="more" /> | ||
</> | ||
); | ||
}; |