fix: clickable channel badge filters by channel; fix cat dropdown value; clean up saveNote

This commit is contained in:
Gan, Jimmy
2026-06-27 01:40:06 +08:00
parent 94ef5e2bb2
commit 5c641903c9
+8 -6
View File
@@ -217,10 +217,9 @@
function saveNote() { function saveNote() {
const vid = selectedVideo?.video_id; const vid = selectedVideo?.video_id;
if (!vid) return; if (!vid) return;
const existing = notes[vid] || ''; const text = notes[vid] || '';
if (existing && !existing.startsWith('[')) { const stamped = text && !text.startsWith('[') ? `[${new Date().toLocaleString()}] ${text}` : text;
notes[vid] = `[${new Date().toLocaleString()}] ${existing}`; notes = {...notes, [vid]: stamped};
}
localStorage.setItem('t-yt-notes', JSON.stringify(notes)); localStorage.setItem('t-yt-notes', JSON.stringify(notes));
activeNote = null; activeNote = null;
} }
@@ -283,7 +282,7 @@
{#if catList.length} {#if catList.length}
<option disabled>── Categories ──</option> <option disabled>── Categories ──</option>
{#each catList as cat} {#each catList as cat}
<option value={cat}>📁 {cat}</option> <option value={'📁 ' + cat}>📁 {cat}</option>
{/each} {/each}
<option disabled>── Channels ──</option> <option disabled>── Channels ──</option>
{/if} {/if}
@@ -359,7 +358,10 @@
<div class="flex items-start space-x-4"> <div class="flex items-start space-x-4">
<img src={selectedVideo.thumbnail_url} alt="" class="w-40 h-24 rounded-lg object-cover flex-shrink-0" style="background:var(--bg-tertiary)" /> <img src={selectedVideo.thumbnail_url} alt="" class="w-40 h-24 rounded-lg object-cover flex-shrink-0" style="background:var(--bg-tertiary)" />
<div class="min-w-0 space-y-2"> <div class="min-w-0 space-y-2">
<span class="text-[10px] px-2 py-0.5 font-bold rounded-full" style="color:var(--accent);background:var(--bg-tertiary)">{selectedVideo.channel_name}</span> <span class="text-[10px] px-2 py-0.5 font-bold rounded-full cursor-pointer hover:opacity-80 transition"
style="color:var(--accent);background:var(--bg-tertiary)"
onclick={() => { channelFilter = selectedVideo.channel_name; }}
title="Filter by this channel">{selectedVideo.channel_name}</span>
<h1 class="text-lg font-bold leading-snug" style="color:var(--text-primary)">{selectedVideo.title}</h1> <h1 class="text-lg font-bold leading-snug" style="color:var(--text-primary)">{selectedVideo.title}</h1>
<div class="flex space-x-2"> <div class="flex space-x-2">
<button onclick={() => updateStatus(selectedVideo.video_id, 'read')} class="text-[10px] px-2.5 py-1 text-white font-bold rounded transition" style="background:var(--accent)">Read (r)</button> <button onclick={() => updateStatus(selectedVideo.video_id, 'read')} class="text-[10px] px-2.5 py-1 text-white font-bold rounded transition" style="background:var(--accent)">Read (r)</button>