mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-16 13:20:39 -07:00
- Fix inverted effects toggle in FloatingGenerateBox - Add Save button + API method for editing custom effect presets - Return early on effects save failure in ProfileForm - Fix no-op ternary in effectsStore - Handle duplicate preset names with proper 400 response - Use effects_chain is None instead of label for clean version lookup - Move blocking audio ops to asyncio.to_thread in async endpoints - Log warnings instead of silently swallowing parse errors
27 lines
872 B
TypeScript
27 lines
872 B
TypeScript
import { create } from 'zustand';
|
|
import type { EffectConfig } from '@/lib/api/types';
|
|
|
|
interface EffectsStore {
|
|
selectedPresetId: string | null;
|
|
setSelectedPresetId: (id: string | null) => void;
|
|
|
|
// Working chain for the detail panel (editing a preset or building a new one)
|
|
workingChain: EffectConfig[];
|
|
setWorkingChain: (chain: EffectConfig[]) => void;
|
|
|
|
// Track if editing an existing preset vs creating new
|
|
isCreatingNew: boolean;
|
|
setIsCreatingNew: (v: boolean) => void;
|
|
}
|
|
|
|
export const useEffectsStore = create<EffectsStore>((set) => ({
|
|
selectedPresetId: null,
|
|
setSelectedPresetId: (id) => set({ selectedPresetId: id, isCreatingNew: false }),
|
|
|
|
workingChain: [],
|
|
setWorkingChain: (chain) => set({ workingChain: chain }),
|
|
|
|
isCreatingNew: false,
|
|
setIsCreatingNew: (v) => set({ isCreatingNew: v, ...(v && { selectedPresetId: null }) }),
|
|
}));
|