1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

add discover button at the allresults trigger

This commit is contained in:
Cooper Ransom 2024-04-10 12:43:25 -04:00
parent cfbdc62816
commit f8f26a77c1
5 changed files with 23 additions and 14 deletions

View file

@ -7203,7 +7203,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

View file

@ -94,7 +94,7 @@
"footer": { "footer": {
"legal": { "legal": {
"disclaimer": "Disclaimer ◝(ᵔᵕᵔ)◜", "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": { "links": {
"discord": "Discord", "discord": "Discord",
@ -292,7 +292,7 @@
"copyHlsPlaylist": "Copy HLS playlist link", "copyHlsPlaylist": "Copy HLS playlist link",
"downloadSubtitle": "Download current subtitle", "downloadSubtitle": "Download current subtitle",
"downloadVideo": "Download video", "downloadVideo": "Download video",
"hlsDisclaimer": "Downloads are taken directly from the provider. sudo-flix does not have control over how the downloads are provided.<br /><br />Please note that you are downloading an HLS playlist, <bold>it is not recommended to download if you are not familiar with advanced streaming formats</bold>. 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.<br /><br />Please note you are downloading an HLS playlist, <bold>it is not recommended to download if you are not familiar with advanced streaming formats</bold>. Try different sources for different formats.",
"onAndroid": { "onAndroid": {
"1": "To download on Android, click the download button then, on the new page, <bold>tap and hold</bold> on the video, then select <bold>save</bold>.", "1": "To download on Android, click the download button then, on the new page, <bold>tap and hold</bold> on the video, then select <bold>save</bold>.",
"shortTitle": "Download / Android", "shortTitle": "Download / Android",

View file

@ -18,7 +18,7 @@ function Question(props: { title: string; children: React.ReactNode }) {
); );
} }
function Button(props: { export function Button(props: {
className: string; className: string;
onClick?: () => void; onClick?: () => void;
children: React.ReactNode; children: React.ReactNode;

View file

@ -113,8 +113,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 6 TV show genres // Fetch only the first 5 TV show genres
setTVGenres(data.genres.slice(0, 6)); 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);
} }
@ -252,7 +252,7 @@ export function Discover() {
? `${category} Shows` ? `${category} Shows`
: `${category} Movies`; : `${category} Movies`;
return ( return (
<div className="relative overflow-hidden mt-2"> <div className="relative overflow-hidden rounded-xl mt-2">
<h2 className="text-2xl font-bold text-white sm:text-3xl md:text-2xl mx-auto pl-5"> <h2 className="text-2xl font-bold text-white sm:text-3xl md:text-2xl mx-auto pl-5">
{displayCategory} {displayCategory}
</h2> </h2>
@ -286,7 +286,7 @@ export function Discover() {
<div className="relative transition-transform hover:scale-105 duration-[0.45s]"> <div className="relative transition-transform hover:scale-105 duration-[0.45s]">
<Flare.Base className="group cursor-pointer rounded-xl relative p-[0.6em] bg-background-main transition-colors duration-300"> <Flare.Base className="group cursor-pointer rounded-xl relative p-[0.6em] bg-background-main transition-colors duration-300">
<Flare.Light <Flare.Light
flareSize={250} flareSize={225}
cssColorVar="--colors-mediaCard-hoverAccent" cssColorVar="--colors-mediaCard-hoverAccent"
backgroundClass="bg-mediaCard-hoverBackground duration-200" backgroundClass="bg-mediaCard-hoverBackground duration-200"
className="rounded-xl bg-background-main group-hover:opacity-100" className="rounded-xl bg-background-main group-hover:opacity-100"
@ -381,8 +381,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 5 genres // Fetch only the first 4 genres
setGenres(data.genres.slice(0, 5)); setGenres(data.genres.slice(0, 4));
} catch (error) { } catch (error) {
console.error("Error fetching genres:", error); console.error("Error fetching genres:", error);
} }
@ -396,8 +396,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 <= 6; page += 1) { for (let page = 1; page <= 5; page += 1) {
// Fetch only 6 pages // Fetch only 5 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(),

View file

@ -1,5 +1,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { useAsyncFn } from "react-use"; import { useAsyncFn } from "react-use";
import { searchForMedia } from "@/backend/metadata/search"; import { searchForMedia } from "@/backend/metadata/search";
@ -9,12 +10,13 @@ import { Icons } from "@/components/Icon";
import { SectionHeading } from "@/components/layout/SectionHeading"; import { SectionHeading } from "@/components/layout/SectionHeading";
import { MediaGrid } from "@/components/media/MediaGrid"; import { MediaGrid } from "@/components/media/MediaGrid";
import { WatchedMediaCard } from "@/components/media/WatchedMediaCard"; import { WatchedMediaCard } from "@/components/media/WatchedMediaCard";
import { Button } from "@/pages/About";
import { SearchLoadingPart } from "@/pages/parts/search/SearchLoadingPart"; import { SearchLoadingPart } from "@/pages/parts/search/SearchLoadingPart";
import { MediaItem } from "@/utils/mediaTypes"; import { MediaItem } from "@/utils/mediaTypes";
function SearchSuffix(props: { failed?: boolean; results?: number }) { function SearchSuffix(props: { failed?: boolean; results?: number }) {
const { t } = useTranslation(); const { t } = useTranslation();
const navigate = useNavigate();
const icon: Icons = props.failed ? Icons.WARNING : Icons.EYE_SLASH; const icon: Icons = props.failed ? Icons.WARNING : Icons.EYE_SLASH;
return ( return (
@ -30,7 +32,15 @@ function SearchSuffix(props: { failed?: boolean; results?: number }) {
{!props.failed ? ( {!props.failed ? (
<div> <div>
{(props.results ?? 0) > 0 ? ( {(props.results ?? 0) > 0 ? (
<p>{t("home.search.allResults")}</p> <>
<p>{t("home.search.allResults")}</p>
<Button
className="px-py p-[0.3em] mt-3 text-type-dimmed box-content text-[16px] bg-largeCard-background text-buttons-secondaryText justify-center items-center"
onClick={() => navigate("/discover")}
>
Discover more
</Button>
</>
) : ( ) : (
<p>{t("home.search.noResults")}</p> <p>{t("home.search.noResults")}</p>
)} )}