From d93a91867baff153e0d57655996726914f042888 Mon Sep 17 00:00:00 2001 From: A Farzat Date: Wed, 8 Oct 2025 13:36:27 +0300 Subject: Add duration overlays to the videos --- front-end/src/App.css | 13 +++++++++++++ front-end/src/App.jsx | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'front-end') diff --git a/front-end/src/App.css b/front-end/src/App.css index 1548a0d..0220950 100644 --- a/front-end/src/App.css +++ b/front-end/src/App.css @@ -182,6 +182,19 @@ body { transform: scale(1.05); } +.duration-overlay { + position: absolute; + bottom: 8px; + right: 8px; + background: rgba(0, 0, 0, 0.8); + color: white; + padding: 2px 6px; + border-radius: 4px; + font-size: 0.8rem; + font-weight: bold; + backdrop-filter: blur(4px); +} + .play-button { position: absolute; top: 50%; diff --git a/front-end/src/App.jsx b/front-end/src/App.jsx index a540e47..92d0adf 100644 --- a/front-end/src/App.jsx +++ b/front-end/src/App.jsx @@ -122,6 +122,22 @@ function App() { } }; + const formatDuration = (seconds) => { + if (seconds < 0) { + return '?:??'; + } + + const hours = Math.floor(seconds / 3600); + const minutes = Math.floor((seconds % 3600) / 60); + const remainingSeconds = seconds % 60; + + if (hours > 0) { + return `${hours}:${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`; + } else { + return `${minutes}:${remainingSeconds.toString().padStart(2, '0')}`; + } + }; + return (
@@ -219,6 +235,9 @@ function App() { e.target.src = 'https://via.placeholder.com/300x180/333/fff?text=No+Thumbnail'; }} /> +
+ {formatDuration(video.duration)} +
-- cgit v1.2.3-70-g09d2