mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-02 10:53:33 +00:00
Add fullscreen player view (#27)
* Add store controls for fullscreen player * Normalize styles for playback config * Add fullscreen player component * Add option component * Update player controls to use option/popover components * Add esc hotkey to close player * Add usePlayerData hook
This commit is contained in:
parent
6cfdb8ff84
commit
e47fcfc62e
18 changed files with 780 additions and 62 deletions
46
src/renderer/store/full-screen-player.store.ts
Normal file
46
src/renderer/store/full-screen-player.store.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import merge from 'lodash/merge';
|
||||
import create from 'zustand';
|
||||
import { devtools, persist } from 'zustand/middleware';
|
||||
import { immer } from 'zustand/middleware/immer';
|
||||
|
||||
interface FullScreenPlayerState {
|
||||
activeTab: string | 'queue' | 'related' | 'lyrics';
|
||||
dynamicBackground?: boolean;
|
||||
expanded: boolean;
|
||||
}
|
||||
|
||||
export interface FullScreenPlayerSlice extends FullScreenPlayerState {
|
||||
actions: {
|
||||
setStore: (data: Partial<FullScreenPlayerSlice>) => void;
|
||||
};
|
||||
}
|
||||
|
||||
export const useFullScreenPlayerStore = create<FullScreenPlayerSlice>()(
|
||||
persist(
|
||||
devtools(
|
||||
immer((set, get) => ({
|
||||
actions: {
|
||||
setStore: (data) => {
|
||||
set({ ...get(), ...data });
|
||||
},
|
||||
},
|
||||
activeTab: 'queue',
|
||||
expanded: false,
|
||||
})),
|
||||
{ name: 'store_full_screen_player' },
|
||||
),
|
||||
{
|
||||
merge: (persistedState, currentState) => {
|
||||
return merge(currentState, persistedState);
|
||||
},
|
||||
name: 'store_full_screen_player',
|
||||
version: 1,
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
export const useFullScreenPlayerStoreActions = () =>
|
||||
useFullScreenPlayerStore((state) => state.actions);
|
||||
|
||||
export const useSetFullScreenPlayerStore = () =>
|
||||
useFullScreenPlayerStore((state) => state.actions.setStore);
|
||||
Loading…
Add table
Add a link
Reference in a new issue