Lower large file size (Discover.tsx)

This commit is contained in:
Cooper Ransom 2024-04-06 13:21:24 -04:00
parent 5af78196d1
commit 643c246f60
2 changed files with 54 additions and 45 deletions

View File

@ -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<boolean>(false);

46
src/utils/discover.ts Normal file
View File

@ -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",
},
];