chore: use enum

This commit is contained in:
Adrian Castro
2024-02-20 09:01:56 +01:00
parent b387273573
commit e0ee1c00b9
2 changed files with 10 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import type { ItemData } from "~/components/item/item";
import { ScraperProcess } from "~/components/player/ScraperProcess"; import { ScraperProcess } from "~/components/player/ScraperProcess";
import { VideoPlayer } from "~/components/player/VideoPlayer"; import { VideoPlayer } from "~/components/player/VideoPlayer";
import { usePlayer } from "~/hooks/player/usePlayer"; import { usePlayer } from "~/hooks/player/usePlayer";
import { PlayerStatus } from "~/stores/player/slices/interface";
import { usePlayerStore } from "~/stores/player/store"; import { usePlayerStore } from "~/stores/player/store";
export default function VideoPlayerWrapper() { export default function VideoPlayerWrapper() {
@@ -20,7 +21,8 @@ export default function VideoPlayerWrapper() {
void presentFullscreenPlayer(); void presentFullscreenPlayer();
if (playerStatus === "scraping") return <ScraperProcess data={data} />; if (playerStatus === PlayerStatus.SCRAPING)
return <ScraperProcess data={data} />;
if (playerStatus === "ready") return <VideoPlayer />; if (playerStatus === PlayerStatus.READY) return <VideoPlayer />;
} }

View File

@@ -4,7 +4,10 @@ import type { SeasonDetails } from "@movie-web/tmdb";
import type { MakeSlice } from "./types"; import type { MakeSlice } from "./types";
import type { ItemData } from "~/components/item/item"; import type { ItemData } from "~/components/item/item";
export type PlayerStatus = "scraping" | "ready"; export enum PlayerStatus {
SCRAPING = "scraping",
READY = "ready",
}
export interface InterfaceSlice { export interface InterfaceSlice {
interface: { interface: {
@@ -41,7 +44,7 @@ export const createInterfaceSlice: MakeSlice<InterfaceSlice> = (set, get) => ({
seasonData: null, seasonData: null,
selectedCaption: null, selectedCaption: null,
hlsTracks: null, hlsTracks: null,
playerStatus: "scraping", playerStatus: PlayerStatus.SCRAPING,
}, },
setIsIdle: (state) => { setIsIdle: (state) => {
set((s) => { set((s) => {
@@ -105,7 +108,7 @@ export const createInterfaceSlice: MakeSlice<InterfaceSlice> = (set, get) => ({
seasonData: null, seasonData: null,
selectedCaption: null, selectedCaption: null,
hlsTracks: null, hlsTracks: null,
playerStatus: "scraping", playerStatus: PlayerStatus.SCRAPING,
}, },
})); }));
}, },