// ACCOUNT ACTIVITY (lane x-console): a posts channel's archived posts per UTC // day over the archive's range, as a compact bar strip, with its long // silences shaded — a gap of at least 3× the account's median gap AND 48 h // (common/lib/accountActivity.ts says why both) — and each silence linked to // the post before it and the post after. Read from the stored posts; a server // component, no client code. import { readChannelActivity } from "yt-dlp-transcript-common/lib/postTimes-server"; import { medianText, spanHours, type AccountActivity, type ActivityEnd, } from "yt-dlp-transcript-common/lib/accountActivity"; const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; // "4 Nov 10:54" (UTC); the year when it is not the strip's last. function at(iso: string, lastYear: string): string { const d = new Date(iso); const y = String(d.getUTCFullYear()); const hm = iso.slice(11, 16); return `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]}${y === lastYear ? "" : ` ${y}`} ${hm}`; } function dayText(day: string): string { return `${Number(day.slice(8, 10))} ${MONTHS[Number(day.slice(5, 7)) - 1]} ${day.slice(0, 4)}`; } const SHOWN_SILENCES = 12; const H = 40; function PostLink({ end, label }: { end: ActivityEnd; label: string }) { return ( {label} ); } export function AccountActivityPanel({ activity }: { activity: AccountActivity }) { const { days, maxPerDay, silences } = activity; const n = days.length; const index = new Map(days.map((d, i) => [d.day, i])); const lastYear = activity.lastAt.slice(0, 4); const barW = n <= 120 ? 0.8 : 1; // Labels: about a week apart over two months or less, else month starts // (at most ~12). One too near the right edge would run off it. const starts = n <= 62 ? days.flatMap((_, i) => (i % Math.max(1, Math.ceil(n / 7)) === 0 ? [i] : [])) : days.flatMap((d, i) => (d.day.endsWith("-01") || i === 0 ? [i] : [])); const step = Math.max(1, Math.ceil(starts.length / 12)); const ticks = starts.filter((i, k) => k % step === 0 && (i === 0 || i / n < 0.92)); const label = (i: number) => n <= 62 || i === 0 ? dayText(days[i].day).replace(/ \d{4}$/, "") : MONTHS[Number(days[i].day.slice(5, 7)) - 1]; // A silence's shading spans the gap itself, from the post before to the // post after (in days from the strip's first midnight), not their whole days. const origin = Date.parse(`${days[0].day}T00:00:00Z`); const silenceSpan = (s: { before: ActivityEnd; after: ActivityEnd }) => { const a = (Date.parse(s.before.createdAt) - origin) / 86_400_000; const b = (Date.parse(s.after.createdAt) - origin) / 86_400_000; return { x: a, w: Math.max(0.2, b - a) }; }; return (

{activity.author ? "Account activity" : "Activity"}

{activity.posts.toLocaleString("en-US")} posts{activity.author ? ` by @${activity.author}` : ""} ·{" "} {dayText(days[0].day)} – {dayText(days[n - 1].day)} · median gap {medianText(activity.medianGapMinutes)} · busiest day {maxPerDay} · UTC

{silences.map((s) => { const { x, w } = silenceSpan(s); return ( {`No archived post for ${spanHours(s.hours)}`} ); })} {days.map((d, i) => d.count > 0 ? ( {`${d.day}: ${d.count} post${d.count === 1 ? "" : "s"}`} ) : null, )}

Long silences ({silences.length}){" "} — no archived post for ≥ {spanHours(activity.thresholdHours)} (≥ 48 h and ≥ 3× the median gap)

{silences.length === 0 && !activity.trailing ? (

None in the archive's range.

) : ( )}
); } // The panel as the page streams it: the posts read through the cached light // reader and the result memoised by the shards' signature // (lib/postTimes-server.ts), behind the page's Suspense boundary. export async function AccountActivitySection({ channelRoot, asOf, author, }: { channelRoot: string; asOf?: string; author?: string; }) { const activity = await readChannelActivity(channelRoot, { ...(asOf ? { asOf } : {}), ...(author ? { author } : {}), }); return activity ? : null; } export function AccountActivityLoading() { return (
Reading the archived posts…
); }