diff --git a/frontend/src/components/Playlists.tsx b/frontend/src/components/Playlists.tsx index 977e2926..e3d4e1e1 100644 --- a/frontend/src/components/Playlists.tsx +++ b/frontend/src/components/Playlists.tsx @@ -39,6 +39,7 @@ import { notifyYouTubeActionError } from "../lib/youtubeErrors"; import { playlistName } from "../lib/playlistName"; import { useUndoable } from "../lib/useUndoable"; import { cycleSort, type SortState } from "../lib/columnSort"; +import { formatRuntime } from "../lib/format"; import { applyView, sameOrder } from "../lib/playlistView"; const PlayerModal = lazy(() => import("./PlayerModal")); import UndoToolbar from "./UndoToolbar"; @@ -259,6 +260,13 @@ export default function Playlists() { return (v: Video) => m.get(v.id) ?? 0; }, [items]); + // Total playtime of the whole playlist (sums every item, matching the itemCount beside it — not + // the filtered `shown` set). Items with an unknown duration count as 0; hidden when nothing sums. + const totalSeconds = useMemo( + () => items.reduce((acc, v) => acc + (v.duration_seconds ?? 0), 0), + [items], + ); + const columns = useMemo( () => playlistColumns({ t, indexOf: storedIndex, onPlay, onRemove, canEdit }), [t, storedIndex, onPlay, onRemove, canEdit], @@ -648,6 +656,7 @@ export default function Playlists() { )}