From f5a1a2d391a1ce2432ba4e46fae96fda74785492 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Thu, 28 Aug 2025 21:01:07 +0000 Subject: [PATCH] Improve video player controls for better user interaction Implement temporary visibility for video player navigation controls, making them appear on hover or click and fade out after a short period of inactivity. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2eb1084e-b728-4449-9231-f1665924c8d5 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2eb1084e-b728-4449-9231-f1665924c8d5/1Ar8Azc --- client/src/components/bunny-video-modal.tsx | 51 +++++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/client/src/components/bunny-video-modal.tsx b/client/src/components/bunny-video-modal.tsx index 18a115b..ec5f371 100644 --- a/client/src/components/bunny-video-modal.tsx +++ b/client/src/components/bunny-video-modal.tsx @@ -53,6 +53,8 @@ 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 = () => { @@ -74,9 +76,26 @@ 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 4 sekundah + const timeout = setTimeout(() => { + setShowNavigation(false); + }, 4000); + + setNavigationTimeout(timeout); + }; + useEffect(() => { const handleEscape = (e: KeyboardEvent) => { @@ -88,6 +107,9 @@ export default function BunnyVideoModal({ video, isOpen, onClose, onEdit, videos if (isOpen) { document.addEventListener("keydown", handleEscape); document.body.style.overflow = "hidden"; + + // Prikaži kontrole ob odprtju modala + showNavigationTemporarily(); } else { document.body.style.overflow = ""; } @@ -95,9 +117,22 @@ export default function BunnyVideoModal({ video, isOpen, onClose, onEdit, videos return () => { 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 { @@ -258,7 +293,11 @@ export default function BunnyVideoModal({ video, isOpen, onClose, onEdit, videos
{/* Main video player */}
-
+
{video.videoUrlIframe ? (