"use client"; import Link from "next/link"; import type { AutoQueueKindStatus } from "yt-dlp-transcript-common/views/autoQueueStatus"; import { type Channel, ORDER_LABEL, formatRecency, leafOrder, leafSentence, } from "./dispatch"; // What the runner would dispatch next, and WHY that one. // // Nothing here needed new machinery: the pick comes from the same // buildChannelWork → buildPendingByLeaf → selectNextWork chain the runner uses, // the rule path is WorkPick.path, and "why not the rule above it" is just the // higher-priority leaves whose pending count is zero. The page simply never // asked. // // A plain
, never a
: a nested section inside a kind section makes // locator("section", { has }) match two ancestors and every scoped lookup in the // suite fails on strict mode. export function NextUp({ status, channels, }: { status: AutoQueueKindStatus; channels: Channel[]; }) { const next = status.nextUp; const order = status.policy.order ?? "listed"; if (!next) { return (

Nothing to dispatch — every rule is empty or capped.

); } const leaves = leafOrder(status.policy.root); const at = leaves.findIndex((l) => l.id === next.leafId); const leaf = at >= 0 ? leaves[at] : null; const recency = formatRecency(next.recency ?? undefined); const skipped = next.skippedLeafIds .map((id) => leaves.findIndex((l) => l.id === id)) .filter((i) => i >= 0); return (

{next.channelSlug ? ( {next.channelSlug}/{next.videoId} ) : ( {next.videoId} )} {recency && ( {recency} )} {at >= 0 && ( rule {at + 1} {leaf ? ` · ${leafSentence(leaf, channels)}` : ""} )}

{skipped.length > 0 ? `${skipped .map((i) => `rule ${i + 1}`) .join(", ")} ${skipped.length === 1 ? "has" : "have"} no pending work` : "highest-priority rule with work"} {order !== "listed" ? ` · ${ORDER_LABEL[order].toLowerCase()}` : ""}

); } function Panel({ children }: { children: React.ReactNode }) { return (

Next up

{children}
); }