import { useEffect } from 'react'; import { X, Keyboard } from 'lucide-react'; import { useT } from '../hooks/useLocale'; interface Props { open: boolean; onClose: () => void; } function Kbd({ children }: { children: React.ReactNode }) { return ( {children} ); } function ShortcutRow({ keys, label }: { keys: React.ReactNode; label: string }) { return (
{label}
{keys}
); } function SectionTitle({ children }: { children: React.ReactNode }) { return (
{children}
); } const isMac = typeof navigator !== 'undefined' && /Mac|iPod|iPhone|iPad/.test(navigator.userAgent); const mod = isMac ? '⌘' : 'Ctrl'; export function KeyboardShortcuts({ open, onClose }: Props) { const t = useT(); useEffect(() => { if (!open) return; const handler = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; window.addEventListener('keydown', handler); return () => window.removeEventListener('keydown', handler); }, [open, onClose]); if (!open) return null; return (
{/* Backdrop */}
{/* Modal */}
e.stopPropagation()} > {/* Header */}

{t('shortcuts.title')}

{/* Body */}
{t('shortcuts.chatSection')} Enter} label={t('shortcuts.send')} /> Shift+Enter} label={t('shortcuts.newline')} /> Esc} label={t('shortcuts.stop')} />
{t('shortcuts.navigationSection')} {mod}+K} label={t('shortcuts.search')} /> Alt+/} label={t('shortcuts.switchSession')} /> Esc} label={t('shortcuts.closeSidebar')} />
{t('shortcuts.generalSection')} ?} label={t('shortcuts.help')} />
); }