commit 2273cc6bdec611b4aa61eaf0234e9f9d6dff79d9
parent 691a53ece2faf03936d897d408cb64a3873194ad
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 18 Nov 2026 01:50:45 -0500
channels: the heading and the corpus-wide buttons are sent at once; the rack streams in
One read (every channel's config and report, where its media is, the
volumes' free space) serves the freshness line and the rack; the page
starts it and both stream in. On md+ the rack's skeleton is a pane of
the viewport-height column, as the rack is. No row is cut and sorting
and filtering are unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
1 file changed, 134 insertions(+), 51 deletions(-)
diff --git a/editor/app/channels/page.tsx b/editor/app/channels/page.tsx
@@ -1,9 +1,11 @@
import { displayPath, hidePrivateSites } from "yt-dlp-transcript-common/lib/privacy/privacy-server";
import { isPrivateSite } from "yt-dlp-transcript-common/lib/siteSchema";
import type { Metadata } from "next";
+import { cache, Suspense } from "react";
import Link from "next/link";
import {
listChannelBriefs,
+ listChannelSlugs,
listChannelStatsFromSnapshots,
type ChannelBrief,
} from "yt-dlp-transcript-common/controller/channels";
@@ -61,6 +63,8 @@ import {
import { SyncAllChannelsButton } from "./components/SyncAllChannelsButton";
import { RefreshAllReportsButton } from "./components/RefreshAllReportsButton";
import { readActiveSite } from "../lib/activeSiteServer";
+import { SkeletonPanel, SkeletonRows, StreamFilled } from "../components/StreamSkeleton";
+import { e2eStreamDelay } from "../lib/streamDelay";
export const dynamic = "force-dynamic";
@@ -166,14 +170,20 @@ function focusLabelOf(
: `${focusSlugs.length} channels`;
}
-export default async function ChannelsPage({
- searchParams,
-}: {
- searchParams: Promise<{ site?: string; location?: string; sort?: string }>;
-}) {
+// EVERYTHING BELOW THE HEADING, read once per request for the two sections
+// that draw it (the freshness line under the heading, and the rack). The page
+// starts this and does not await it: the heading and the corpus-wide buttons
+// are sent at once and both sections stream in behind them. What it returns is
+// the two sections already rendered, so the page function above stays a shell.
+const loadChannelsView = cache(
+ async (
+ site: string | undefined,
+ locationParam: string | undefined,
+ sortParam: string | undefined,
+ ): Promise<{ freshnessLine: React.ReactNode; body: React.ReactNode }> => {
+ await e2eStreamDelay();
const paths = getPaths();
const settings = getSettings();
- const { site, location: locationParam, sort: sortParam } = await searchParams;
// The active site: a `?site=` link's for this request, else the cookie's.
const active = await readActiveSite(site, listSiteIds(paths));
// Counts come from each channel's last snapshot, not a corpus walk. One read
@@ -361,29 +371,14 @@ export default async function ChannelsPage({
const freshness = summariseFreshness(
briefs.filter((b) => shownSlugs.has(b.slug)),
);
- return (
- // ON md+ THE DOCUMENT STOPS SCROLLING. The page is a flex column exactly
- // the height of the viewport (main carries py-6, hence -3rem) so that the
- // header, the focus line, the instrument bar and the selection deck are
- // fixed chrome and the rack between them is the only thing that moves.
- // Below md there is no height and the document scrolls as it always has.
- <div className="flex flex-col gap-3 md:h-[calc(100vh-3rem)] md:min-h-0">
- {/* THE HEADER WRAPS; IT NEVER SQUEEZES. The title block has a 16rem
- basis, so when the corpus-wide cluster cannot sit beside it at full
- width the cluster drops onto its own line. It used to be nowrap with
- the cluster shrink-0, and at a narrow md+ column (sidebar open) the
- title block was left ~60px and its text ran one word per line. */}
- <header className="flex flex-wrap items-start justify-between gap-x-4 gap-y-2 shrink-0">
- <div className="min-w-0 flex-[1_1_16rem]">
- <h1 className="text-2xl font-semibold">Channels</h1>
- {/* A STATUS LINE, NOT A LEAD PARAGRAPH. Every pipeline on the page is
- read from each channel's last report, so the line says how old the
- oldest one is and how many have none (the rack's Report column names
- them). */}
- {channels.length > 0 && (
+ return {
+ freshnessLine:
+ channels.length > 0 ? (
+
<p
className="text-xs text-muted-foreground"
data-testid="channels-freshness"
+ data-stream-filled="channels-freshness"
>
<span className="tabular-nums">{channels.length}</span>{" "}
{channels.length === 1 ? "channel" : "channels"} ·{" "}
@@ -409,30 +404,11 @@ export default async function ChannelsPage({
</>
)}
</p>
- )}
- </div>
- {/* FOUR DARK PILLS OF EQUAL WEIGHT was four things shouting. Three of
- these sweep the WHOLE pool and are used rarely; one creates a
- channel and is the page's actual call to action. So the three are
- outlines under an eyebrow that says what they act on, and only
- "New channel" is filled. */}
- <div className="flex w-full flex-col items-start gap-1 md:w-auto md:shrink-0 md:items-end md:self-start">
- <span className="font-mono text-[10px] uppercase tracking-[0.16em] text-muted-foreground">
- Every channel
- </span>
- <div className="flex flex-wrap items-center gap-2 md:justify-end">
- <SyncAllChannelsButton />
- <RefreshAllReportsButton />
- <Link
- href="/channels/new"
- className="inline-flex h-8 items-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:opacity-90"
- >
- New channel
- </Link>
- </div>
- </div>
- </header>
- {channels.length === 0 ? (
+ ) : null,
+ body:
+ channels.length === 0 ? (
+ <StreamFilled name="channels-rack">
+
<p className="text-sm text-muted-foreground border border-dashed border-border rounded p-4">
{active.siteId && !active.isAll
? `No channels assigned to ${
@@ -442,7 +418,12 @@ export default async function ChannelsPage({
} yet — add some on the Sites page, or create a channel to add it here.`
: "No channels yet."}
</p>
+ </StreamFilled>
) : (
+ // The rack is a pane of the page's viewport-height column (see
+ // ChannelsRack): this wrapper has to be one too.
+ <StreamFilled name="channels-rack" className="flex min-h-0 flex-1 flex-col">
+
<ChannelsRack
channels={channels}
columns={columns}
@@ -473,7 +454,109 @@ export default async function ChannelsPage({
}))}
focusLabel={focusLabel}
/>
- )}
+ </StreamFilled>
+ ),
+ };
+ },
+);
+
+async function Freshness({ view }: { view: ReturnType<typeof loadChannelsView> }) {
+ return (await view).freshnessLine;
+}
+
+async function Rack({ view }: { view: ReturnType<typeof loadChannelsView> }) {
+ return (await view).body;
+}
+
+// The rack's skeleton, in px, where the page has no height of its own (below
+// md): the chrome above the rows (focus line, volume bar, header) and one row.
+// On md+ the skeleton is a pane of the viewport-height column, like the rack.
+const RACK_CHROME_PX = 150;
+const RACK_ROW_PX = 37;
+const RACK_EMPTY_PX = 54;
+
+export default async function ChannelsPage({
+ searchParams,
+}: {
+ searchParams: Promise<{ site?: string; location?: string; sort?: string }>;
+}) {
+ const { site, location: locationParam, sort: sortParam } = await searchParams;
+ // What the skeleton is sized by: how many channels there are (one readdir).
+ const pending = (await listChannelSlugs(getPaths())).length;
+ const view = loadChannelsView(site, locationParam, sortParam);
+ return (
+ // ON md+ THE DOCUMENT STOPS SCROLLING. The page is a flex column exactly
+ // the height of the viewport (main carries py-6, hence -3rem) so that the
+ // header, the focus line, the instrument bar and the selection deck are
+ // fixed chrome and the rack between them is the only thing that moves.
+ // Below md there is no height and the document scrolls as it always has.
+ <div className="flex flex-col gap-3 md:h-[calc(100vh-3rem)] md:min-h-0">
+ {/* THE HEADER WRAPS; IT NEVER SQUEEZES. The title block has a 16rem
+ basis, so when the corpus-wide cluster cannot sit beside it at full
+ width the cluster drops onto its own line. It used to be nowrap with
+ the cluster shrink-0, and at a narrow md+ column (sidebar open) the
+ title block was left ~60px and its text ran one word per line. */}
+ <header className="flex flex-wrap items-start justify-between gap-x-4 gap-y-2 shrink-0">
+ <div className="min-w-0 flex-[1_1_16rem]">
+ <h1 className="text-2xl font-semibold">Channels</h1>
+ {/* A STATUS LINE, NOT A LEAD PARAGRAPH. Every pipeline on the page is
+ read from each channel's last report, so the line says how old the
+ oldest one is and how many have none (the rack's Report column names
+ them). */}
+ <Suspense
+ fallback={
+ pending > 0 ? (
+ <p
+ className="text-xs text-muted-foreground"
+ data-stream-skeleton="channels-freshness"
+ aria-hidden="true"
+ >
+
+ </p>
+ ) : null
+ }
+ >
+ <Freshness view={view} />
+ </Suspense>
+ </div>
+ {/* FOUR DARK PILLS OF EQUAL WEIGHT was four things shouting. Three of
+ these sweep the WHOLE pool and are used rarely; one creates a
+ channel and is the page's actual call to action. So the three are
+ outlines under an eyebrow that says what they act on, and only
+ "New channel" is filled. */}
+ <div className="flex w-full flex-col items-start gap-1 md:w-auto md:shrink-0 md:items-end md:self-start">
+ <span className="font-mono text-[10px] uppercase tracking-[0.16em] text-muted-foreground">
+ Every channel
+ </span>
+ <div className="flex flex-wrap items-center gap-2 md:justify-end">
+ <SyncAllChannelsButton />
+ <RefreshAllReportsButton />
+ <Link
+ href="/channels/new"
+ className="inline-flex h-8 items-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:opacity-90"
+ >
+ New channel
+ </Link>
+ </div>
+ </div>
+ </header>
+ <Suspense
+ fallback={
+ pending === 0 ? (
+ <SkeletonPanel name="channels-rack" height={RACK_EMPTY_PX} />
+ ) : (
+ <SkeletonRows
+ name="channels-rack"
+ rows={pending}
+ rowHeight={RACK_ROW_PX}
+ head={RACK_CHROME_PX}
+ className="min-h-0 flex-1 rounded-md border border-border"
+ />
+ )
+ }
+ >
+ <Rack view={view} />
+ </Suspense>
</div>
);
}