From a2b39ee28895b9719ebc0e64e48c46a3bcd9e5c2 Mon Sep 17 00:00:00 2001 From: Cooper Ransom Date: Thu, 4 Apr 2024 09:38:52 -0400 Subject: [PATCH] Polish discover page (Actually the pinical of my coding experince so far :3) --- pnpm-lock.yaml | 9 ++++----- src/pages/Discover.tsx | 14 ++++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 43ff9ae1..01a1738b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2510,7 +2510,7 @@ packages: /@vitest/snapshot@1.4.0: resolution: {integrity: sha512-saAFnt5pPIA5qDGxOHxJ/XxhMFKkUSBJmVt5VgDsAqPTX6JP326r5C/c9UuCMPoXNzuudTPsYDZCoJ5ilpqG2A==} dependencies: - magic-string: 0.30.8 + magic-string: 0.30.9 pathe: 1.1.2 pretty-format: 29.7.0 dev: true @@ -4957,8 +4957,8 @@ packages: sourcemap-codec: 1.4.8 dev: true - /magic-string@0.30.8: - resolution: {integrity: sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==} + /magic-string@0.30.9: + resolution: {integrity: sha512-S1+hd+dIrC8EZqKyT9DstTH/0Z+f76kmmvZnkfQVmOpDEF9iVgdYif3Q/pIWHmCoo59bQVGW0kVL3e2nl+9+Sw==} engines: {node: '>=12'} dependencies: '@jridgewell/sourcemap-codec': 1.4.15 @@ -6963,7 +6963,7 @@ packages: execa: 8.0.1 jsdom: 23.2.0 local-pkg: 0.5.0 - magic-string: 0.30.8 + magic-string: 0.30.9 pathe: 1.1.2 picocolors: 1.0.0 std-env: 3.7.0 @@ -7234,7 +7234,6 @@ packages: /workbox-google-analytics@7.0.0: resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==} - deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained dependencies: workbox-background-sync: 7.0.0 workbox-core: 7.0.0 diff --git a/src/pages/Discover.tsx b/src/pages/Discover.tsx index 576898bb..ba0334f8 100644 --- a/src/pages/Discover.tsx +++ b/src/pages/Discover.tsx @@ -13,8 +13,6 @@ import { allThemes } from "../../themes/all"; import { get } from "../backend/metadata/tmdb"; import { Icon, Icons } from "../components/Icon"; -const pagesToFetch = 3; - // Define the Media type interface Media { id: number; @@ -121,8 +119,8 @@ export function Discover() { [data.genres[i], data.genres[j]] = [data.genres[j], data.genres[i]]; } - // Fetch only the first 4 TV show genres - setTVGenres(data.genres.slice(0, 4)); + // Fetch only the first 5 TV show genres + setTVGenres(data.genres.slice(0, 5)); } catch (error) { console.error("Error fetching TV show genres:", error); } @@ -359,8 +357,8 @@ export function Discover() { [data.genres[i], data.genres[j]] = [data.genres[j], data.genres[i]]; } - // Fetch only the first 4 genres - setGenres(data.genres.slice(0, 4)); + // Fetch only the first 5 genres + setGenres(data.genres.slice(0, 5)); } catch (error) { console.error("Error fetching genres:", error); } @@ -374,8 +372,8 @@ export function Discover() { const fetchMoviesForGenre = async (genreId: number) => { try { const movies: any[] = []; - for (let page = 1; page <= 4; page += 1) { - // Fetch only 4 pages + for (let page = 1; page <= 6; page += 1) { + // Fetch only 6 pages const data = await get("/discover/movie", { api_key: conf().TMDB_READ_API_KEY, with_genres: genreId.toString(),