import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "@/components/ui/dialog"; import { Badge } from "@/components/ui/badge"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Keyboard } from "lucide-react"; import { type KeyboardShortcut, formatShortcut } from "@/hooks/useKeyboardShortcuts"; interface KeyboardShortcutsHelpProps { open: boolean; onOpenChange: (open: boolean) => void; shortcuts: KeyboardShortcut[]; } export function KeyboardShortcutsHelp({ open, onOpenChange, shortcuts }: KeyboardShortcutsHelpProps) { // Group shortcuts by category const groupedShortcuts = shortcuts.reduce((acc, shortcut) => { // Determine category based on description let category = 'Général'; if (shortcut.description.toLowerCase().includes('note')) { category = 'Notes'; } else if (shortcut.description.toLowerCase().includes('recherch')) { category = 'Recherche'; } else if (shortcut.description.toLowerCase().includes('todo') || shortcut.description.toLowerCase().includes('tâche')) { category = 'Tâches'; } else if (shortcut.description.toLowerCase().includes('navigation')) { category = 'Navigation'; } else if (shortcut.description.toLowerCase().includes('édition') || shortcut.description.toLowerCase().includes('gras') || shortcut.description.toLowerCase().includes('italique')) { category = 'Édition'; } if (!acc[category]) { acc[category] = []; } acc[category].push(shortcut); return acc; }, {} as Record); return ( Raccourcis clavier Utilisez ces raccourcis pour naviguer plus rapidement
{Object.entries(groupedShortcuts).map(([category, categoryShortcuts]) => (

{category}

{categoryShortcuts.map((shortcut, index) => (
{shortcut.description} {formatShortcut(shortcut)}
))}
))}
Appuyez sur ? pour afficher cette aide
); }