feat: hide short clips (≤2s) by default with a toggle in Videos tab

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 4.6 committed 2026-08-18 11:57:47 -04:00
1 parent 3c0cb2b68d
commit 00a65853ce
1 file changed
+30 -1
+30 -1
View File
@@ -44,10 +44,13 @@ function fmtSize(b) {
// ── Component ───────────────────────────────────────────────────────────────── // ── Component ─────────────────────────────────────────────────────────────────
const SHORT_THRESHOLD = 2; // seconds
export default function VideosView({ filters = {} }) { export default function VideosView({ filters = {} }) {
const [videos, setVideos] = useState(null); const [videos, setVideos] = useState(null);
const [playing, setPlaying] = useState(null); const [playing, setPlaying] = useState(null);
const [error, setError] = useState(null); const [error, setError] = useState(null);
const [showShort, setShowShort] = useState(false);
useEffect(() => { useEffect(() => {
setVideos(null); setVideos(null);
@@ -77,10 +80,36 @@ export default function VideosView({ filters = {} }) {
); );
} }
const groups = groupByMonth(videos); const shortCount = videos.filter(v => v.duration != null && v.duration <= SHORT_THRESHOLD).length;
const visible = showShort ? videos : videos.filter(v => v.duration == null || v.duration > SHORT_THRESHOLD);
const groups = groupByMonth(visible).filter(g => g.videos.length > 0);
return ( return (
<> <>
{/* Toolbar */}
{shortCount > 0 && (
<div style={{
display: 'flex', alignItems: 'center', gap: 8,
padding: '10px 12px 2px',
}}>
<button
onClick={() => setShowShort(s => !s)}
style={{
display: 'flex', alignItems: 'center', gap: 6,
background: showShort ? '#1e2a3a' : 'transparent',
border: `1px solid ${showShort ? '#4d9eff' : '#2a2a2a'}`,
borderRadius: 6, color: showShort ? '#9fc8ff' : '#555',
fontSize: 12, padding: '4px 10px', cursor: 'pointer',
}}
>
{showShort ? '▾' : '▸'}
{showShort
? `Hiding ${shortCount} short clip${shortCount === 1 ? '' : 's'}`
: `${shortCount} short clip${shortCount === 1 ? '' : 's'} hidden`}
</button>
</div>
)}
<main style={{ padding: '0 3px' }}> <main style={{ padding: '0 3px' }}>
{groups.map(group => ( {groups.map(group => (
<section key={group.key} style={{ marginBottom: 8 }}> <section key={group.key} style={{ marginBottom: 8 }}>