refactor: remove react-hotkeys-hook and use inertia propos instead of recreating a local store

This commit is contained in:
Sonny
2025-08-19 23:47:52 +02:00
parent 1d1e182523
commit 42f391d99a
16 changed files with 122 additions and 182 deletions

View File

@@ -1,5 +1,5 @@
import KEYS from '#core/constants/keys';
import { useHotkeys } from 'react-hotkeys-hook';
import { useHotkeys } from '@mantine/hooks';
import { useGlobalHotkeysStore } from '~/stores/global_hotkeys_store';
type ShortcutOptions = {
@@ -16,15 +16,12 @@ export default function useShortcut(
}
) {
const { globalHotkeysEnabled } = useGlobalHotkeysStore();
const isEnabled = disableGlobalCheck
? enabled
: enabled && globalHotkeysEnabled;
return useHotkeys(
KEYS[key],
(event) => {
event.preventDefault();
cb();
},
{
enabled: disableGlobalCheck ? enabled : enabled && globalHotkeysEnabled,
enableOnFormTags: ['INPUT'],
}
[[KEYS[key], () => isEnabled && cb(), { preventDefault: true }]],
undefined,
true
);
}