fix: preset renaming

This commit is contained in:
2026-09-13 17:13:03 +02:00
parent 8c0b272ab9
commit 4f2bce1f5f
5 changed files with 26 additions and 28 deletions
+8 -8
View File
@@ -164,7 +164,7 @@ pub async fn recall_preset(
}) })
} }
// Command `0x21` // Command `0x21` -- TODO
#[tauri::command] #[tauri::command]
pub async fn store_current_configuration( pub async fn store_current_configuration(
state: State<'_, AppState>, state: State<'_, AppState>,
@@ -180,7 +180,7 @@ pub async fn store_current_configuration(
}) })
} }
// Command `0x23` // Command `0x23` -- TODO
#[tauri::command] #[tauri::command]
pub async fn factory_reset( pub async fn factory_reset(
state: State<'_, AppState>, state: State<'_, AppState>,
@@ -207,7 +207,7 @@ pub async fn set_current_preset_name(
}) })
} }
// Command `0x2A` // Command `0x2A` -- TODO
#[tauri::command] #[tauri::command]
pub async fn copy_channel( pub async fn copy_channel(
state: State<'_, AppState>, state: State<'_, AppState>,
@@ -223,8 +223,8 @@ pub async fn copy_channel(
}) })
} }
// Command `0x2D` // Command `0x2D` -- TODO
// Command `0x2F` // Command `0x2F` -- TODO
// Command `0x30` // Command `0x30`
#[tauri::command] #[tauri::command]
@@ -372,7 +372,7 @@ pub async fn set_delay(
}) })
} }
// Command `0x39` // Command `0x39` -- TODO
#[tauri::command] #[tauri::command]
pub async fn set_input_source( pub async fn set_input_source(
state: State<'_, AppState>, state: State<'_, AppState>,
@@ -403,7 +403,7 @@ pub async fn set_matrix_routing(
}) })
} }
// Command `0x3B` // Command `0x3B` -- TODO
#[tauri::command] #[tauri::command]
pub async fn link_channels( pub async fn link_channels(
state: State<'_, AppState>, state: State<'_, AppState>,
@@ -435,7 +435,7 @@ pub async fn set_bypass_peq(
}) })
} }
// Command `0x3D` // Command `0x3D` -- TODO
#[tauri::command] #[tauri::command]
pub async fn set_channel_name( pub async fn set_channel_name(
state: State<'_, AppState>, state: State<'_, AppState>,
+10 -7
View File
@@ -46,8 +46,8 @@ function AppCombobox({
appOptions: SidebarAppOption[]; appOptions: SidebarAppOption[];
selectedAppId?: string; selectedAppId?: string;
appName: string; appName: string;
onAppChange?: (id: string) => void; onAppChange: (id: string) => void;
onAppRename?: (name: string) => void; onAppRename: (name: string) => void;
}) { }) {
const currentOption = appOptions.find((o) => o.id === selectedAppId) ?? appOptions[0]; const currentOption = appOptions.find((o) => o.id === selectedAppId) ?? appOptions[0];
const canRename = currentOption?.id !== 'f00'; const canRename = currentOption?.id !== 'f00';
@@ -95,6 +95,7 @@ function AppCombobox({
if (!canRename) return; if (!canRename) return;
setInputValue((currentOption?.name ?? appName).trim());
setEditing(true); setEditing(true);
setOpen(false); setOpen(false);
@@ -124,13 +125,13 @@ function AppCombobox({
if (matched) { if (matched) {
if (matched.id !== selectedAppId) { if (matched.id !== selectedAppId) {
onAppChange?.(matched.id); onAppChange(matched.id);
} }
return; return;
} }
if (trimmed !== currentOption?.name) { if (trimmed !== currentOption?.name) {
onAppRename?.(trimmed); onAppRename(trimmed);
} }
} }
@@ -186,6 +187,7 @@ function AppCombobox({
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
aria-haspopup="listbox" aria-haspopup="listbox"
aria-expanded={open} aria-expanded={open}
title={canRename ? 'Double click to rename' : undefined}
> >
<span className="sidebar-app-trigger-label">{currentOption?.name ?? appName}</span> <span className="sidebar-app-trigger-label">{currentOption?.name ?? appName}</span>
<svg className="sidebar-app-trigger-caret" viewBox="0 0 24 24" width="14" height="14"> <svg className="sidebar-app-trigger-caret" viewBox="0 0 24 24" width="14" height="14">
@@ -209,7 +211,8 @@ function AppCombobox({
onMouseEnter={() => setHighlight(i)} onMouseEnter={() => setHighlight(i)}
onClick={() => pick(opt)} onClick={() => pick(opt)}
> >
{opt.name} <span className="sidebar-app-option-id">{opt.id + '-'}</span>
<span>{opt.name}</span>
</li> </li>
))} ))}
</ul> </ul>
@@ -236,8 +239,8 @@ export function Sidebar<T extends string>({
appName: string; appName: string;
appOptions?: SidebarAppOption[]; appOptions?: SidebarAppOption[];
selectedAppId?: string; selectedAppId?: string;
onAppChange?: (id: string) => void; onAppChange: (id: string) => void;
onAppRename?: (name: string) => void; onAppRename: (name: string) => void;
expanded: boolean; expanded: boolean;
onToggle: () => void; onToggle: () => void;
}) { }) {
@@ -151,7 +151,7 @@ function DSP408Panel({ dsp, api }: { dsp: DSP408; api: DSP408Api }) {
return ( return (
<ChannelSection <ChannelSection
dsp={dsp} dsp={dsp}
channel={{Input: InputChannel.InA}} channel={{ Input: InputChannel.InA }}
setLowPass={api.setLowPass} setLowPass={api.setLowPass}
setHighPass={api.setHighPass} setHighPass={api.setHighPass}
setPeq={api.setPeqBand} setPeq={api.setPeqBand}
@@ -163,7 +163,7 @@ function DSP408Panel({ dsp, api }: { dsp: DSP408; api: DSP408Api }) {
return ( return (
<ChannelSection <ChannelSection
dsp={dsp} dsp={dsp}
channel={{Input: InputChannel.InB}} channel={{ Input: InputChannel.InB }}
setLowPass={api.setLowPass} setLowPass={api.setLowPass}
setHighPass={api.setHighPass} setHighPass={api.setHighPass}
setPeq={api.setPeqBand} setPeq={api.setPeqBand}
@@ -175,7 +175,7 @@ function DSP408Panel({ dsp, api }: { dsp: DSP408; api: DSP408Api }) {
return ( return (
<ChannelSection <ChannelSection
dsp={dsp} dsp={dsp}
channel={{Input: InputChannel.InC}} channel={{ Input: InputChannel.InC }}
setLowPass={api.setLowPass} setLowPass={api.setLowPass}
setHighPass={api.setHighPass} setHighPass={api.setHighPass}
setPeq={api.setPeqBand} setPeq={api.setPeqBand}
@@ -187,7 +187,7 @@ function DSP408Panel({ dsp, api }: { dsp: DSP408; api: DSP408Api }) {
return ( return (
<ChannelSection <ChannelSection
dsp={dsp} dsp={dsp}
channel={{Input: InputChannel.InD}} channel={{ Input: InputChannel.InD }}
setLowPass={api.setLowPass} setLowPass={api.setLowPass}
setHighPass={api.setHighPass} setHighPass={api.setHighPass}
setPeq={api.setPeqBand} setPeq={api.setPeqBand}
@@ -199,7 +199,7 @@ function DSP408Panel({ dsp, api }: { dsp: DSP408; api: DSP408Api }) {
return ( return (
<ChannelSection <ChannelSection
dsp={dsp} dsp={dsp}
channel={{Output: OutputChannel.Out1}} channel={{ Output: OutputChannel.Out1 }}
setLowPass={api.setLowPass} setLowPass={api.setLowPass}
setHighPass={api.setHighPass} setHighPass={api.setHighPass}
setPeq={api.setPeqBand} setPeq={api.setPeqBand}
@@ -459,9 +459,7 @@ function ChannelSection({
const ActiveLowPassFilter = activeChannelState.crossover.low_pass; const ActiveLowPassFilter = activeChannelState.crossover.low_pass;
const ActivePeq = activeChannelState.peq_chain; const ActivePeq = activeChannelState.peq_chain;
const bandsOrder = isInput const bandsOrder = isInput ? PEQ_BANDS_ORDER.slice(0, -1) : PEQ_BANDS_ORDER;
? PEQ_BANDS_ORDER.slice(0, -1)
: PEQ_BANDS_ORDER;
const handleResetPeq = async () => { const handleResetPeq = async () => {
if (resetting) return; if (resetting) return;
+1 -4
View File
@@ -12,10 +12,7 @@ export function useNotifications() {
const fullMessage = dspName ? `${dspName}: ${message}` : message; const fullMessage = dspName ? `${dspName}: ${message}` : message;
setNotifications((prev) => [ setNotifications((prev) => [...prev, { id, message: fullMessage, type }]);
...prev,
{ id, message: fullMessage, type },
]);
const removeLater = () => { const removeLater = () => {
if (hovered.current.has(id)) { if (hovered.current.has(id)) {