From f8f26a77c10abaddb8b8595694d795271bf41fc6 Mon Sep 17 00:00:00 2001 From: Cooper Ransom Date: Wed, 10 Apr 2024 12:43:25 -0400 Subject: [PATCH] add discover button at the allresults trigger --- pnpm-lock.yaml | 1 - src/assets/locales/en.json | 4 ++-- src/pages/About.tsx | 2 +- src/pages/Discover.tsx | 16 ++++++++-------- src/pages/parts/search/SearchListPart.tsx | 14 ++++++++++++-- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 520370f4..e07afb7d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7203,7 +7203,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/assets/locales/en.json b/src/assets/locales/en.json index e6093937..cf6aaec4 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -94,7 +94,7 @@ "footer": { "legal": { "disclaimer": "Disclaimer ◝(ᵔᵕᵔ)◜", - "disclaimerText": "Please note, sudo-flix does not host any files itself but instead only display's content from 3rd party providers. Legal issues should be taken up with them." + "disclaimerText": "Please note: sudo-flix does not host any files itself but instead only display's content from 3rd party providers. Legal issues should be taken up with them." }, "links": { "discord": "Discord", @@ -292,7 +292,7 @@ "copyHlsPlaylist": "Copy HLS playlist link", "downloadSubtitle": "Download current subtitle", "downloadVideo": "Download video", - "hlsDisclaimer": "Downloads are taken directly from the provider. sudo-flix does not have control over how the downloads are provided.

Please note that you are downloading an HLS playlist, it is not recommended to download if you are not familiar with advanced streaming formats. Try different sources for different formats.", + "hlsDisclaimer": "Downloads are taken directly from the provider. sudo-flix does not have control over how the downloads are provided.

Please note you are downloading an HLS playlist, it is not recommended to download if you are not familiar with advanced streaming formats. Try different sources for different formats.", "onAndroid": { "1": "To download on Android, click the download button then, on the new page, tap and hold on the video, then select save.", "shortTitle": "Download / Android", diff --git a/src/pages/About.tsx b/src/pages/About.tsx index c5d1d9f0..e28c28cf 100644 --- a/src/pages/About.tsx +++ b/src/pages/About.tsx @@ -18,7 +18,7 @@ function Question(props: { title: string; children: React.ReactNode }) { ); } -function Button(props: { +export function Button(props: { className: string; onClick?: () => void; children: React.ReactNode; diff --git a/src/pages/Discover.tsx b/src/pages/Discover.tsx index bad975f9..2c05c75d 100644 --- a/src/pages/Discover.tsx +++ b/src/pages/Discover.tsx @@ -113,8 +113,8 @@ export function Discover() { [data.genres[i], data.genres[j]] = [data.genres[j], data.genres[i]]; } - // Fetch only the first 6 TV show genres - setTVGenres(data.genres.slice(0, 6)); + // Fetch only the first 5 TV show genres + setTVGenres(data.genres.slice(0, 5)); } catch (error) { console.error("Error fetching TV show genres:", error); } @@ -252,7 +252,7 @@ export function Discover() { ? `${category} Shows` : `${category} Movies`; return ( -
+

{displayCategory}

@@ -286,7 +286,7 @@ export function Discover() {
{ try { const movies: any[] = []; - for (let page = 1; page <= 6; page += 1) { - // Fetch only 6 pages + for (let page = 1; page <= 5; page += 1) { + // Fetch only 5 pages const data = await get("/discover/movie", { api_key: conf().TMDB_READ_API_KEY, with_genres: genreId.toString(), diff --git a/src/pages/parts/search/SearchListPart.tsx b/src/pages/parts/search/SearchListPart.tsx index 270d05f1..4ee42781 100644 --- a/src/pages/parts/search/SearchListPart.tsx +++ b/src/pages/parts/search/SearchListPart.tsx @@ -1,5 +1,6 @@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; +import { useNavigate } from "react-router-dom"; import { useAsyncFn } from "react-use"; import { searchForMedia } from "@/backend/metadata/search"; @@ -9,12 +10,13 @@ import { Icons } from "@/components/Icon"; import { SectionHeading } from "@/components/layout/SectionHeading"; import { MediaGrid } from "@/components/media/MediaGrid"; import { WatchedMediaCard } from "@/components/media/WatchedMediaCard"; +import { Button } from "@/pages/About"; import { SearchLoadingPart } from "@/pages/parts/search/SearchLoadingPart"; import { MediaItem } from "@/utils/mediaTypes"; function SearchSuffix(props: { failed?: boolean; results?: number }) { const { t } = useTranslation(); - + const navigate = useNavigate(); const icon: Icons = props.failed ? Icons.WARNING : Icons.EYE_SLASH; return ( @@ -30,7 +32,15 @@ function SearchSuffix(props: { failed?: boolean; results?: number }) { {!props.failed ? (
{(props.results ?? 0) > 0 ? ( -

{t("home.search.allResults")}

+ <> +

{t("home.search.allResults")}

+ + ) : (

{t("home.search.noResults")}

)}