From 5c37ceb2bc87c7b6d5a2de6b37846d1e3379eaa7 Mon Sep 17 00:00:00 2001 From: jaykumar286 Date: Wed, 26 Feb 2025 21:10:15 +0530 Subject: [PATCH] fix the bug of video title --- components/watch/ListOfEpisodes.tsx | 3 --- components/watch/VideoContainer.tsx | 8 +++++--- components/watch/WatchContainer.tsx | 3 --- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/components/watch/ListOfEpisodes.tsx b/components/watch/ListOfEpisodes.tsx index 14bb5e3..2defbb3 100644 --- a/components/watch/ListOfEpisodes.tsx +++ b/components/watch/ListOfEpisodes.tsx @@ -27,13 +27,11 @@ export function ListOfEpisodes({ animeEpisodes, currentEpisode, handleCurrentEpisode, - handleTitle, handleVideoSkeletonVisibilty, }: { animeEpisodes: HiAnime.ScrapedAnimeEpisodes; currentEpisode: string; handleCurrentEpisode: (episode: string) => void; - handleTitle: (title: string) => void; handleVideoSkeletonVisibilty: (isVisible: boolean) => void; }) { const totlaEpisodes = animeEpisodes.totalEpisodes; @@ -80,7 +78,6 @@ export function ListOfEpisodes({ }`} onClick={() => { handleCurrentEpisode(episode.episodeId as string); - handleTitle(episode.title as string); handleVideoSkeletonVisibilty(true); }} > diff --git a/components/watch/VideoContainer.tsx b/components/watch/VideoContainer.tsx index 6624faf..b40f11b 100644 --- a/components/watch/VideoContainer.tsx +++ b/components/watch/VideoContainer.tsx @@ -24,14 +24,12 @@ type ServerInfoType = { export function VideoContainer({ currentEpisode, - title, isVideoSkeletonVisible, handleVideoSkeletonVisibilty, animeEpisodes, handleCurrentEpisode, }: { currentEpisode: string; - title: string; isVideoSkeletonVisible: boolean; handleVideoSkeletonVisibilty: (isVisible: boolean) => void; animeEpisodes: HiAnime.ScrapedAnimeEpisodes; @@ -51,6 +49,10 @@ export function VideoContainer({ const { settings, setSettings } = useSettings(); const { autoPlay, autoNext, autoSkip } = settings; + const title = animeEpisodes.episodes.find( + (episode) => episode.episodeId === currentEpisode, + )?.title; + const toggleAutoPlay = () => setSettings({ ...settings, autoPlay: !autoPlay }); const toggleAutoNext = () => @@ -313,7 +315,7 @@ export function VideoContainer({ ) : serverResources && !isVideoSkeletonVisible ? (
track.kind === "captions", diff --git a/components/watch/WatchContainer.tsx b/components/watch/WatchContainer.tsx index 03bf13d..d7c2a88 100644 --- a/components/watch/WatchContainer.tsx +++ b/components/watch/WatchContainer.tsx @@ -86,7 +86,6 @@ export function WatchContainer({ const [currentEpisode, setCurrentEpisode] = useState( getInRecentWatches(animeId) || animeEpisodes.episodes[0].episodeId, ); - const [title, setTitle] = useState(animeEpisodes.episodes[0].title); const [isVideoSkeletonVisible, setIsVideoSkeletonVisible] = useState(true); @@ -102,7 +101,6 @@ export function WatchContainer({