From 857f46f86a4d77a2599b1c531146127f7f7ce21b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Dec 2025 17:38:45 +0000 Subject: [PATCH] Update remaining components to use customizable keyboard shortcuts Co-authored-by: GTheMachine <156854865+GTheMachine@users.noreply.github.com> --- app/src/components/views/agent-view.tsx | 13 +++++++------ app/src/components/views/context-view.tsx | 9 +++++---- app/src/components/views/profiles-view.tsx | 15 ++++++++------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/src/components/views/agent-view.tsx b/app/src/components/views/agent-view.tsx index 7e59a123..2d6a7b7c 100644 --- a/app/src/components/views/agent-view.tsx +++ b/app/src/components/views/agent-view.tsx @@ -26,12 +26,13 @@ import { Markdown } from "@/components/ui/markdown"; import type { ImageAttachment } from "@/store/app-store"; import { useKeyboardShortcuts, - ACTION_SHORTCUTS, + useKeyboardShortcutsConfig, KeyboardShortcut, } from "@/hooks/use-keyboard-shortcuts"; export function AgentView() { const { currentProject, setLastSelectedSession, getLastSelectedSession } = useAppStore(); + const shortcuts = useKeyboardShortcutsConfig(); const [input, setInput] = useState(""); const [selectedImages, setSelectedImages] = useState([]); const [showImageDropZone, setShowImageDropZone] = useState(false); @@ -417,12 +418,12 @@ export function AgentView() { // Keyboard shortcuts for agent view const agentShortcuts: KeyboardShortcut[] = useMemo(() => { - const shortcuts: KeyboardShortcut[] = []; + const shortcutsList: KeyboardShortcut[] = []; // New session shortcut - only when in agent view with a project if (currentProject) { - shortcuts.push({ - key: ACTION_SHORTCUTS.newSession, + shortcutsList.push({ + key: shortcuts.newSession, action: () => { if (quickCreateSessionRef.current) { quickCreateSessionRef.current(); @@ -432,8 +433,8 @@ export function AgentView() { }); } - return shortcuts; - }, [currentProject]); + return shortcutsList; + }, [currentProject, shortcuts]); // Register keyboard shortcuts useKeyboardShortcuts(agentShortcuts); diff --git a/app/src/components/views/context-view.tsx b/app/src/components/views/context-view.tsx index 5cb184a9..b8d1a1ec 100644 --- a/app/src/components/views/context-view.tsx +++ b/app/src/components/views/context-view.tsx @@ -19,7 +19,7 @@ import { } from "lucide-react"; import { useKeyboardShortcuts, - ACTION_SHORTCUTS, + useKeyboardShortcutsConfig, KeyboardShortcut, } from "@/hooks/use-keyboard-shortcuts"; import { @@ -43,6 +43,7 @@ interface ContextFile { export function ContextView() { const { currentProject } = useAppStore(); + const shortcuts = useKeyboardShortcutsConfig(); const [contextFiles, setContextFiles] = useState([]); const [selectedFile, setSelectedFile] = useState(null); const [isLoading, setIsLoading] = useState(true); @@ -63,12 +64,12 @@ export function ContextView() { const contextShortcuts: KeyboardShortcut[] = useMemo( () => [ { - key: ACTION_SHORTCUTS.addContextFile, + key: shortcuts.addContextFile, action: () => setIsAddDialogOpen(true), description: "Add new context file", }, ], - [] + [shortcuts] ); useKeyboardShortcuts(contextShortcuts); @@ -374,7 +375,7 @@ export function ContextView() { className="ml-2 px-1.5 py-0.5 text-[10px] font-mono rounded bg-secondary border border-border" data-testid="shortcut-add-context-file" > - {ACTION_SHORTCUTS.addContextFile} + {shortcuts.addContextFile} diff --git a/app/src/components/views/profiles-view.tsx b/app/src/components/views/profiles-view.tsx index 82bf811d..bd882845 100644 --- a/app/src/components/views/profiles-view.tsx +++ b/app/src/components/views/profiles-view.tsx @@ -9,7 +9,7 @@ import { Textarea } from "@/components/ui/textarea"; import { cn, modelSupportsThinking } from "@/lib/utils"; import { useKeyboardShortcuts, - ACTION_SHORTCUTS, + useKeyboardShortcutsConfig, KeyboardShortcut, } from "@/hooks/use-keyboard-shortcuts"; import { @@ -440,6 +440,7 @@ function ProfileForm({ export function ProfilesView() { const { aiProfiles, addAIProfile, updateAIProfile, removeAIProfile, reorderAIProfiles } = useAppStore(); + const shortcuts = useKeyboardShortcutsConfig(); const [showAddDialog, setShowAddDialog] = useState(false); const [editingProfile, setEditingProfile] = useState(null); @@ -508,17 +509,17 @@ export function ProfilesView() { // Build keyboard shortcuts for profiles view const profilesShortcuts: KeyboardShortcut[] = useMemo(() => { - const shortcuts: KeyboardShortcut[] = []; + const shortcutsList: KeyboardShortcut[] = []; // Add profile shortcut - when in profiles view - shortcuts.push({ - key: ACTION_SHORTCUTS.addProfile, + shortcutsList.push({ + key: shortcuts.addProfile, action: () => setShowAddDialog(true), description: "Create new profile", }); - return shortcuts; - }, []); + return shortcutsList; + }, [shortcuts]); // Register keyboard shortcuts for profiles view useKeyboardShortcuts(profilesShortcuts); @@ -549,7 +550,7 @@ export function ProfilesView() { New Profile - {ACTION_SHORTCUTS.addProfile} + {shortcuts.addProfile}