From 3f7171837968a6c5e5846604842a2e4442fcbd79 Mon Sep 17 00:00:00 2001 From: Cooper Ransom Date: Tue, 2 Apr 2024 18:31:09 -0400 Subject: [PATCH] Fuck wit topflix # --- src/pages/TopFlix.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pages/TopFlix.tsx b/src/pages/TopFlix.tsx index cae7ae74..b18cdd60 100644 --- a/src/pages/TopFlix.tsx +++ b/src/pages/TopFlix.tsx @@ -314,16 +314,20 @@ export function TopFlix() { allMovies.forEach((movie) => uniqueTitles.add(movie.title)); // Add each title to the Set const uniqueTitlesArray = Array.from(uniqueTitles); // Convert the Set back to an array const randomIndex = Math.floor(Math.random() * uniqueTitlesArray.length); - const selectedMovie = allMovies.find((movie) => movie.title === uniqueTitlesArray[randomIndex]); - + const selectedMovie = allMovies.find( + (movie) => movie.title === uniqueTitlesArray[randomIndex], + ); + if (selectedMovie) { setRandomMovie(selectedMovie); - + setCountdown(5); - + // Schedule navigation after 5 seconds setTimeout(() => { - navigate(`/media/tmdb-movie-${selectedMovie.id}-${selectedMovie.title}`); + navigate( + `/media/tmdb-movie-${selectedMovie.id}-${selectedMovie.title}`, + ); }, 5000); } };