import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from '@/components/ui/dialog' import { formatKeyBinding, SHORTCUT_DEFINITIONS, SHORTCUT_SCOPE_LABELS, } from '@/lib/keyboardShortcuts' import type { KeyBinding, ShortcutActionId, ShortcutScope, } from '@/lib/keyboardShortcuts' import type { FC } from 'react' type Props = { open: boolean onOpenChange: (open: boolean) => void activeScope: ShortcutScope effectiveBindings: Record conflictActionIds: Set availableActionIds: Set } const ShortcutHelpDialog: FC = ( { open, onOpenChange, activeScope, effectiveBindings, conflictActionIds, availableActionIds, }, ) => { const rows = SHORTCUT_DEFINITIONS .filter (definition => definition.scope === 'global' || definition.scope === activeScope) .filter (definition => availableActionIds.has (definition.id)) return ( キーボード・ショートカット この画面で利用できるショートカットを表示します。
{rows.map (row => ( ))}
操作 適用範囲 キー 競合
{row.label} {SHORTCUT_SCOPE_LABELS[row.scope]} {formatKeyBinding (effectiveBindings[row.id])} {conflictActionIds.has (row.id) ? 競合あり : 'なし'}
) } export default ShortcutHelpDialog