feat: recreate dashboard page from previous version

This commit is contained in:
Sonny
2024-05-03 02:10:15 +02:00
committed by Sonny
parent 2cc490b611
commit 2cf8c5ae02
66 changed files with 2087 additions and 86 deletions

View File

@@ -0,0 +1,18 @@
import KEYS from '#constants/keys';
import PATHS from '#constants/paths';
import { router } from '@inertiajs/react';
import { ReactNode } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import useGlobalHotkeys from '~/hooks/use_global_hotkeys';
export default function BackToDashboard({ children }: { children: ReactNode }) {
const { globalHotkeysEnabled } = useGlobalHotkeys();
useHotkeys(
KEYS.ESCAPE_KEY,
() => {
router.visit(PATHS.DASHBOARD);
},
{ enabled: globalHotkeysEnabled, enableOnFormTags: ['INPUT'] }
);
return <>{children}</>;
}