From e0ee1c00b98c08c734ba225800be8ee3fc26291e Mon Sep 17 00:00:00 2001 From: Adrian Castro <22133246+castdrian@users.noreply.github.com> Date: Tue, 20 Feb 2024 09:01:56 +0100 Subject: [PATCH] chore: use enum --- apps/expo/src/app/videoPlayer/index.tsx | 6 ++++-- apps/expo/src/stores/player/slices/interface.ts | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/expo/src/app/videoPlayer/index.tsx b/apps/expo/src/app/videoPlayer/index.tsx index 8489a9e..d19f0fd 100644 --- a/apps/expo/src/app/videoPlayer/index.tsx +++ b/apps/expo/src/app/videoPlayer/index.tsx @@ -4,6 +4,7 @@ import type { ItemData } from "~/components/item/item"; import { ScraperProcess } from "~/components/player/ScraperProcess"; import { VideoPlayer } from "~/components/player/VideoPlayer"; import { usePlayer } from "~/hooks/player/usePlayer"; +import { PlayerStatus } from "~/stores/player/slices/interface"; import { usePlayerStore } from "~/stores/player/store"; export default function VideoPlayerWrapper() { @@ -20,7 +21,8 @@ export default function VideoPlayerWrapper() { void presentFullscreenPlayer(); - if (playerStatus === "scraping") return ; + if (playerStatus === PlayerStatus.SCRAPING) + return ; - if (playerStatus === "ready") return ; + if (playerStatus === PlayerStatus.READY) return ; } diff --git a/apps/expo/src/stores/player/slices/interface.ts b/apps/expo/src/stores/player/slices/interface.ts index e399fbe..3dfc30c 100644 --- a/apps/expo/src/stores/player/slices/interface.ts +++ b/apps/expo/src/stores/player/slices/interface.ts @@ -4,7 +4,10 @@ import type { SeasonDetails } from "@movie-web/tmdb"; import type { MakeSlice } from "./types"; import type { ItemData } from "~/components/item/item"; -export type PlayerStatus = "scraping" | "ready"; +export enum PlayerStatus { + SCRAPING = "scraping", + READY = "ready", +} export interface InterfaceSlice { interface: { @@ -41,7 +44,7 @@ export const createInterfaceSlice: MakeSlice = (set, get) => ({ seasonData: null, selectedCaption: null, hlsTracks: null, - playerStatus: "scraping", + playerStatus: PlayerStatus.SCRAPING, }, setIsIdle: (state) => { set((s) => { @@ -105,7 +108,7 @@ export const createInterfaceSlice: MakeSlice = (set, get) => ({ seasonData: null, selectedCaption: null, hlsTracks: null, - playerStatus: "scraping", + playerStatus: PlayerStatus.SCRAPING, }, })); },