/** * ShortcutHelpModal - Card catalog reference for keyboard shortcuts. * * Design: "Card Catalog" - Like a librarian's well-organized reference card. * Two-column layout spreads content horizontally. Typewriter-style keys * with embossed shadows evoke vintage office equipment. * * Uses Old Gold (secondary) for accents and dividers to maintain * the scholarly warmth of the Scholarly Dusk theme. */ import { KeyboardIcon } from "lucide-react"; import { cn } from "../lib/utils"; import { Dialog, DialogContent, DialogHeader, DialogTitle } from "./ui/dialog"; export interface ShortcutHelpModalProps { open: boolean; onOpenChange: (open: boolean) => void; } interface ShortcutItem { keys: string; description: string; } interface ShortcutGroup { title: string; shortcuts: ShortcutItem[]; } interface CommandExampleGroup { title: string; commands: string[]; } const shortcutGroups: ShortcutGroup[] = [ { title: "Global", shortcuts: [ { keys: "N", description: "New note" }, { keys: "Cmd+K", description: "Command palette" }, { keys: "/", description: "Focus search" }, { keys: "T", description: "Cycle search depth" }, { keys: "?", description: "Show shortcuts" }, { keys: "Esc", description: "Close modal" }, ], }, { title: "Editor", shortcuts: [ { keys: "Ctrl+S", description: "Save" }, { keys: "Ctrl+B", description: "Bold" }, { keys: "Ctrl+I", description: "Italic" }, { keys: "Ctrl+K", description: "Insert link" }, { keys: "Esc", description: "Close editor" }, ], }, ]; // Separate footer shortcut const footerShortcut: ShortcutItem = { keys: "Ctrl+Enter", description: "Submit form", }; const commandExamples: CommandExampleGroup[] = [ { title: "Create", commands: [ "new note", "new note in current location", "create folder here", "Project Note", "Research Note", ], }, { title: "Current Note", commands: [ "rename current note", "move current note", "duplicate current note", "Intro", "Details", ], }, ]; function KeyCombo({ keys }: { keys: string }) { const parts = keys.split("+"); return (
{parts.map((key, i) => ( {i > 0 && ( + )} {key} ))}
); } function ShortcutRow({ shortcut }: { shortcut: ShortcutItem }) { return (
{shortcut.description}
); } function ShortcutGroupCard({ group }: { group: ShortcutGroup }) { return (
{/* Card catalog divider header */}

{group.title}

{/* Shortcuts list */}
{group.shortcuts.map((shortcut) => ( ))}
); } export function ShortcutHelpModal({ open, onOpenChange, }: ShortcutHelpModalProps) { return ( Keyboard Shortcuts {/* Two-column grid for main groups */}
{shortcutGroups.map((group) => ( ))}
{/* Footer shortcut - single row */}
Forms {footerShortcut.description}
Command Palette Examples
{commandExamples.map((group) => (
{group.title}
{group.commands.map((command) => (
{command}
))}
))}
); }