1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

Fuck wit topflix #

This commit is contained in:
Cooper Ransom 2024-04-02 18:31:09 -04:00
parent e31fea7749
commit 3f71718379

View file

@ -314,16 +314,20 @@ export function TopFlix() {
allMovies.forEach((movie) => uniqueTitles.add(movie.title)); // Add each title to the Set 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 uniqueTitlesArray = Array.from(uniqueTitles); // Convert the Set back to an array
const randomIndex = Math.floor(Math.random() * uniqueTitlesArray.length); 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) { if (selectedMovie) {
setRandomMovie(selectedMovie); setRandomMovie(selectedMovie);
setCountdown(5); setCountdown(5);
// Schedule navigation after 5 seconds // Schedule navigation after 5 seconds
setTimeout(() => { setTimeout(() => {
navigate(`/media/tmdb-movie-${selectedMovie.id}-${selectedMovie.title}`); navigate(
`/media/tmdb-movie-${selectedMovie.id}-${selectedMovie.title}`,
);
}, 5000); }, 5000);
} }
}; };