feat: add keyboard shortcut help modal triggered by ? key

This commit is contained in:
Your Name
2026-02-15 20:32:32 +02:00
parent fde10d1a3c
commit e5e9483a8e
3 changed files with 86 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import { BoardView } from "@/components/board/BoardView";
import { CommandPalette } from "@/components/command-palette/CommandPalette";
import { SettingsDialog } from "@/components/settings/SettingsDialog";
import { ToastContainer } from "@/components/toast/ToastContainer";
import { ShortcutHelpModal } from "@/components/shortcuts/ShortcutHelpModal";
import { useKeyboardShortcuts } from "@/hooks/useKeyboardShortcuts";
export default function App() {
@@ -16,6 +17,7 @@ export default function App() {
const view = useAppStore((s) => s.view);
const [settingsOpen, setSettingsOpen] = useState(false);
const [shortcutHelpOpen, setShortcutHelpOpen] = useState(false);
useEffect(() => {
init();
@@ -42,6 +44,16 @@ export default function App() {
};
}, []);
useEffect(() => {
function handleOpenShortcutHelp() {
setShortcutHelpOpen(true);
}
document.addEventListener("open-shortcut-help", handleOpenShortcutHelp);
return () => {
document.removeEventListener("open-shortcut-help", handleOpenShortcutHelp);
};
}, []);
const handleOpenSettings = useCallback(() => {
setSettingsOpen(true);
}, []);
@@ -66,6 +78,7 @@ export default function App() {
<CommandPalette onOpenSettings={handleOpenSettings} />
<SettingsDialog open={settingsOpen} onOpenChange={setSettingsOpen} />
<ToastContainer />
<ShortcutHelpModal open={shortcutHelpOpen} onOpenChange={setShortcutHelpOpen} />
</>
);
}