Files
voicebox/app/src/stores/audioChannelStore.ts
T
Jamie Pine f1be633dca Implement FloatingGenerateBox component and update App layout
- Introduced the FloatingGenerateBox component for audio generation, enhancing user interaction with voice profiles.
- Updated App component to integrate FloatingGenerateBox and removed the GenerationForm component.
- Enhanced the layout for better responsiveness and added functionality to manage audio playback state.
- Updated UpdateStatus component to include new update handling logic and improved UI feedback for update readiness.
2026-01-27 13:18:12 -08:00

43 lines
1.1 KiB
TypeScript

import { create } from 'zustand';
import { persist } from 'zustand/middleware';
export interface AudioChannel {
id: string;
name: string;
is_default: boolean;
device_ids: string[];
created_at: string;
}
interface AudioChannelStore {
channels: AudioChannel[];
setChannels: (channels: AudioChannel[]) => void;
addChannel: (channel: AudioChannel) => void;
updateChannel: (id: string, channel: Partial<AudioChannel>) => void;
removeChannel: (id: string) => void;
}
export const useAudioChannelStore = create<AudioChannelStore>()(
persist(
(set) => ({
channels: [],
setChannels: (channels) => set({ channels }),
addChannel: (channel) =>
set((state) => ({
channels: [...state.channels, channel],
})),
updateChannel: (id, updates) =>
set((state) => ({
channels: state.channels.map((ch) => (ch.id === id ? { ...ch, ...updates } : ch)),
})),
removeChannel: (id) =>
set((state) => ({
channels: state.channels.filter((ch) => ch.id !== id),
})),
}),
{
name: 'voicebox-audio-channels',
},
),
);