diff --git a/client/src/components/bunny-video-modal.tsx b/client/src/components/bunny-video-modal.tsx index 90ff59d..18a115b 100644 --- a/client/src/components/bunny-video-modal.tsx +++ b/client/src/components/bunny-video-modal.tsx @@ -53,8 +53,6 @@ function formatDate(date: Date | string): string { export default function BunnyVideoModal({ video, isOpen, onClose, onEdit, videos = [], onVideoChange }: BunnyVideoModalProps) { const [showShareMenu, setShowShareMenu] = useState(false); - const [showNavigation, setShowNavigation] = useState(true); - const [navigationTimeout, setNavigationTimeout] = useState(null); // Navigation functions const getCurrentVideoIndex = () => { @@ -76,65 +74,30 @@ export default function BunnyVideoModal({ video, isOpen, onClose, onEdit, videos const newVideo = videos[newIndex]; if (newVideo) { onVideoChange(newVideo); - showNavigationTemporarily(); } }; - const showNavigationTemporarily = () => { - setShowNavigation(true); - - // Počisti prejšnji timeout - if (navigationTimeout) { - clearTimeout(navigationTimeout); - } - - // Sakrij navigacijo po 6 sekundah (daljši čas) - const timeout = setTimeout(() => { - setShowNavigation(false); - }, 6000); - - setNavigationTimeout(timeout); - }; - useEffect(() => { - const handleKeyDown = (e: KeyboardEvent) => { + const handleEscape = (e: KeyboardEvent) => { if (e.key === "Escape" && isOpen) { onClose(); - } else if (isOpen && (e.key === " " || e.key === "Enter" || e.key === "ArrowLeft" || e.key === "ArrowRight")) { - showNavigationTemporarily(); } }; if (isOpen) { - document.addEventListener("keydown", handleKeyDown); + document.addEventListener("keydown", handleEscape); document.body.style.overflow = "hidden"; - - // Prikaži kontrole ob odprtju modala - showNavigationTemporarily(); } else { document.body.style.overflow = ""; } return () => { - document.removeEventListener("keydown", handleKeyDown); + document.removeEventListener("keydown", handleEscape); document.body.style.overflow = ""; - - // Počisti timeout ob zaprtju - if (navigationTimeout) { - clearTimeout(navigationTimeout); - setNavigationTimeout(null); - } }; }, [isOpen, onClose]); - // Prikaži kontrole ob menjavi videa - useEffect(() => { - if (isOpen && video) { - showNavigationTemporarily(); - } - }, [video?.id, isOpen]); - const handleVideoPlay = async () => { if (video) { try { @@ -295,12 +258,7 @@ export default function BunnyVideoModal({ video, isOpen, onClose, onEdit, videos
{/* Main video player */}
-
+
{video.videoUrlIframe ? (