refactor(playlists): compact the playlist header to two rows (E9 12A)

The header portals into the shell's FIXED toolbar band, so its height is
list height the user never gets back — and it was spending four stacked
blocks on it: title, meta line, an action row, then a separate view-control
row under the cover. Option B collapses that into two tight rows beside a
smaller cover: title + rename/YouTube-link on the first, with Play-all,
push/revert/delete and the unsynced badge pushed right; the meta line
(count · playtime · filtered) and the view controls (group-by, reset view,
save order, view status, undo/redo) sharing the second.

Every control and its gating is unchanged — the view-control group still
appears only for `items.length > 1 || viewActive`, so a one-item playlist
shows just the meta line.

Measured on a 32-item playlist: the band goes 170px -> 88px at rest
(122px while a view is active, where the status sentence wraps), which is
~80px more visible list.
This commit is contained in:
2026-09-02 03:45:07 +02:00
parent 4e6bcbc078
commit 95c33e0b0f
+42 -30
View File
@@ -606,14 +606,19 @@ export default function Playlists() {
{/* Header (title, actions, view controls) is fixed chrome — it portals into the shell's {/* Header (title, actions, view controls) is fixed chrome — it portals into the shell's
fixed band, so only the video list scrolls. */} fixed band, so only the video list scrolls. */}
<PageToolbar> <PageToolbar>
<div className="px-4 pt-2 pb-2 max-w-5xl mx-auto"> {/* Two tight rows beside a small cover: title + actions on the first, the meta line and the
<div className="flex gap-3 items-start mb-4"> view controls sharing the second. This band is FIXED chrome (it never scrolls), so every
<div className="w-24 h-13.5 rounded-lg bg-card overflow-hidden shrink-0"> row it sheds is list height won back — the old layout stacked three rows next to the
cover plus a fourth block under it, for roughly twice this height. */}
<div className="px-4 py-2 max-w-5xl mx-auto">
<div className="flex gap-3 items-center">
<div className="w-20 h-11.25 rounded-lg bg-card overflow-hidden shrink-0">
{items[0]?.thumbnail_url && ( {items[0]?.thumbnail_url && (
<img src={items[0].thumbnail_url} alt="" className="w-full h-full object-cover" /> <img src={items[0].thumbnail_url} alt="" className="w-full h-full object-cover" />
)} )}
</div> </div>
<div className="min-w-0 flex-1"> <div className="min-w-0 flex-1">
<div className="flex items-center gap-2 min-w-0">
{renaming ? ( {renaming ? (
<input <input
autoFocus autoFocus
@@ -625,10 +630,10 @@ export default function Playlists() {
if (e.key === "Escape") setRenaming(false); if (e.key === "Escape") setRenaming(false);
}} }}
aria-label={t("playlists.rename")} aria-label={t("playlists.rename")}
className="text-lg font-semibold bg-surface border border-border rounded-md px-2 py-0.5 focus:outline-hidden focus:ring-2 focus:ring-accent/40" className="min-w-0 text-lg font-semibold bg-surface border border-border rounded-md px-2 py-0.5 focus:outline-hidden focus:ring-2 focus:ring-accent/40"
/> />
) : ( ) : (
<div className="flex items-center gap-2 min-w-0"> <>
<h2 className="text-lg font-semibold truncate">{plName(detail)}</h2> <h2 className="text-lg font-semibold truncate">{plName(detail)}</h2>
{editable && ( {editable && (
<button <button
@@ -655,14 +660,18 @@ export default function Playlists() {
<ExternalLink className="w-3.5 h-3.5" /> <ExternalLink className="w-3.5 h-3.5" />
</a> </a>
)} )}
</div> </>
)}
<div className="ml-auto flex gap-1.5 items-center shrink-0">
{linked && detail.dirty && (
<span
title={t("playlists.unsyncedHint")}
className="inline-flex items-center gap-1.5 text-2xs text-accent mr-1"
>
<span className="w-1.5 h-1.5 rounded-full bg-accent" />
{t("playlists.unsynced")}
</span>
)} )}
<div className="text-xs text-muted mt-0.5">
{t("playlists.itemCount", { count: items.length })}
{totalSeconds > 0 && ` · ${formatRuntime(totalSeconds)}`}
{filterActive && ` · ${t("playlists.filteredCount", { count: shown.length })}`}
</div>
<div className="flex gap-1.5 mt-3 flex-wrap items-center">
<button <button
onClick={() => shown.length && setPlayingId(shown[0]!.id)} onClick={() => shown.length && setPlayingId(shown[0]!.id)}
disabled={!shown.length} disabled={!shown.length}
@@ -714,21 +723,20 @@ export default function Playlists() {
<Trash2 className="w-3.5 h-3.5" /> <Trash2 className="w-3.5 h-3.5" />
</button> </button>
)} )}
{linked && detail.dirty && (
<span
title={t("playlists.unsyncedHint")}
className="inline-flex items-center gap-1.5 text-2xs text-accent ml-1"
>
<span className="w-1.5 h-1.5 rounded-full bg-accent" />
{t("playlists.unsynced")}
</span>
)}
</div>
</div> </div>
</div> </div>
<div className="flex items-center gap-2 mt-1 flex-wrap">
<span className="text-xs text-muted">
{t("playlists.itemCount", { count: items.length })}
{totalSeconds > 0 && ` · ${formatRuntime(totalSeconds)}`}
{filterActive && ` · ${t("playlists.filteredCount", { count: shown.length })}`}
</span>
{(items.length > 1 || viewActive) && ( {(items.length > 1 || viewActive) && (
<div className="flex items-center gap-2 mb-3 flex-wrap max-w-5xl"> <>
<span aria-hidden="true" className="text-xs text-muted/40">
·
</span>
<label className="inline-flex items-center gap-1.5 text-xs text-muted cursor-pointer select-none"> <label className="inline-flex items-center gap-1.5 text-xs text-muted cursor-pointer select-none">
<input <input
type="checkbox" type="checkbox"
@@ -754,12 +762,13 @@ export default function Playlists() {
<Check className="w-3.5 h-3.5" /> {t("playlists.saveOrder")} <Check className="w-3.5 h-3.5" /> {t("playlists.saveOrder")}
</button> </button>
)} )}
{/* ONE sentence that names the state. Three loose texts used to pile up here (reset {/* ONE sentence that names the state. Three loose texts used to pile up here
link + save hint + "reordering is off"), and none of them answered the question a (reset link + save hint + "reordering is off"), and none of them answered the
user actually has — "did I just change my playlist?". Worse, sorting a list whose question a user actually has — "did I just change my playlist?". Worse,
stored order ALREADY matches the sort produced a warning, no Save button and no sorting a list whose stored order ALREADY matches the sort produced a
visible change, which reads as a malfunction. Now the line says which of the three warning, no Save button and no visible change, which reads as a malfunction.
situations you are in; the disabled grip still explains itself on hover/focus. */} Now the line says which of the three situations you are in; the disabled grip
still explains itself on hover/focus. */}
{viewActive && <span className="text-2xs text-muted/80">{viewStatus}</span>} {viewActive && <span className="text-2xs text-muted/80">{viewStatus}</span>}
{canEdit && ( {canEdit && (
<div className="ml-auto"> <div className="ml-auto">
@@ -771,9 +780,12 @@ export default function Playlists() {
/> />
</div> </div>
)} )}
</div> </>
)} )}
</div> </div>
</div>
</div>
</div>
</PageToolbar> </PageToolbar>
{items.length === 0 ? ( {items.length === 0 ? (