From 5bfd72ab3d9a27a8d583cdb85177d8eabb533313 Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Wed, 24 Jun 2026 01:42:12 +0800 Subject: [PATCH] feat: add per-video notes with localStorage, notes tab filter --- backend/summarizer.py | 2 +- frontend/src/routes/YoutubeDashboard.svelte | 53 ++++++++++++++++----- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/backend/summarizer.py b/backend/summarizer.py index 7c2ceeb..c15e1a2 100644 --- a/backend/summarizer.py +++ b/backend/summarizer.py @@ -87,7 +87,7 @@ async def summarize_video(video_id: str) -> str: async with aiosqlite.connect(DB_PATH) as db: await db.execute( "UPDATE videos SET transcript = ?, summary = ? WHERE video_id = ?", - ("No transcript available", "Could not retrieve video transcript.", video_id) + ("No transcript available", "📺 Short clip — title only, no description available. Watch to preview.", video_id) ) await db.commit() return None diff --git a/frontend/src/routes/YoutubeDashboard.svelte b/frontend/src/routes/YoutubeDashboard.svelte index a547748..d79ef8e 100644 --- a/frontend/src/routes/YoutubeDashboard.svelte +++ b/frontend/src/routes/YoutubeDashboard.svelte @@ -9,6 +9,8 @@ let syncMessage = $state(''); let theme = $state(localStorage.getItem('theme') || 'dark'); let summaryPanel = $state(null); + let notes = $state(JSON.parse(localStorage.getItem('t-yt-notes') || '{}')); + let activeNote = $state(null); function toggleTheme() { theme = theme === 'dark' ? 'light' : 'dark'; @@ -19,15 +21,26 @@ async function loadVideos() { isLoading = true; try { - const res = await fetch(`/api/videos?status=${activeTab}&limit=50`); - if (res.ok) { - videos = await res.json(); - if (videos.length > 0) { - const currentId = selectedVideo?.video_id; - const found = videos.find(v => v.video_id === currentId); - selectedVideo = found || videos[0]; - } else { - selectedVideo = null; + if (activeTab === 'notes') { + // Notes tab: show all pending videos, but only those with notes + const res = await fetch(`/api/videos?status=pending&limit=50`); + if (res.ok) { + const all = await res.json(); + videos = all.filter(v => notes[v.video_id]); + if (videos.length > 0) selectedVideo = videos[0]; + else selectedVideo = null; + } + } else { + const res = await fetch(`/api/videos?status=${activeTab}&limit=50`); + if (res.ok) { + videos = await res.json(); + if (videos.length > 0) { + const currentId = selectedVideo?.video_id; + const found = videos.find(v => v.video_id === currentId); + selectedVideo = found || videos[0]; + } else { + selectedVideo = null; + } } } } catch (err) { @@ -138,7 +151,7 @@