Refactor hotkyes in its own lib folder (#660)

* Refactor hotkyes in its own lib folder

* Lint

* Fix PR comments

* rename hotkeysScope into hotkeyScope
This commit is contained in:
Charles Bochet
2023-07-14 12:27:26 -07:00
committed by GitHub
parent 7bcea343e2
commit e93a96b3b1
71 changed files with 398 additions and 386 deletions

View File

@ -4,9 +4,9 @@ import { v4 } from 'uuid';
import { currentUserState } from '@/auth/states/currentUserState';
import { GET_COMPANIES } from '@/companies/services';
import { useSetHotkeysScope } from '@/hotkeys/hooks/useSetHotkeysScope';
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
import { useSetHotkeyScope } from '@/lib/hotkeys/hooks/useSetHotkeyScope';
import { GET_PEOPLE } from '@/people/services';
import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import { useCreateCommentThreadMutation } from '~/generated/graphql';
@ -23,7 +23,7 @@ export function useOpenCreateCommentThreadDrawer() {
const openRightDrawer = useOpenRightDrawer();
const [createCommentThreadMutation] = useCreateCommentThreadMutation();
const currentUser = useRecoilValue(currentUserState);
const setHotkeysScope = useSetHotkeysScope();
const setHotkeyScope = useSetHotkeyScope();
const [, setCommentableEntityArray] = useRecoilState(
commentableEntityArrayState,
@ -54,7 +54,7 @@ export function useOpenCreateCommentThreadDrawer() {
getOperationName(GET_COMMENT_THREADS_BY_TARGETS) ?? '',
],
onCompleted(data) {
setHotkeysScope(InternalHotkeysScope.RightDrawer, { goto: false });
setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
setViewableCommentThreadId(data.createOneCommentThread.id);
setCommentableEntityArray([entity]);
openRightDrawer(RightDrawerPages.CreateCommentThread);