From ee00f288d9130aa087cc3952c1c61c6ba48998ad Mon Sep 17 00:00:00 2001 From: jlightner Date: Sat, 4 Apr 2026 05:53:19 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20Created=20ChapterMarkers=20overlay=20co?= =?UTF-8?q?mponent,=20added=20RegionsPlugin=20cha=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - "frontend/src/components/ChapterMarkers.tsx" - "frontend/src/components/PlayerControls.tsx" - "frontend/src/components/AudioWaveform.tsx" - "frontend/src/pages/WatchPage.tsx" - "frontend/src/App.css" GSD-Task: S05/T03 --- frontend/src/App.css | 61 ++++++++++++++++++++++ frontend/src/components/AudioWaveform.tsx | 29 ++++++++-- frontend/src/components/ChapterMarkers.tsx | 39 ++++++++++++++ frontend/src/components/PlayerControls.tsx | 37 ++++++++----- frontend/src/pages/WatchPage.tsx | 17 ++++-- 5 files changed, 162 insertions(+), 21 deletions(-) create mode 100644 frontend/src/components/ChapterMarkers.tsx diff --git a/frontend/src/App.css b/frontend/src/App.css index 64b60e9..09e342a 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -6050,6 +6050,67 @@ a.app-footer__about:hover, font-weight: 600; } +/* ── Seek container + Chapter markers ──────────────────────────────────────── */ + +.player-controls__seek-container { + position: relative; + flex: 1; + display: flex; + align-items: center; +} + +.player-controls__seek-container .player-controls__seek { + width: 100%; +} + +.chapter-markers { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + pointer-events: none; +} + +.chapter-marker__tick { + position: absolute; + width: 3px; + height: 100%; + background: var(--color-accent, #22d3ee); + opacity: 0.6; + pointer-events: all; + cursor: pointer; + transform: translateX(-50%); + border: none; + padding: 0; + font: inherit; +} + +.chapter-marker__tick:hover { + opacity: 1; +} + +.chapter-marker__tooltip { + position: absolute; + bottom: 100%; + left: 50%; + transform: translateX(-50%); + background: var(--color-bg-surface, #1e293b); + color: var(--text-primary, #e2e8f0); + padding: 4px 8px; + border-radius: 4px; + font-size: 0.75rem; + white-space: nowrap; + opacity: 0; + pointer-events: none; + transition: opacity 150ms; + margin-bottom: 4px; +} + +.chapter-marker__tick:hover .chapter-marker__tooltip { + opacity: 1; +} + /* ── Responsive: player controls ───────────────────────────────────────────── */ @media (max-width: 640px) { diff --git a/frontend/src/components/AudioWaveform.tsx b/frontend/src/components/AudioWaveform.tsx index ad1ea2f..7d62d03 100644 --- a/frontend/src/components/AudioWaveform.tsx +++ b/frontend/src/components/AudioWaveform.tsx @@ -1,18 +1,22 @@ import { useEffect, useRef } from "react"; import WaveSurfer from "wavesurfer.js"; +import RegionsPlugin from "wavesurfer.js/dist/plugins/regions.esm.js"; import type { MediaSyncState } from "../hooks/useMediaSync"; +import type { Chapter } from "../api/videos"; interface AudioWaveformProps { mediaSync: MediaSyncState; src: string; + chapters?: Chapter[]; } /** * Audio-only waveform visualiser powered by wavesurfer.js. * Renders a hidden