import { useEffect, useState } from "react"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, } from "@/components/ui/dialog"; const shortcutGroups = [ { heading: "Navigation", shortcuts: [ { keys: "g then d", description: "Go to Dashboard" }, { keys: "g then t", description: "Go to Tasks" }, { keys: "g then h", description: "Go to Habits" }, { keys: "g then p", description: "Go to Projects" }, { keys: "g then n", description: "Go to Notes" }, { keys: "g then c", description: "Go to Calendar" }, { keys: "g then g", description: "Go to Graph" }, { keys: "g then s", description: "Go to Settings" }, ], }, { heading: "General", shortcuts: [ { keys: "⌘K / Ctrl+K", description: "Open command palette" }, { keys: "/", description: "Focus search" }, { keys: "?", description: "Show this help" }, { keys: "Esc", description: "Close dialogs / panels" }, ], }, { heading: "Command Palette", shortcuts: [ { keys: "↑↓", description: "Navigate items" }, { keys: "Enter", description: "Select item" }, { keys: "Esc", description: "Close palette" }, ], }, ]; export function ShortcutsHelp() { const [open, setOpen] = useState(false); useEffect(() => { const handler = () => setOpen(true); document.addEventListener("open-shortcuts-help", handler); return () => document.removeEventListener("open-shortcuts-help", handler); }, []); return ( Keyboard Shortcuts Use these shortcuts to navigate quickly.
{shortcutGroups.map((group) => (

{group.heading}

{group.shortcuts.map((s) => (
{s.description} {s.keys}
))}
))}
); }