mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-20 07:10:40 -07:00
Initialize voicebox project with backend, frontend, and Tauri setup. Added configuration files, dependencies, and basic structure for components, hooks, and utilities. Included README and setup documentation for guidance.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
interface PlayerState {
|
||||
currentAudioId: string | null;
|
||||
isPlaying: boolean;
|
||||
currentTime: number;
|
||||
duration: number;
|
||||
volume: number;
|
||||
|
||||
setCurrentAudio: (audioId: string | null) => void;
|
||||
setIsPlaying: (playing: boolean) => void;
|
||||
setCurrentTime: (time: number) => void;
|
||||
setDuration: (duration: number) => void;
|
||||
setVolume: (volume: number) => void;
|
||||
reset: () => void;
|
||||
}
|
||||
|
||||
export const usePlayerStore = create<PlayerState>((set) => ({
|
||||
currentAudioId: null,
|
||||
isPlaying: false,
|
||||
currentTime: 0,
|
||||
duration: 0,
|
||||
volume: 1,
|
||||
|
||||
setCurrentAudio: (audioId) => set({ currentAudioId: audioId, currentTime: 0, isPlaying: false }),
|
||||
setIsPlaying: (playing) => set({ isPlaying: playing }),
|
||||
setCurrentTime: (time) => set({ currentTime: time }),
|
||||
setDuration: (duration) => set({ duration }),
|
||||
setVolume: (volume) => set({ volume }),
|
||||
reset: () =>
|
||||
set({
|
||||
currentAudioId: null,
|
||||
isPlaying: false,
|
||||
currentTime: 0,
|
||||
duration: 0,
|
||||
}),
|
||||
}));
|
||||
@@ -0,0 +1,31 @@
|
||||
import { create } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
|
||||
interface ServerStore {
|
||||
serverUrl: string;
|
||||
setServerUrl: (url: string) => void;
|
||||
|
||||
isConnected: boolean;
|
||||
setIsConnected: (connected: boolean) => void;
|
||||
|
||||
mode: 'local' | 'remote';
|
||||
setMode: (mode: 'local' | 'remote') => void;
|
||||
}
|
||||
|
||||
export const useServerStore = create<ServerStore>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
serverUrl: 'http://localhost:8000',
|
||||
setServerUrl: (url) => set({ serverUrl: url }),
|
||||
|
||||
isConnected: false,
|
||||
setIsConnected: (connected) => set({ isConnected: connected }),
|
||||
|
||||
mode: 'local',
|
||||
setMode: (mode) => set({ mode }),
|
||||
}),
|
||||
{
|
||||
name: 'voicebox-server',
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,39 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
interface UIStore {
|
||||
// Sidebar
|
||||
sidebarOpen: boolean;
|
||||
setSidebarOpen: (open: boolean) => void;
|
||||
|
||||
// Modals
|
||||
profileDialogOpen: boolean;
|
||||
setProfileDialogOpen: (open: boolean) => void;
|
||||
editingProfileId: string | null;
|
||||
setEditingProfileId: (id: string | null) => void;
|
||||
|
||||
generationDialogOpen: boolean;
|
||||
setGenerationDialogOpen: (open: boolean) => void;
|
||||
|
||||
// Theme
|
||||
theme: 'light' | 'dark';
|
||||
setTheme: (theme: 'light' | 'dark') => void;
|
||||
}
|
||||
|
||||
export const useUIStore = create<UIStore>((set) => ({
|
||||
sidebarOpen: true,
|
||||
setSidebarOpen: (open) => set({ sidebarOpen: open }),
|
||||
|
||||
profileDialogOpen: false,
|
||||
setProfileDialogOpen: (open) => set({ profileDialogOpen: open }),
|
||||
editingProfileId: null,
|
||||
setEditingProfileId: (id) => set({ editingProfileId: id }),
|
||||
|
||||
generationDialogOpen: false,
|
||||
setGenerationDialogOpen: (open) => set({ generationDialogOpen: open }),
|
||||
|
||||
theme: 'light',
|
||||
setTheme: (theme) => {
|
||||
set({ theme });
|
||||
document.documentElement.classList.toggle('dark', theme === 'dark');
|
||||
},
|
||||
}));
|
||||
Reference in New Issue
Block a user