|
|
|
@@ -225,21 +225,33 @@
|
|
|
|
|
|
|
|
|
|
$effect(() => { if (activeTab) loadVideos(); });
|
|
|
|
|
$effect(() => {
|
|
|
|
|
// Mark previous video as read when navigating away
|
|
|
|
|
// Scroll to top when switching videos
|
|
|
|
|
if (selectedVideo && summaryPanel) {
|
|
|
|
|
tick().then(() => summaryPanel.scrollTop = 0);
|
|
|
|
|
}
|
|
|
|
|
const prevId = prevSelectedId;
|
|
|
|
|
prevSelectedId = selectedVideo?.video_id || null;
|
|
|
|
|
|
|
|
|
|
if (prevId && prevId !== selectedVideo?.video_id && activeTab === 'pending') {
|
|
|
|
|
// Look up the previous video to check it had a valid summary
|
|
|
|
|
const prevVideo = videos.find(v => v.video_id === prevId);
|
|
|
|
|
if (prevVideo && prevVideo.summary && !prevVideo.summary.includes('Error') && !prevVideo.summary.includes('📺 Short clip')) {
|
|
|
|
|
updateStatus(prevId, 'read', true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// NOTE: auto-mark-read is now handled by scroll-to-bottom detection (see below)
|
|
|
|
|
// and explicit user actions (r/Enter key or Read button).
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Scroll-based auto-mark-read: mark video as read when user scrolls to bottom of summary
|
|
|
|
|
let scrollReadTimer = $state(null);
|
|
|
|
|
function handleSummaryScroll() {
|
|
|
|
|
if (!summaryPanel || !selectedVideo || activeTab !== 'pending') return;
|
|
|
|
|
const threshold = 100; // px from bottom
|
|
|
|
|
const atBottom = (summaryPanel.scrollHeight - summaryPanel.scrollTop - summaryPanel.clientHeight) < threshold;
|
|
|
|
|
if (atBottom) {
|
|
|
|
|
// Debounce to avoid rapid-fire updates
|
|
|
|
|
if (scrollReadTimer) clearTimeout(scrollReadTimer);
|
|
|
|
|
scrollReadTimer = setTimeout(() => {
|
|
|
|
|
const sv = selectedVideo;
|
|
|
|
|
if (sv && sv.summary && !sv.summary.includes('Error') && !sv.summary.includes('📺 Short clip')) {
|
|
|
|
|
updateStatus(sv.video_id, 'read', true);
|
|
|
|
|
}
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$effect(() => {
|
|
|
|
|
if (activeTab === 'agent') loadAgentQueue();
|
|
|
|
|
});
|
|
|
|
@@ -545,7 +557,7 @@
|
|
|
|
|
</aside>
|
|
|
|
|
|
|
|
|
|
<!-- Right: summary panel -->
|
|
|
|
|
<main bind:this={summaryPanel} id="summary-panel" class="flex-1 overflow-y-auto" style="background:var(--bg-primary);min-height:0">
|
|
|
|
|
<main bind:this={summaryPanel} onscroll={handleSummaryScroll} id="summary-panel" class="flex-1 overflow-y-auto" style="background:var(--bg-primary);min-height:0">
|
|
|
|
|
{#if activeTab === '🤖 Agent'}
|
|
|
|
|
<div class="p-6 max-w-3xl mx-auto">
|
|
|
|
|
<h2 class="text-sm font-black tracking-wider mb-4" style="color:var(--accent)">🤖 Agent Queue</h2>
|
|
|
|
|