From d93a91867baff153e0d57655996726914f042888 Mon Sep 17 00:00:00 2001
From: A Farzat <a@farzat.xyz>
Date: Wed, 8 Oct 2025 13:36:27 +0300
Subject: Add duration overlays to the videos

---
 front-end/src/App.jsx | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

(limited to 'front-end/src/App.jsx')

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 (
     <div className="App">
       <header className="App-header">
@@ -219,6 +235,9 @@ function App() {
                         e.target.src = 'https://via.placeholder.com/300x180/333/fff?text=No+Thumbnail';
                       }}
                     />
+                    <div className="duration-overlay">
+                      {formatDuration(video.duration)}
+                    </div>
                     <div className="play-button">▶</div>
                   </div>
 
-- 
cgit v1.2.3-70-g09d2

