- {[
- { key: "addFeature" as keyof KeyboardShortcuts, label: "Add Feature" },
- { key: "addContextFile" as keyof KeyboardShortcuts, label: "Add Context File" },
- { key: "startNext" as keyof KeyboardShortcuts, label: "Start Next Features" },
- { key: "newSession" as keyof KeyboardShortcuts, label: "New Session" },
- { key: "openProject" as keyof KeyboardShortcuts, label: "Open Project" },
- { key: "projectPicker" as keyof KeyboardShortcuts, label: "Project Picker" },
- { key: "cyclePrevProject" as keyof KeyboardShortcuts, label: "Previous Project" },
- { key: "cycleNextProject" as keyof KeyboardShortcuts, label: "Next Project" },
- { key: "addProfile" as keyof KeyboardShortcuts, label: "Add Profile" },
- ].map(({ key, label }) => (
-
-
{label}
-
- {editingShortcut === key ? (
- <>
-
{
- const value = e.target.value.toUpperCase();
- setShortcutValue(value);
- // Check for conflicts
- const conflict = Object.entries(keyboardShortcuts).find(
- ([k, v]) => k !== key && v.toUpperCase() === value
- );
- if (conflict) {
- setShortcutError(`Already used by ${conflict[0]}`);
- } else {
- setShortcutError(null);
- }
- }}
- onKeyDown={(e) => {
- if (e.key === "Enter" && !shortcutError && shortcutValue) {
- setKeyboardShortcut(key, shortcutValue);
- setEditingShortcut(null);
- setShortcutValue("");
- setShortcutError(null);
- } else if (e.key === "Escape") {
- setEditingShortcut(null);
- setShortcutValue("");
- setShortcutError(null);
- }
- }}
- className="w-24 h-8 text-center font-mono"
- placeholder="Key"
- maxLength={2}
- autoFocus
- data-testid={`edit-shortcut-${key}`}
- />
-
-
- >
- ) : (
- <>
-
- {keyboardShortcuts[key] !== DEFAULT_KEYBOARD_SHORTCUTS[key] && (
-
(modified)
- )}
- >
- )}
-
-
- ))}
-