From 4155c4b6108c26cf581ab0abb1cd265f7f0e6463 Mon Sep 17 00:00:00 2001 From: Cooper Ransom Date: Thu, 21 Mar 2024 19:01:52 -0400 Subject: [PATCH] Remove shitty auto next episode --- .../player/atoms/NextEpisodeButton.tsx | 55 +++++-------------- 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/src/components/player/atoms/NextEpisodeButton.tsx b/src/components/player/atoms/NextEpisodeButton.tsx index ce608750..3d760900 100644 --- a/src/components/player/atoms/NextEpisodeButton.tsx +++ b/src/components/player/atoms/NextEpisodeButton.tsx @@ -1,5 +1,5 @@ import classNames from "classnames"; -import React, { useCallback, useEffect, useState } from "react"; +import React, { useCallback } from "react"; import { useTranslation } from "react-i18next"; import { Icon, Icons } from "@/components/Icon"; @@ -54,30 +54,12 @@ export function NextEpisodeButton(props: { const setShouldStartFromBeginning = usePlayerStore( (s) => s.setShouldStartFromBeginning, ); - const [countdown, setCountdown] = useState(15); let show = false; if (showingState === "always") show = true; else if (showingState === "hover" && props.controlsShowing) show = true; if (isHidden || status !== "playing" || duration === 0) show = false; - useEffect(() => { - // Initialize intervalId with 0, which is a safe value to clear if not reassigned. - let intervalId: number = 0; - if (show && countdown > 0) { - intervalId = window.setInterval(() => { - setCountdown((currentCountdown) => currentCountdown - 1); - }, 1000); - } else { - window.clearInterval(intervalId); // No need for casting here. - if (!show) { - setCountdown(15); // Reset countdown when not showing. - } - } - // Cleanup function to clear the interval when the component unmounts or the dependencies change. - return () => window.clearInterval(intervalId); - }, [show, countdown]); - const animation = showingState === "hover" ? "slide-up" : "fade"; let bottom = "bottom-[calc(6rem+env(safe-area-inset-bottom))]"; if (showingState === "always") @@ -117,30 +99,23 @@ export function NextEpisodeButton(props: { >
- {countdown > 0 && show && ( -
- {t("player.nextEpisode.nextIn", { seconds: countdown })} -
- )} -
- - -
+ +
);