mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-21 14:47:41 +01:00
Fuck wit topflix
This commit is contained in:
parent
dbc46b5117
commit
e31fea7749
1 changed files with 17 additions and 12 deletions
|
@ -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
|
||||||
|
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]);
|
||||||
|
|
||||||
|
if (selectedMovie) {
|
||||||
setRandomMovie(selectedMovie);
|
setRandomMovie(selectedMovie);
|
||||||
|
|
||||||
// Start a 5-second countdown
|
|
||||||
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);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Fetch Movie genres
|
// Fetch Movie genres
|
||||||
|
|
Loading…
Reference in a new issue