From 8d8a5bdb66ba0bc3a0440a8331f7d64bcf008254 Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Tue, 11 Nov 2025 12:41:12 -0700 Subject: [PATCH] Revert "feat: hide the arrow buttons on scroll lists when at either end of the list" This reverts commit 4f781f97361a937ee8aa5c565d6e9f6df64041b6. --- .../components/carousels/EpisodeCarousel.tsx | 73 +++--------- src/components/player/atoms/Episodes.tsx | 89 +++++---------- .../components/CarouselNavButtons.tsx | 53 +-------- .../discover/components/CategoryButtons.tsx | 105 +++++------------- src/stores/__old/watched/store.ts | 2 +- 5 files changed, 74 insertions(+), 248 deletions(-) diff --git a/src/components/overlays/detailsModal/components/carousels/EpisodeCarousel.tsx b/src/components/overlays/detailsModal/components/carousels/EpisodeCarousel.tsx index 9fec2494..b6eeacb6 100644 --- a/src/components/overlays/detailsModal/components/carousels/EpisodeCarousel.tsx +++ b/src/components/overlays/detailsModal/components/carousels/EpisodeCarousel.tsx @@ -45,39 +45,6 @@ export function EpisodeCarousel({ const updateItem = useProgressStore((s) => s.updateItem); const confirmModal = useModal("season-watch-confirm"); - const [canScrollLeft, setCanScrollLeft] = useState(false); - const [canScrollRight, setCanScrollRight] = useState(false); - - const updateScrollState = () => { - if (!carouselRef.current) { - setCanScrollLeft(false); - setCanScrollRight(false); - return; - } - - const { scrollLeft, scrollWidth, clientWidth } = carouselRef.current; - const isAtStart = scrollLeft <= 1; - const isAtEnd = scrollLeft + clientWidth >= scrollWidth - 1; - - setCanScrollLeft(!isAtStart); - setCanScrollRight(!isAtEnd); - }; - - useEffect(() => { - const carousel = carouselRef.current; - if (!carousel) return; - - updateScrollState(); - - carousel.addEventListener("scroll", updateScrollState); - window.addEventListener("resize", updateScrollState); - - return () => { - carousel.removeEventListener("scroll", updateScrollState); - window.removeEventListener("resize", updateScrollState); - }; - }, []); - const handleScroll = (direction: "left" | "right") => { if (!carouselRef.current) return; @@ -563,17 +530,15 @@ export function EpisodeCarousel({ {/* Episodes Carousel */}
{/* Left scroll button */} - {canScrollLeft && ( -
- -
- )} +
+ +
{/* Right scroll button */} - {canScrollRight && ( -
- -
- )} +
+ +
); diff --git a/src/components/player/atoms/Episodes.tsx b/src/components/player/atoms/Episodes.tsx index 8b9bf424..2d081980 100644 --- a/src/components/player/atoms/Episodes.tsx +++ b/src/components/player/atoms/Episodes.tsx @@ -766,39 +766,6 @@ export function EpisodesView({ ], ); - const [canScrollLeft, setCanScrollLeft] = useState(false); - const [canScrollRight, setCanScrollRight] = useState(false); - - const updateScrollState = () => { - if (!carouselRef.current) { - setCanScrollLeft(false); - setCanScrollRight(false); - return; - } - - const { scrollLeft, scrollWidth, clientWidth } = carouselRef.current; - const isAtStart = scrollLeft <= 1; - const isAtEnd = scrollLeft + clientWidth >= scrollWidth - 1; - - setCanScrollLeft(!isAtStart); - setCanScrollRight(!isAtEnd); - }; - - useEffect(() => { - const carousel = carouselRef.current; - if (!carousel) return; - - updateScrollState(); - - carousel.addEventListener("scroll", updateScrollState); - window.addEventListener("resize", updateScrollState); - - return () => { - carousel.removeEventListener("scroll", updateScrollState); - window.removeEventListener("resize", updateScrollState); - }; - }, []); - const handleScroll = (direction: "left" | "right") => { if (!carouselRef.current) return; @@ -949,22 +916,20 @@ export function EpisodesView({ content = (
{/* Horizontal scroll buttons */} - {canScrollLeft && ( -
+ -
- )} + + +
{/* Right scroll button */} - {canScrollRight && ( -
+ -
- )} + + +
); } diff --git a/src/pages/discover/components/CarouselNavButtons.tsx b/src/pages/discover/components/CarouselNavButtons.tsx index 24cbdae3..bd9d3261 100644 --- a/src/pages/discover/components/CarouselNavButtons.tsx +++ b/src/pages/discover/components/CarouselNavButtons.tsx @@ -1,5 +1,3 @@ -import { useCallback, useEffect, useState } from "react"; - import { Icon, Icons } from "@/components/Icon"; import { Flare } from "@/components/utils/Flare"; @@ -13,12 +11,9 @@ interface CarouselNavButtonsProps { interface NavButtonProps { direction: "left" | "right"; onClick: () => void; - visible: boolean; } -function NavButton({ direction, onClick, visible }: NavButtonProps) { - if (!visible) return null; - +function NavButton({ direction, onClick }: NavButtonProps) { return ( - - ); - }; + const renderScrollButton = (direction: "left" | "right") => ( +
+ +
+ ); return (
- {(showAlwaysScroll || isMobile || canScrollLeft) && - renderScrollButton("left")} + {(showAlwaysScroll || isMobile) && renderScrollButton("left")} - {(showAlwaysScroll || isMobile || canScrollRight) && - renderScrollButton("right")} + {(showAlwaysScroll || isMobile) && renderScrollButton("right")}
); } diff --git a/src/stores/__old/watched/store.ts b/src/stores/__old/watched/store.ts index 5bc2f6fe..7d5739ad 100644 --- a/src/stores/__old/watched/store.ts +++ b/src/stores/__old/watched/store.ts @@ -1,10 +1,10 @@ import { useProgressStore } from "@/stores/progress"; -import { createVersionedStore } from "../migrations"; import { OldData, migrateV2Videos } from "./migrations/v2"; import { migrateV3Videos } from "./migrations/v3"; import { migrateV4Videos } from "./migrations/v4"; import { WatchedStoreData } from "./types"; +import { createVersionedStore } from "../migrations"; export const VideoProgressStore = createVersionedStore() .setKey("video-progress")