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:
parent
e31fea7749
commit
3f71718379
1 changed files with 9 additions and 5 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue