1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-29 16:07:40 +01:00

Fuck wit topflix

This commit is contained in:
Cooper Ransom 2024-04-02 18:26:32 -04:00
parent dbc46b5117
commit e31fea7749

View file

@ -274,7 +274,7 @@ export function TopFlix() {
style={{ style={{
backdropFilter: "blur(0px)", backdropFilter: "blur(0px)",
transition: "opacity 0.5s", transition: "opacity 0.5s",
backgroundColor: "rgba(0, 0, 0, 0.8)", // Darkening effect backgroundColor: "rgba(0, 0, 0, 0.5)", // Darkening effect
whiteSpace: "normal", // Allow the text to wrap to the next line whiteSpace: "normal", // Allow the text to wrap to the next line
wordWrap: "break-word", // Break words to prevent overflow wordWrap: "break-word", // Break words to prevent overflow
}} }}
@ -310,17 +310,22 @@ export function TopFlix() {
const handleRandomMovieClick = () => { const handleRandomMovieClick = () => {
const allMovies = Object.values(genreMovies).flat(); // Flatten all movie arrays const allMovies = Object.values(genreMovies).flat(); // Flatten all movie arrays
const randomIndex = Math.floor(Math.random() * allMovies.length); const uniqueTitles = new Set<string>(); // Use a Set to store unique titles
const selectedMovie = allMovies[randomIndex]; allMovies.forEach((movie) => uniqueTitles.add(movie.title)); // Add each title to the Set
setRandomMovie(selectedMovie); const uniqueTitlesArray = Array.from(uniqueTitles); // Convert the Set back to an array
const randomIndex = Math.floor(Math.random() * uniqueTitlesArray.length);
// Start a 5-second countdown const selectedMovie = allMovies.find((movie) => movie.title === uniqueTitlesArray[randomIndex]);
setCountdown(5);
if (selectedMovie) {
// Schedule navigation after 5 seconds setRandomMovie(selectedMovie);
setTimeout(() => {
navigate(`/media/tmdb-movie-${selectedMovie.id}-${selectedMovie.title}`); setCountdown(5);
}, 5000);
// Schedule navigation after 5 seconds
setTimeout(() => {
navigate(`/media/tmdb-movie-${selectedMovie.id}-${selectedMovie.title}`);
}, 5000);
}
}; };
// Fetch Movie genres // Fetch Movie genres