refactor: move to tanstack router
This commit is contained in:
1 parent
a4ea932153
commit
522621ed69
136 files changed
+7063
-6127
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { create } from "zustand";
|
||||
import { setQueue } from "./queue";
|
||||
|
||||
type AudioPlaybackStore = {
|
||||
display: boolean;
|
||||
url: string;
|
||||
item: BaseItemDto | undefined | null;
|
||||
playlistItemId: string | undefined;
|
||||
};
|
||||
export const useAudioPlayback = create<AudioPlaybackStore>(() => ({
|
||||
display: false,
|
||||
url: "",
|
||||
item: undefined,
|
||||
playlistItemId: undefined,
|
||||
}));
|
||||
|
||||
export const playAudio = (
|
||||
url: string,
|
||||
item: BaseItemDto | undefined | null,
|
||||
playlistItemId: string | undefined,
|
||||
queue: BaseItemDto[] | undefined,
|
||||
queueItemIndex: number,
|
||||
): void => {
|
||||
useAudioPlayback.setState({
|
||||
display: true,
|
||||
url,
|
||||
item,
|
||||
playlistItemId,
|
||||
});
|
||||
setQueue(queue, queueItemIndex);
|
||||
};
|
||||
Reference in new issue
Block a user