Closes #https://github.com/twentyhq/core-team-issues/issues/251 https://github.com/user-attachments/assets/065c97fe-1daf-4b48-9d57-6bbb96d24ede
26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
import { useSetRecoilState } from 'recoil';
|
|
|
|
import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
|
|
import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
|
|
import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
|
|
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
|
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
|
|
import { IconCalendarEvent } from 'twenty-ui';
|
|
|
|
export const useOpenCalendarEventRightDrawer = () => {
|
|
const { openRightDrawer } = useRightDrawer();
|
|
const setHotkeyScope = useSetHotkeyScope();
|
|
const setViewableRecordId = useSetRecoilState(viewableRecordIdState);
|
|
|
|
const openCalendarEventRightDrawer = (calendarEventId: string) => {
|
|
setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
|
|
openRightDrawer(RightDrawerPages.ViewCalendarEvent, {
|
|
title: 'Calendar Event',
|
|
Icon: IconCalendarEvent,
|
|
});
|
|
setViewableRecordId(calendarEventId);
|
|
};
|
|
|
|
return { openCalendarEventRightDrawer };
|
|
};
|