From 4f2bce1f5f8957849b88808d43d0ce3007ab9263 Mon Sep 17 00:00:00 2001 From: LucasDLTG Date: Sun, 13 Sep 2026 17:12:05 +0200 Subject: [PATCH] fix: preset renaming --- src-tauri/src/commands.rs | 16 ++++++++-------- src/components/Sidebar/Sidebar.tsx | 17 ++++++++++------- .../components/DSP408Panel/DSP408Panel.tsx | 10 +++++----- .../components/InputSection/ChannelSection.tsx | 4 +--- src/hooks/useNotifications.tsx | 7 ++----- 5 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index 4b7365b..675f97f 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -164,7 +164,7 @@ pub async fn recall_preset( }) } -// Command `0x21` +// Command `0x21` -- TODO #[tauri::command] pub async fn store_current_configuration( state: State<'_, AppState>, @@ -180,7 +180,7 @@ pub async fn store_current_configuration( }) } -// Command `0x23` +// Command `0x23` -- TODO #[tauri::command] pub async fn factory_reset( state: State<'_, AppState>, @@ -207,7 +207,7 @@ pub async fn set_current_preset_name( }) } -// Command `0x2A` +// Command `0x2A` -- TODO #[tauri::command] pub async fn copy_channel( state: State<'_, AppState>, @@ -223,8 +223,8 @@ pub async fn copy_channel( }) } -// Command `0x2D` -// Command `0x2F` +// Command `0x2D` -- TODO +// Command `0x2F` -- TODO // Command `0x30` #[tauri::command] @@ -372,7 +372,7 @@ pub async fn set_delay( }) } -// Command `0x39` +// Command `0x39` -- TODO #[tauri::command] pub async fn set_input_source( state: State<'_, AppState>, @@ -403,7 +403,7 @@ pub async fn set_matrix_routing( }) } -// Command `0x3B` +// Command `0x3B` -- TODO #[tauri::command] pub async fn link_channels( state: State<'_, AppState>, @@ -435,7 +435,7 @@ pub async fn set_bypass_peq( }) } -// Command `0x3D` +// Command `0x3D` -- TODO #[tauri::command] pub async fn set_channel_name( state: State<'_, AppState>, diff --git a/src/components/Sidebar/Sidebar.tsx b/src/components/Sidebar/Sidebar.tsx index 941c782..35792df 100644 --- a/src/components/Sidebar/Sidebar.tsx +++ b/src/components/Sidebar/Sidebar.tsx @@ -46,8 +46,8 @@ function AppCombobox({ appOptions: SidebarAppOption[]; selectedAppId?: string; appName: string; - onAppChange?: (id: string) => void; - onAppRename?: (name: string) => void; + onAppChange: (id: string) => void; + onAppRename: (name: string) => void; }) { const currentOption = appOptions.find((o) => o.id === selectedAppId) ?? appOptions[0]; const canRename = currentOption?.id !== 'f00'; @@ -95,6 +95,7 @@ function AppCombobox({ if (!canRename) return; + setInputValue((currentOption?.name ?? appName).trim()); setEditing(true); setOpen(false); @@ -124,13 +125,13 @@ function AppCombobox({ if (matched) { if (matched.id !== selectedAppId) { - onAppChange?.(matched.id); + onAppChange(matched.id); } return; } if (trimmed !== currentOption?.name) { - onAppRename?.(trimmed); + onAppRename(trimmed); } } @@ -186,6 +187,7 @@ function AppCombobox({ onKeyDown={handleKeyDown} aria-haspopup="listbox" aria-expanded={open} + title={canRename ? 'Double click to rename' : undefined} > {currentOption?.name ?? appName} @@ -209,7 +211,8 @@ function AppCombobox({ onMouseEnter={() => setHighlight(i)} onClick={() => pick(opt)} > - {opt.name} + {opt.id + '-'} + {opt.name} ))} @@ -236,8 +239,8 @@ export function Sidebar({ appName: string; appOptions?: SidebarAppOption[]; selectedAppId?: string; - onAppChange?: (id: string) => void; - onAppRename?: (name: string) => void; + onAppChange: (id: string) => void; + onAppRename: (name: string) => void; expanded: boolean; onToggle: () => void; }) { diff --git a/src/features/dsp408/components/DSP408Panel/DSP408Panel.tsx b/src/features/dsp408/components/DSP408Panel/DSP408Panel.tsx index 6767d3b..6e06080 100644 --- a/src/features/dsp408/components/DSP408Panel/DSP408Panel.tsx +++ b/src/features/dsp408/components/DSP408Panel/DSP408Panel.tsx @@ -151,7 +151,7 @@ function DSP408Panel({ dsp, api }: { dsp: DSP408; api: DSP408Api }) { return ( { if (resetting) return; diff --git a/src/hooks/useNotifications.tsx b/src/hooks/useNotifications.tsx index 210e520..ad29875 100644 --- a/src/hooks/useNotifications.tsx +++ b/src/hooks/useNotifications.tsx @@ -12,10 +12,7 @@ export function useNotifications() { const fullMessage = dspName ? `${dspName}: ${message}` : message; - setNotifications((prev) => [ - ...prev, - { id, message: fullMessage, type }, - ]); + setNotifications((prev) => [...prev, { id, message: fullMessage, type }]); const removeLater = () => { if (hovered.current.has(id)) { @@ -53,4 +50,4 @@ export function useNotifications() { removeNotification, hoverNotification, }; -} \ No newline at end of file +}