"use client"; import { fmtTs } from "@/lib/api"; export type TimelineJob = { id: string; upload_at?: number; status?: string; anchor_name?: string; channel_name?: string; clip_ready?: boolean; can_upload_now?: boolean; }; export type TimelineHour = { hour: number; label: string; count: number; is_past?: boolean; is_current?: boolean; jobs: TimelineJob[]; }; export function UploadTimeline({ hours, nowHour, onUploadNow, }: { hours?: TimelineHour[]; nowHour?: number; onUploadNow?: (job: TimelineJob) => void; }) { const rows = hours || []; if (!rows.length) { return

暂无排程时间轴

; } const max = Math.max(1, ...rows.map((h) => h.count || 0)); return (
{rows.map((h) => { const hgt = Math.max(4, Math.round(((h.count || 0) / max) * 48)); return (
{h.hour}
); })}
{rows .flatMap((h) => h.jobs || []) .slice(0, 24) .map((j) => (
{j.upload_at ? fmtTs(Number(j.upload_at)) : "—"} {" · "} {j.anchor_name || "素材"} {j.channel_name ? ` · ${j.channel_name}` : ""}
{j.can_upload_now && onUploadNow ? ( ) : ( {j.status || ""} )}
))}
); }