mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Polish discover page (Actually the pinical of my coding experince so far :3)
This commit is contained in:
parent
fd7fb26906
commit
a2b39ee288
2 changed files with 10 additions and 13 deletions
|
@ -2510,7 +2510,7 @@ packages:
|
||||||
/@vitest/snapshot@1.4.0:
|
/@vitest/snapshot@1.4.0:
|
||||||
resolution: {integrity: sha512-saAFnt5pPIA5qDGxOHxJ/XxhMFKkUSBJmVt5VgDsAqPTX6JP326r5C/c9UuCMPoXNzuudTPsYDZCoJ5ilpqG2A==}
|
resolution: {integrity: sha512-saAFnt5pPIA5qDGxOHxJ/XxhMFKkUSBJmVt5VgDsAqPTX6JP326r5C/c9UuCMPoXNzuudTPsYDZCoJ5ilpqG2A==}
|
||||||
dependencies:
|
dependencies:
|
||||||
magic-string: 0.30.8
|
magic-string: 0.30.9
|
||||||
pathe: 1.1.2
|
pathe: 1.1.2
|
||||||
pretty-format: 29.7.0
|
pretty-format: 29.7.0
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -4957,8 +4957,8 @@ packages:
|
||||||
sourcemap-codec: 1.4.8
|
sourcemap-codec: 1.4.8
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/magic-string@0.30.8:
|
/magic-string@0.30.9:
|
||||||
resolution: {integrity: sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==}
|
resolution: {integrity: sha512-S1+hd+dIrC8EZqKyT9DstTH/0Z+f76kmmvZnkfQVmOpDEF9iVgdYif3Q/pIWHmCoo59bQVGW0kVL3e2nl+9+Sw==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jridgewell/sourcemap-codec': 1.4.15
|
'@jridgewell/sourcemap-codec': 1.4.15
|
||||||
|
@ -6963,7 +6963,7 @@ packages:
|
||||||
execa: 8.0.1
|
execa: 8.0.1
|
||||||
jsdom: 23.2.0
|
jsdom: 23.2.0
|
||||||
local-pkg: 0.5.0
|
local-pkg: 0.5.0
|
||||||
magic-string: 0.30.8
|
magic-string: 0.30.9
|
||||||
pathe: 1.1.2
|
pathe: 1.1.2
|
||||||
picocolors: 1.0.0
|
picocolors: 1.0.0
|
||||||
std-env: 3.7.0
|
std-env: 3.7.0
|
||||||
|
@ -7234,7 +7234,6 @@ packages:
|
||||||
|
|
||||||
/workbox-google-analytics@7.0.0:
|
/workbox-google-analytics@7.0.0:
|
||||||
resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==}
|
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:
|
dependencies:
|
||||||
workbox-background-sync: 7.0.0
|
workbox-background-sync: 7.0.0
|
||||||
workbox-core: 7.0.0
|
workbox-core: 7.0.0
|
||||||
|
|
|
@ -13,8 +13,6 @@ 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";
|
||||||
|
|
||||||
const pagesToFetch = 3;
|
|
||||||
|
|
||||||
// Define the Media type
|
// Define the Media type
|
||||||
interface Media {
|
interface Media {
|
||||||
id: number;
|
id: number;
|
||||||
|
@ -121,8 +119,8 @@ export function Discover() {
|
||||||
[data.genres[i], data.genres[j]] = [data.genres[j], data.genres[i]];
|
[data.genres[i], data.genres[j]] = [data.genres[j], data.genres[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch only the first 4 TV show genres
|
// Fetch only the first 5 TV show genres
|
||||||
setTVGenres(data.genres.slice(0, 4));
|
setTVGenres(data.genres.slice(0, 5));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching TV show genres:", 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]];
|
[data.genres[i], data.genres[j]] = [data.genres[j], data.genres[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch only the first 4 genres
|
// Fetch only the first 5 genres
|
||||||
setGenres(data.genres.slice(0, 4));
|
setGenres(data.genres.slice(0, 5));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching genres:", error);
|
console.error("Error fetching genres:", error);
|
||||||
}
|
}
|
||||||
|
@ -374,8 +372,8 @@ export function Discover() {
|
||||||
const fetchMoviesForGenre = async (genreId: number) => {
|
const fetchMoviesForGenre = async (genreId: number) => {
|
||||||
try {
|
try {
|
||||||
const movies: any[] = [];
|
const movies: any[] = [];
|
||||||
for (let page = 1; page <= 4; page += 1) {
|
for (let page = 1; page <= 6; page += 1) {
|
||||||
// Fetch only 4 pages
|
// Fetch only 6 pages
|
||||||
const data = await get<any>("/discover/movie", {
|
const data = await get<any>("/discover/movie", {
|
||||||
api_key: conf().TMDB_READ_API_KEY,
|
api_key: conf().TMDB_READ_API_KEY,
|
||||||
with_genres: genreId.toString(),
|
with_genres: genreId.toString(),
|
||||||
|
|
Loading…
Reference in a new issue