mirror of
https://github.com/sussy-code/smov.git
synced 2025-01-04 16:47:40 +01:00
Lower large file size (Discover.tsx)
This commit is contained in:
parent
5af78196d1
commit
643c246f60
2 changed files with 54 additions and 45 deletions
|
@ -7,57 +7,20 @@ import { WideContainer } from "@/components/layout/WideContainer";
|
||||||
import { HomeLayout } from "@/pages/layouts/HomeLayout";
|
import { HomeLayout } from "@/pages/layouts/HomeLayout";
|
||||||
import { conf } from "@/setup/config";
|
import { conf } from "@/setup/config";
|
||||||
import { useThemeStore } from "@/stores/theme";
|
import { useThemeStore } from "@/stores/theme";
|
||||||
|
import {
|
||||||
|
Category,
|
||||||
|
Genre,
|
||||||
|
Media,
|
||||||
|
Movie,
|
||||||
|
TVShow,
|
||||||
|
categories,
|
||||||
|
} from "@/utils/discover";
|
||||||
|
|
||||||
import { PageTitle } from "./parts/util/PageTitle";
|
import { PageTitle } from "./parts/util/PageTitle";
|
||||||
import { allThemes } from "../../themes/all";
|
import { allThemes } from "../../themes/all";
|
||||||
import { get } from "../backend/metadata/tmdb";
|
import { get } from "../backend/metadata/tmdb";
|
||||||
import { Icon, Icons } from "../components/Icon";
|
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() {
|
export function Discover() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [showBg] = useState<boolean>(false);
|
const [showBg] = useState<boolean>(false);
|
||||||
|
|
46
src/utils/discover.ts
Normal file
46
src/utils/discover.ts
Normal 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",
|
||||||
|
},
|
||||||
|
];
|
Loading…
Reference in a new issue