From 643c246f600c01a77ba45d71dead3eb3e0612159 Mon Sep 17 00:00:00 2001 From: Cooper Ransom Date: Sat, 6 Apr 2024 13:21:24 -0400 Subject: [PATCH] Lower large file size (Discover.tsx) --- src/pages/Discover.tsx | 53 +++++++----------------------------------- src/utils/discover.ts | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 45 deletions(-) create mode 100644 src/utils/discover.ts diff --git a/src/pages/Discover.tsx b/src/pages/Discover.tsx index 1921538e..de0eaa70 100644 --- a/src/pages/Discover.tsx +++ b/src/pages/Discover.tsx @@ -7,57 +7,20 @@ import { WideContainer } from "@/components/layout/WideContainer"; import { HomeLayout } from "@/pages/layouts/HomeLayout"; import { conf } from "@/setup/config"; import { useThemeStore } from "@/stores/theme"; +import { + Category, + Genre, + Media, + Movie, + TVShow, + categories, +} from "@/utils/discover"; import { PageTitle } from "./parts/util/PageTitle"; import { allThemes } from "../../themes/all"; import { get } from "../backend/metadata/tmdb"; import { Icon, Icons } from "../components/Icon"; -// Define the Media type -interface Media { - id: number; - poster_path: string; - title?: string; - name?: string; -} - -// Update the Movie and TVShow interfaces to extend the Media interface -interface Movie extends Media { - title: string; -} - -interface TVShow extends Media { - name: string; -} - -// Define the Genre type -interface Genre { - id: number; - name: string; -} - -// Define the Category type -interface Category { - name: string; - endpoint: string; -} - -// Define the categories -const categories: Category[] = [ - { - name: "Now Playing", - endpoint: "/movie/now_playing?language=en-US", - }, - { - name: "Top Rated", - endpoint: "/movie/top_rated?language=en-US", - }, - { - name: "Most Popular", - endpoint: "/movie/popular?language=en-US", - }, -]; - export function Discover() { const { t } = useTranslation(); const [showBg] = useState(false); diff --git a/src/utils/discover.ts b/src/utils/discover.ts new file mode 100644 index 00000000..f794eda8 --- /dev/null +++ b/src/utils/discover.ts @@ -0,0 +1,46 @@ +/* Define shit here */ + +// Define the Media type +export interface Media { + id: number; + poster_path: string; + title?: string; + name?: string; +} + +// Update the Movie and TVShow interfaces to extend the Media interface +export interface Movie extends Media { + title: string; +} + +export interface TVShow extends Media { + name: string; +} + +// Define the Genre type +export interface Genre { + id: number; + name: string; +} + +// Define the Category type +export interface Category { + name: string; + endpoint: string; +} + +// Define the categories +export const categories: Category[] = [ + { + name: "Now Playing", + endpoint: "/movie/now_playing?language=en-US", + }, + { + name: "Top Rated", + endpoint: "/movie/top_rated?language=en-US", + }, + { + name: "Most Popular", + endpoint: "/movie/popular?language=en-US", + }, +];