pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'main' of https://github.com/sussy-code/smov

+23 -35
+4 -3
pnpm-lock.yaml
··· 32 32 version: 1.0.3 33 33 '@movie-web/providers': 34 34 specifier: github:sussy-code/providers 35 - version: github.com/sussy-code/providers/9b6eb8417c7e2cd2c4265b7102ac5ed299022a42 35 + version: github.com/sussy-code/providers/b04c921b5533e6f53a58c3a0406d90ad2f076c05 36 36 '@noble/hashes': 37 37 specifier: ^1.4.0 38 38 version: 1.4.0 ··· 7430 7430 use-sync-external-store: 1.2.0(react@18.3.1) 7431 7431 dev: false 7432 7432 7433 - github.com/sussy-code/providers/9b6eb8417c7e2cd2c4265b7102ac5ed299022a42: 7434 - resolution: {tarball: https://codeload.github.com/sussy-code/providers/tar.gz/9b6eb8417c7e2cd2c4265b7102ac5ed299022a42} 7433 + github.com/sussy-code/providers/b04c921b5533e6f53a58c3a0406d90ad2f076c05: 7434 + resolution: {tarball: https://codeload.github.com/sussy-code/providers/tar.gz/b04c921b5533e6f53a58c3a0406d90ad2f076c05} 7435 7435 name: '@movie-web/providers' 7436 7436 version: 2.3.0 7437 + prepare: true 7437 7438 requiresBuild: true 7438 7439 dependencies: 7439 7440 cheerio: 1.0.0-rc.12
+19 -32
src/pages/Discover.tsx
··· 226 226 genres.forEach((genre) => fetchMoviesForGenre(genre.id)); 227 227 }, [genres]); 228 228 229 - // Update the scrollCarousel function to use the new ref map 230 229 function scrollCarousel(categorySlug: string, direction: string) { 231 230 const carousel = carouselRefs.current[categorySlug]; 232 231 if (carousel) { ··· 237 236 const scrollAmount = movieWidth * visibleMovies * 0.69; // Silly number :3 238 237 239 238 if (direction === "left") { 240 - if (carousel.scrollLeft <= 5) { 241 - carousel.scrollBy({ 242 - left: carousel.scrollWidth, 243 - behavior: "smooth", 244 - }); // Scroll to the end 245 - } else { 246 - carousel.scrollBy({ left: -scrollAmount, behavior: "smooth" }); 247 - } 248 - } else if ( 249 - carousel.scrollLeft + carousel.offsetWidth + 5 >= 250 - carousel.scrollWidth 251 - ) { 252 - carousel.scrollBy({ 253 - left: -carousel.scrollWidth, 254 - behavior: "smooth", 255 - }); // Scroll to the beginning 239 + carousel.scrollBy({ left: -scrollAmount, behavior: "smooth" }); 256 240 } else { 257 241 carousel.scrollBy({ left: scrollAmount, behavior: "smooth" }); 258 242 } ··· 284 268 } 285 269 }, [movieWidth]); 286 270 271 + const browser = !!window.chrome; // detect chromium browser 287 272 let isScrolling = false; 273 + 288 274 function handleWheel(e: React.WheelEvent, categorySlug: string) { 289 275 if (isScrolling) { 290 276 return; 291 277 } 292 278 293 279 isScrolling = true; 294 - 295 280 const carousel = carouselRefs.current[categorySlug]; 296 - if (carousel && !e.deltaX) { 281 + if (carousel) { 297 282 const movieElements = carousel.getElementsByTagName("a"); 298 283 if (movieElements.length > 0) { 299 - const posterWidth = movieElements[0].offsetWidth; 300 - const visibleMovies = Math.floor(carousel.offsetWidth / posterWidth); 301 - const scrollAmount = posterWidth * visibleMovies * 0.62; 302 284 if (e.deltaY < 5) { 303 - carousel.scrollBy({ left: -scrollAmount, behavior: "smooth" }); 285 + scrollCarousel(categorySlug, "left"); 304 286 } else { 305 - carousel.scrollBy({ left: scrollAmount, behavior: "smooth" }); 287 + scrollCarousel(categorySlug, "right"); 306 288 } 307 289 } 308 290 } 309 291 310 - setTimeout(() => { 292 + if (browser) { 293 + setTimeout(() => { 294 + isScrolling = false; 295 + }, 345); // disable scrolling after 345 milliseconds for chromium-based browsers 296 + } else { 297 + // immediately reset isScrolling for non-chromium browsers 311 298 isScrolling = false; 312 - }, 345); // Disable scrolling every 3 milliseconds after interaction (only for mouse wheel doe) 299 + } 313 300 } 314 301 315 302 const [isHovered, setIsHovered] = useState(false); 316 303 317 - useEffect(() => { 318 - if (!isHovered) { 319 - document.body.style.overflow = "auto"; 320 - } 321 - }, [isHovered]); 322 - 323 304 const handleMouseEnter = () => { 324 305 document.body.style.overflow = "hidden"; 325 306 setIsHovered(true); ··· 328 309 const handleMouseLeave = () => { 329 310 setIsHovered(false); 330 311 }; 312 + 313 + useEffect(() => { 314 + if (!isHovered) { 315 + document.body.style.overflow = "auto"; 316 + } 317 + }, [isHovered]); 331 318 332 319 function renderMovies(medias: Media[], category: string, isTVShow = false) { 333 320 const categorySlug = `${category.toLowerCase().replace(/ /g, "-")}${Math.random()}`; // Convert the category to a slug