mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-11 06:42:38 +02:00
restructure files onto electron-vite boilerplate
This commit is contained in:
@@ -2,6 +2,19 @@ import { create } from 'zustand';
|
||||
import { devtools, subscribeWithSelector } from 'zustand/middleware';
|
||||
import { immer } from 'zustand/middleware/immer';
|
||||
|
||||
export interface EventSlice extends EventState {
|
||||
actions: {
|
||||
favorite: (ids: string[], favorite: boolean) => void;
|
||||
play: (id: string) => void;
|
||||
rate: (ids: string[], rating: null | number) => void;
|
||||
};
|
||||
}
|
||||
|
||||
export interface EventState {
|
||||
event: null | UserEvent;
|
||||
ids: string[];
|
||||
}
|
||||
|
||||
export type FavoriteEvent = {
|
||||
event: 'favorite';
|
||||
favorite: boolean;
|
||||
@@ -14,24 +27,11 @@ export type PlayEvent = {
|
||||
|
||||
export type RatingEvent = {
|
||||
event: 'rating';
|
||||
rating: number | null;
|
||||
rating: null | number;
|
||||
};
|
||||
|
||||
export type UserEvent = FavoriteEvent | PlayEvent | RatingEvent;
|
||||
|
||||
export interface EventState {
|
||||
event: UserEvent | null;
|
||||
ids: string[];
|
||||
}
|
||||
|
||||
export interface EventSlice extends EventState {
|
||||
actions: {
|
||||
favorite: (ids: string[], favorite: boolean) => void;
|
||||
play: (id: string) => void;
|
||||
rate: (ids: string[], rating: number | null) => void;
|
||||
};
|
||||
}
|
||||
|
||||
export const useEventStore = create<EventSlice>()(
|
||||
subscribeWithSelector(
|
||||
devtools(
|
||||
|
||||
Reference in New Issue
Block a user