From a63bb88a257362d0a2886db416633ced17cbaec1 Mon Sep 17 00:00:00 2001 From: Cooper Ransom Date: Fri, 8 Mar 2024 10:40:46 -0500 Subject: [PATCH] Fix next episode stuff! and add another proxy --- public/config.js | 2 +- src/assets/locales/en.json | 4 ++-- .../player/atoms/NextEpisodeButton.tsx | 19 ++++++++++++++----- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/public/config.js b/public/config.js index 26856c41..6b73051b 100644 --- a/public/config.js +++ b/public/config.js @@ -1,6 +1,6 @@ window.__CONFIG__ = { // The URL for the CORS proxy, the URL must NOT end with a slash! - VITE_CORS_PROXY_URL: "https://sudo-proxy0.netlify.app,https://sudo-proxy1.up.railway.app,https://sudo-proxy2.up.railway.app,https://sudo-proxy3.up.railway.app", + VITE_CORS_PROXY_URL: "https://sudo-proxy0.netlify.app,https://sudo-proxy1.up.railway.app,https://sudo-proxy2.up.railway.app,https://sudo-proxy3.up.railway.app,https://sudo-proxy4.netlify.app", // The READ API key to access TMDB VITE_TMDB_READ_API_KEY: "eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhZTljNGE2ZDE1ZDFiODZiNzdlMWQyYmI5ZGY0MzdmYyIsInN1YiI6IjY1YjNmMWI0NTk0Yzk0MDE2MzNkZDBjNSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.kAX7TkbKuJkNty6IsjcCLnoENFicVZn6d6DkLQsy3p8", diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index 5e321fed..114bd426 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -388,8 +388,8 @@ } }, "nextEpisode": { - "cancel": "Cancel", - "next": "Next episode!" + "replay": "Replay", + "next": "Next episode" }, "playbackError": { "badge": "Playback error", diff --git a/src/components/player/atoms/NextEpisodeButton.tsx b/src/components/player/atoms/NextEpisodeButton.tsx index caaf7ef9..cd7e7ed5 100644 --- a/src/components/player/atoms/NextEpisodeButton.tsx +++ b/src/components/player/atoms/NextEpisodeButton.tsx @@ -1,5 +1,5 @@ import classNames from "classnames"; -import { useCallback } from "react"; +import React, { useCallback } from "react"; import { useTranslation } from "react-i18next"; import { Icon, Icons } from "@/components/Icon"; @@ -15,7 +15,7 @@ function shouldShowNextEpisodeButton( const percentage = time / duration; const secondsFromEnd = duration - time; if (secondsFromEnd <= 30) return "always"; - if (percentage >= 0.9) return "hover"; + if (percentage >= 0.93) return "hover"; return "none"; } @@ -81,6 +81,15 @@ export function NextEpisodeButton(props: { props.onChange?.(metaCopy); }, [setDirectMeta, nextEp, meta, props, setShouldStartFromBeginning]); + const startCurrentEpisodeFromBeginning = useCallback(() => { + if (!meta || !meta.episode) return; + const metaCopy = { ...meta }; + // No need to change the episode, as we're restarting the current one + setShouldStartFromBeginning(true); + setDirectMeta(metaCopy); + props.onChange?.(metaCopy); + }, [setDirectMeta, meta, props, setShouldStartFromBeginning]); + if (!meta?.episode || !nextEp) return null; if (metaType !== "show") return null; @@ -97,10 +106,10 @@ export function NextEpisodeButton(props: { ])} >