WIP Working on player

This commit is contained in:
Mistral Vibe
2026-04-08 08:12:05 +00:00
parent ff4985a719
commit d654ad5987
16 changed files with 1714 additions and 94 deletions

View File

@@ -0,0 +1,35 @@
import { create } from "zustand";
interface PlayerState {
isPlaying: boolean;
currentTime: number;
duration: number;
currentSongId: string | null;
currentBandId: string | null;
setPlaying: (isPlaying: boolean) => void;
setCurrentTime: (currentTime: number) => void;
setDuration: (duration: number) => void;
setCurrentSong: (songId: string | null, bandId: string | null) => void;
reset: () => void;
batchUpdate: (updates: Partial<Omit<PlayerState, 'setPlaying' | 'setCurrentTime' | 'setDuration' | 'setCurrentSong' | 'reset' | 'batchUpdate'>>) => void;
}
export const usePlayerStore = create<PlayerState>()((set) => ({
isPlaying: false,
currentTime: 0,
duration: 0,
currentSongId: null,
currentBandId: null,
setPlaying: (isPlaying) => set({ isPlaying }),
setCurrentTime: (currentTime) => set({ currentTime }),
setDuration: (duration) => set({ duration }),
setCurrentSong: (songId, bandId) => set({ currentSongId: songId, currentBandId: bandId }),
batchUpdate: (updates) => set(updates),
reset: () => set({
isPlaying: false,
currentTime: 0,
duration: 0,
currentSongId: null,
currentBandId: null
})
}));