361 create a navigation stack for the command menu (#9995)
Closes https://github.com/twentyhq/core-team-issues/issues/361 - Created navigation stack state - Created navigation functions inside the `useCommandMenu` hook - Added tests
This commit is contained in:
@ -1,25 +1,17 @@
|
||||
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
||||
import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState';
|
||||
import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageTitle';
|
||||
import { CommandMenuPages } from '@/command-menu/types/CommandMenuPages';
|
||||
import { useRecoilCallback } from 'recoil';
|
||||
import { IconSearch } from 'twenty-ui';
|
||||
|
||||
export const useSearchRecordsRecordAgnosticAction = () => {
|
||||
const { openCommandMenu } = useCommandMenu();
|
||||
const { navigateCommandMenu } = useCommandMenu();
|
||||
|
||||
const onClick = useRecoilCallback(
|
||||
({ set }) =>
|
||||
() => {
|
||||
set(commandMenuPageState, CommandMenuPages.SearchRecords);
|
||||
set(commandMenuPageInfoState, {
|
||||
title: 'Search',
|
||||
Icon: IconSearch,
|
||||
});
|
||||
openCommandMenu();
|
||||
},
|
||||
[openCommandMenu],
|
||||
);
|
||||
const onClick = () => {
|
||||
navigateCommandMenu({
|
||||
page: CommandMenuPages.SearchRecords,
|
||||
pageTitle: 'Search',
|
||||
pageIcon: IconSearch,
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
onClick,
|
||||
|
||||
Reference in New Issue
Block a user