diff --git a/web/apps/cast/src/components/PhotoAuditorium.tsx b/web/apps/cast/src/components/Slide.tsx similarity index 67% rename from web/apps/cast/src/components/PhotoAuditorium.tsx rename to web/apps/cast/src/components/Slide.tsx index c77c9e6ca..8309f8bc2 100644 --- a/web/apps/cast/src/components/PhotoAuditorium.tsx +++ b/web/apps/cast/src/components/Slide.tsx @@ -1,27 +1,17 @@ -import { useEffect } from "react"; - -interface PhotoAuditoriumProps { +interface SlideViewProps { + /** The URL of the image to show. */ url: string; - nextSlideUrl: string; - showNextSlide: () => void; + /** The URL of the next image that we will transition to. */ + nextURL: string; } -export const PhotoAuditorium: React.FC = ({ - url, - nextSlideUrl, - showNextSlide, -}) => { - useEffect(() => { - console.log("showing slide"); - const timeoutId = window.setTimeout(() => { - console.log("showing next slide timer"); - showNextSlide(); - }, 10000); - - return () => { - if (timeoutId) clearTimeout(timeoutId); - }; - }, []); +/** + * Show the image at {@link url} in a full screen view. + * + * Also show {@link nextURL} in an hidden image view to prepare the browser for + * an imminent transition to it. + */ +export const SlideView: React.FC = ({ url, nextURL }) => { return (
= ({ }} > { + if (loading) return; + + console.log("showing slide"); + const timeoutId = window.setTimeout(() => { + console.log("showing next slide timer"); + showNextSlide(); + }, 10000); + + return () => { + if (timeoutId) clearTimeout(timeoutId); + }; + }, [loading]); + if (loading) return ; - return ( - - ); + return ; }