Add task and note create option in comand menu (#1115)
* add task and note create option in comand menu * Re-run CIs --------- Co-authored-by: Weiko <corentin@twenty.com> Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
22b4bffcde
commit
4a388b8ed5
@ -1,14 +1,18 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { useRecoilState, useSetRecoilState } from 'recoil';
|
||||
|
||||
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
||||
import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
|
||||
|
||||
import { commandMenuCommands } from '../constants/commandMenuCommands';
|
||||
import { commandMenuCommand } from '../states/commandMenuCommandsState';
|
||||
import { isCommandMenuOpenedState } from '../states/isCommandMenuOpenedState';
|
||||
import { Command } from '../types/Command';
|
||||
|
||||
export function useCommandMenu() {
|
||||
const [, setIsCommandMenuOpenedState] = useRecoilState(
|
||||
isCommandMenuOpenedState,
|
||||
);
|
||||
const setCommands = useSetRecoilState(commandMenuCommand);
|
||||
const {
|
||||
setHotkeyScopeAndMemorizePreviousScope,
|
||||
goBackToPreviousHotkeyScope,
|
||||
@ -24,8 +28,18 @@ export function useCommandMenu() {
|
||||
goBackToPreviousHotkeyScope();
|
||||
}
|
||||
|
||||
function addToCommandMenu(addCommand: Command[]) {
|
||||
setCommands((prev) => [...prev, ...addCommand]);
|
||||
}
|
||||
|
||||
function setToIntitialCommandMenu() {
|
||||
setCommands(commandMenuCommands);
|
||||
}
|
||||
|
||||
return {
|
||||
openCommandMenu,
|
||||
closeCommandMenu,
|
||||
addToCommandMenu,
|
||||
setToIntitialCommandMenu,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user