import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Keyboard, RotateCcw, X } from 'lucide-react'; import { IN_APP_SHORTCUT_ACTIONS, GLOBAL_SHORTCUT_ACTIONS } from '../../config/shortcutActions'; import { useGlobalShortcutsStore, type GlobalAction, buildGlobalShortcut, formatGlobalShortcut } from '../../store/globalShortcutsStore'; import { useKeybindingsStore, type KeyAction, buildInAppBinding, formatBinding } from '../../store/keybindingsStore'; import SettingsSubSection from '../SettingsSubSection'; import { SettingsGroup } from './SettingsGroup'; import { SettingsSubCard } from './SettingsSubCard'; export function InputTab() { const { t } = useTranslation(); const kb = useKeybindingsStore(); const gs = useGlobalShortcutsStore(); const [listeningFor, setListeningFor] = useState(null); const [listeningForGlobal, setListeningForGlobal] = useState(null); return ( <> } action={ } >
{IN_APP_SHORTCUT_ACTIONS.map(({ id: action, getLabel }) => { const label = getLabel(t); const bound = kb.bindings[action]; const isListening = listeningFor === action; return (
{label}
{bound && !isListening && ( )}
); })}
} description={t('settings.globalShortcutsNote')} action={ } >
{GLOBAL_SHORTCUT_ACTIONS.map(({ id: action, getLabel }) => { const label = getLabel(t); const bound = gs.shortcuts[action] ?? null; const isListening = listeningForGlobal === action; return (
{label}
{bound && !isListening && ( )}
); })}
); }