Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh
660 linesCodeBlameRaw
1/**
2 * Home's parts (routes/workspace/home.tsx): Where you're needed, Start
3 * here, what happened in the span (what people did, what landed, builds,
4 * spend) and Running now. Each takes what
5 * lib/home.ts worked out and only draws it.
6 */
7import {
8 AlertTriangle,
9 ArrowRight,
10 AtSign,
11 Bell,
12 GitCommitHorizontal,
13 GitMerge,
14 GitPullRequest,
15 Loader,
16 Mail,
17 Package,
18 Rocket,
19 Server,
20 Tag,
21 User,
22 Users,
23 Workflow,
24} from "lucide-react";
25import type { ReactNode } from "react";
26import { Link } from "react-router";
27
28import {
29 type Attention,
30 type AttentionKind,
31 type AttentionRow,
32 type DeployRow,
33 type Digest,
34 type DigestActor,
35 type DigestColumn,
36 type LandedChange,
37 type RunningRow,
38 type Span,
39 type Spend,
40 type Stake,
41 WINDOWS,
42 listOf,
43 waited,
44 whenShort,
45} from "../lib/home";
46import { cn } from "../lib/cn";
47import { money } from "../lib/money";
48import { ButtonLink } from "./ui";
49import { Avatar } from "./ui/avatar";
50import { Badge } from "./ui/badge";
51import { Skeleton } from "./ui/skeleton";
52import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
53
54export function Card({
55 title,
56 hint,
57 link,
58 children,
59 className = "",
60}: {
61 title: ReactNode;
62 /** A few words under the title. */
63 hint?: string;
64 link?: { label: string; to: string } | null;
65 children: ReactNode;
66 className?: string;
67}) {
68 return (
69 <section className={`rounded-2xl border border-line bg-surface ${className}`}>
70 <header className="flex items-start gap-2 px-5 pt-4 pb-3">
71 <div className="min-w-0">
72 <h2 className="text-sm font-semibold text-fg">{title}</h2>
73 {hint && <p className="mt-0.5 text-xs text-muted">{hint}</p>}
74 </div>
75 {link && (
76 <Link to={link.to} className="ml-auto inline-flex shrink-0 items-center gap-1 pt-0.5 text-xs text-muted hover:text-fg">
77 {link.label}
78 <ArrowRight size={12} />
79 </Link>
80 )}
81 </header>
82 {children}
83 </section>
84 );
85}
86
87export function Quiet({ children }: { children: ReactNode }) {
88 return <p className="px-5 pb-5 text-sm text-muted">{children}</p>;
89}
90
91function Missing({ names, what }: { names: string[]; what: string }) {
92 if (names.length === 0) return null;
93 return (
94 <p className="flex items-center gap-1.5 border-t border-line px-5 py-2.5 text-xs text-faint">
95 <AlertTriangle size={12} className="shrink-0" />
96 {listOf(names)} didn&apos;t answer, so {what} isn&apos;t listed.
97 </p>
98 );
99}
100
101// --- The window switch ----------------------------------------------------------
102
103/** Since last visit, last 24 hours, last 7 days: links, so the span is in the address and works without script. */
104export function WindowSwitch({ span }: { span: Pick<Span, "key"> }) {
105 return (
106 <nav aria-label="What happened over" className="flex shrink-0 self-start rounded-lg border border-line bg-surface p-0.5">
107 {WINDOWS.map((option) => {
108 const current = option.key === span.key;
109 return (
110 <Link
111 key={option.key}
112 to={option.key === "last" ? "?" : `?window=${option.key}`}
113 preventScrollReset
114 aria-current={current ? "true" : undefined}
115 className={cn(
116 "rounded-md px-2.5 py-1 text-xs font-medium whitespace-nowrap transition-colors",
117 current ? "bg-raised text-fg shadow-[0_0_0_1px_var(--color-line-strong)]" : "text-muted hover:text-fg",
118 )}
119 >
120 {option.label}
121 </Link>
122 );
123 })}
124 </nav>
125 );
126}
127
128// --- Where you're needed ---------------------------------------------------------
129
130const ICON: Record<AttentionKind, ReactNode> = {
131 deploy: <Rocket size={16} className="text-danger" />,
132 pull_blocked: <GitPullRequest size={16} className="text-warn" />,
133 review: <GitPullRequest size={16} className="text-info" />,
134 invitation: <Mail size={16} className="text-info" />,
135 runner: <Server size={16} className="text-warn" />,
136 notification: <Bell size={16} className="text-warn" />,
137 chat: <AtSign size={16} className="text-accent" />,
138};
139
140const STAKE_TONE: Record<NonNullable<Stake["tone"]> | "none", string> = {
141 danger: "text-danger",
142 warn: "text-warn",
143 accent: "text-accent",
144 none: "text-fg-soft",
145};
146
147function StakeText({ stake }: { stake: Stake }) {
148 return <span className={`text-xs font-medium tabular-nums ${STAKE_TONE[stake.tone ?? "none"]}`}>{stake.text}</span>;
149}
150
151/** Rows shown before the rest fold away. */
152const ROWS = 8;
153
154function NeedItem({ row, now }: { row: AttentionRow; now: number }) {
155 return (
156 <li className="flex items-start gap-3 border-t border-line px-5 py-3 first:border-t-0">
157 <span className="mt-0.5 shrink-0">{ICON[row.kind]}</span>
158 <div className="min-w-0 grow">
159 <Link to={row.action.to} className="line-clamp-2 text-sm font-semibold text-fg hover:underline sm:block sm:truncate">
160 {row.title}
161 </Link>
162 <p className="truncate text-xs text-muted">{row.detail}</p>
163 <div className="mt-1 flex flex-wrap items-center gap-x-2 text-xs sm:hidden">
164 {row.stake && <StakeText stake={row.stake} />}
165 {row.at > 0 && (
166 <span className="text-faint" suppressHydrationWarning>
167 waiting {waited(row.at, now)}
168 </span>
169 )}
170 </div>
171 </div>
172 <div className="hidden max-w-48 shrink-0 pt-0.5 text-right whitespace-nowrap sm:block">
173 {row.stake && <StakeText stake={row.stake} />}
174 {row.at > 0 && (
175 <div className="text-[0.6875rem] text-faint tabular-nums" suppressHydrationWarning>
176 waiting {waited(row.at, now)}
177 </div>
178 )}
179 </div>
180 <ButtonLink to={row.action.to} variant="outline" size="xs" className="border-line-strong px-2.5 text-fg hover:border-accent/50 hover:bg-raised">
181 {row.action.label}
182 </ButtonLink>
183 </li>
184 );
185}
186
187/** Everything waiting on you, most pressing and longest waiting first; past the first few, the rest fold away. */
188export function NeedsList({ attention, now }: { attention: Attention; now: number }) {
189 const { rows, missing } = attention;
190 return (
191 <>
192 {rows.length === 0 ? (
193 <Quiet>{missing.length > 0 ? "Nothing needs you in what could be read." : "Nothing needs you. Reviews, invitations and messages for you show here as soon as they arrive."}</Quiet>
194 ) : (
195 <ul>
196 {rows.slice(0, ROWS).map((row) => (
197 <NeedItem key={row.key} row={row} now={now} />
198 ))}
199 </ul>
200 )}
201 {rows.length > ROWS && (
202 <details className="group border-t border-line">
203 <summary className="cursor-pointer list-none px-5 py-2.5 text-xs font-medium text-fg-soft hover:text-fg">
204 <span className="group-open:hidden">Show {(rows.length - ROWS).toLocaleString("en-US")} more</span>
205 <span className="hidden group-open:inline">Show fewer</span>
206 </summary>
207 <ul className="border-t border-line">
208 {rows.slice(ROWS).map((row) => (
209 <NeedItem key={row.key} row={row} now={now} />
210 ))}
211 </ul>
212 </details>
213 )}
214 <Missing names={missing} what="what waits there" />
215 </>
216 );
217}
218
219export function RowsSkeleton({ rows = 3 }: { rows?: number }) {
220 return (
221 <div className="space-y-4 px-5 pb-5" aria-busy="true">
222 {Array.from({ length: rows }, (_, i) => (
223 <div key={i} className="flex items-center gap-3">
224 <Skeleton className="size-4 rounded" />
225 <div className="grow space-y-1.5">
226 <Skeleton className="h-3.5" style={{ width: `${60 - i * 8}%` }} />
227 <Skeleton className="h-3" style={{ width: `${80 - i * 10}%` }} />
228 </div>
229 <Skeleton className="h-7 w-16" />
230 </div>
231 ))}
232 </div>
233 );
234}
235
236// --- Start here -----------------------------------------------------------------
237
238export function StartHere({ attention, now }: { attention: Attention; now: number }) {
239 const start = attention.start;
240 return (
241 <Card
242 title={
243 <>
244 Start here <span className="font-normal text-faint">· picked by g1t</span>
245 </>
246 }
247 >
248 {!start ? (
249 <Quiet>{attention.missing.length > 0 ? "Nothing to pick from what could be read." : "Nothing needs you, so there's nothing to pick."}</Quiet>
250 ) : (
251 <div className="px-5 pb-5">
252 <div className="flex items-start gap-3">
253 <span className="mt-0.5 shrink-0">{ICON[start.row.kind]}</span>
254 <div className="min-w-0">
255 <p className="text-[0.9375rem] leading-snug font-semibold text-fg">{start.row.title}</p>
256 <p className="mt-1 line-clamp-2 text-xs text-muted">{start.row.detail}</p>
257 </div>
258 </div>
259 <dl className="mt-4 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-xs">
260 {start.row.owner && (
261 <>
262 <dt className="text-muted">Owner</dt>
263 <dd className="flex min-w-0 items-center gap-1.5 text-fg-soft">
264 <User size={12} className="shrink-0 text-muted" />
265 <span className="truncate">{start.row.owner.agent ? `@${start.row.owner.name}` : start.row.owner.name}</span>
266 </dd>
267 </>
268 )}
269 <dt className="text-muted">Next</dt>
270 <dd className="text-fg-soft">{start.row.action.label}</dd>
271 {start.row.at > 0 && (
272 <>
273 <dt className="text-muted">Waiting</dt>
274 <dd className="text-fg-soft" suppressHydrationWarning>
275 {waited(start.row.at, now)}
276 </dd>
277 </>
278 )}
279 {start.row.stake && (
280 <>
281 <dt className="text-muted">At stake</dt>
282 <dd>
283 <StakeText stake={start.row.stake} />
284 </dd>
285 </>
286 )}
287 </dl>
288 <p className="mt-4 rounded-lg bg-raised/60 px-3 py-2.5 text-xs leading-relaxed text-fg-soft">
289 <span className="font-medium text-fg">Why this one: </span>
290 {start.why}
291 </p>
292 <Link
293 to={start.row.action.to}
294 className="mt-4 inline-flex h-8 items-center gap-1.5 rounded-lg bg-accent px-3 text-sm font-medium text-bg transition-colors hover:bg-accent-hover"
295 >
296 {start.row.action.label}
297 <ArrowRight size={14} />
298 </Link>
299 </div>
300 )}
301 </Card>
302 );
303}
304
305// --- What people did in the span ------------------------------------------------
306
307/** "in the span" said the way the span is: "since you were last here", "in the last 24 hours". */
308function inSpan(span: Pick<Span, "key" | "note" | "words">): string {
309 return span.key === "last" && span.note == null ? "since you were last here" : span.words.charAt(0).toLowerCase() + span.words.slice(1);
310}
311
312/** The faces of the most active, with a tooltip naming each, and how many more there were. */
313const FACES = 5;
314
315function Faces({ actors }: { actors: DigestActor[] }) {
316 if (actors.length === 0) return null;
317 const shown = actors.slice(0, FACES);
318 const more = actors.length - shown.length;
319 return (
320 <div className="flex items-center gap-1.5">
321 <ul className="flex -space-x-1.5" aria-label="Most active">
322 {shown.map((actor) => (
323 <li key={actor.key} className="rounded-full ring-2 ring-surface">
324 <Tooltip>
325 <TooltipTrigger asChild>
326 <span className="block">
327 <Avatar name={actor.name} size={22} />
328 </span>
329 </TooltipTrigger>
330 <TooltipContent>
331 {actor.name} · {actor.count.toLocaleString("en-US")} {actor.count === 1 ? "thing" : "things"}
332 </TooltipContent>
333 </Tooltip>
334 </li>
335 ))}
336 </ul>
337 {more > 0 && <span className="text-xs text-muted">+{more.toLocaleString("en-US")}</span>}
338 </div>
339 );
340}
341
342/** The lines: each what was done, with its count in the words, linked to where it is listed. */
343function Lines({ column }: { column: DigestColumn }) {
344 return (
345 <ul className="mt-3 space-y-1.5">
346 {column.lines.map((line) => (
347 <li key={line.key} className="flex items-start gap-2 text-sm text-fg">
348 <span className="mt-1.75 size-1.5 shrink-0 rounded-full bg-fg-soft/60" aria-hidden />
349 {line.to ? (
350 <Link to={line.to} className="hover:underline">
351 {line.text}
352 </Link>
353 ) : (
354 <span>{line.text}</span>
355 )}
356 </li>
357 ))}
358 </ul>
359 );
360}
361
362/**
363 * What people did in the span: lines with counts linked to where each
364 * thing is listed, and the most active faces. It says when it is empty,
365 * and which part didn't answer.
366 */
367export function PeopleCard({ digest, span, code }: { digest: Digest | null; span: Pick<Span, "key" | "note" | "words">; code: boolean }) {
368 const when = inSpan(span);
369 if (!digest) {
370 return (
371 <section className="rounded-2xl border border-line bg-surface p-5">
372 <p className="text-sm text-muted">What happened couldn&apos;t be read right now. It shows here once Code and Chat answer.</p>
373 </section>
374 );
375 }
376 const silent = digest.missing.filter((name) => name === "Code" || name === "Chat");
377 const col = digest.people;
378 return (
379 <section className="rounded-2xl border border-line bg-surface p-5" aria-label="What people did">
380 <div className="flex flex-wrap items-center gap-3">
381 <h3 className="inline-flex items-center gap-1.5 text-sm font-semibold text-fg">
382 <Users size={15} className="text-muted" />
383 People
384 </h3>
385 {col.actors.length > 0 && (
386 <Badge tone="neutral" size="md" className="tabular-nums">
387 {col.actors.length.toLocaleString("en-US")} active
388 </Badge>
389 )}
390 <span className="ml-auto">
391 <Faces actors={col.actors} />
392 </span>
393 </div>
394 {col.lines.length > 0 ? (
395 <Lines column={col} />
396 ) : (
397 <p className="mt-3 text-sm text-muted">
398 {silent.length > 0
399 ? `Nothing from what could be read ${when}.`
400 : code
401 ? `Nobody pushed, opened, merged, reviewed, edited a doc or said anything ${when}.`
402 : `Nobody edited a doc or said anything ${when}.`}
403 </p>
404 )}
405 {silent.length > 0 && (
406 <p className="mt-3 flex items-center gap-1.5 text-xs text-faint">
407 <AlertTriangle size={12} className="shrink-0" />
408 {listOf(silent)} didn&apos;t answer, so {silent.length === 1 ? "its part" : "their parts"} {silent.length === 1 ? "isn't" : "aren't"} counted.
409 </p>
410 )}
411 {digest.partial && <p className="mt-3 text-xs text-faint">More happened than Home reads at once, so some counts are low.</p>}
412 </section>
413 );
414}
415
416export function SpanSkeleton() {
417 return (
418 <section className="space-y-3 rounded-2xl border border-line bg-surface p-5" aria-busy="true">
419 <div className="flex items-center justify-between">
420 <Skeleton className="h-3.5 w-20" />
421 <Skeleton className="h-5 w-24 rounded-full" />
422 </div>
423 <Skeleton className="h-3.5 w-3/4" />
424 <Skeleton className="h-3.5 w-1/2" />
425 <Skeleton className="h-3.5 w-2/3" />
426 </section>
427 );
428}
429
430// --- Landed and builds -----------------------------------------------------------
431
432/** Rows each list shows before the rest fold away. */
433const LIST_ROWS = 5;
434
435function When({ at, now, tz }: { at: number; now: number; tz: string | null }) {
436 return (
437 <span className="shrink-0 text-xs text-faint tabular-nums" suppressHydrationWarning>
438 {whenShort(at, now, tz)}
439 </span>
440 );
441}
442
443function Folded<T>({ items, render }: { items: T[]; render: (item: T) => ReactNode }) {
444 return (
445 <>
446 <ul>{items.slice(0, LIST_ROWS).map(render)}</ul>
447 {items.length > LIST_ROWS && (
448 <details className="group border-t border-line">
449 <summary className="cursor-pointer list-none px-5 py-2.5 text-xs font-medium text-fg-soft hover:text-fg">
450 <span className="group-open:hidden">Show {(items.length - LIST_ROWS).toLocaleString("en-US")} more</span>
451 <span className="hidden group-open:inline">Show fewer</span>
452 </summary>
453 <ul className="border-t border-line">{items.slice(LIST_ROWS).map(render)}</ul>
454 </details>
455 )}
456 </>
457 );
458}
459
460const rowClass = "flex items-center gap-3 border-t border-line px-5 py-2.5 first:border-t-0";
461
462const LANDED_ICON: Record<LandedChange["kind"], ReactNode> = {
463 merge: <GitMerge size={15} className="shrink-0 text-success" />,
464 push: <GitCommitHorizontal size={15} className="shrink-0 text-success" />,
465 deploy: <Rocket size={15} className="shrink-0 text-success" />,
466 release: <Tag size={15} className="shrink-0 text-info" />,
467 package: <Package size={15} className="shrink-0 text-info" />,
468};
469
470/** A few words on the card's line: how many of each kind landed. */
471function landedHint(landed: LandedChange[]): string {
472 const count = (kind: LandedChange["kind"]) => landed.filter((change) => change.kind === kind).length;
473 const parts: string[] = [];
474 const merged = count("merge");
475 const pushes = count("push");
476 const deploys = count("deploy");
477 const published = count("release") + count("package");
478 if (merged > 0) parts.push(`${merged.toLocaleString("en-US")} merged`);
479 if (pushes > 0) parts.push(`${pushes.toLocaleString("en-US")} pushed direct`);
480 if (deploys > 0) parts.push(`${deploys.toLocaleString("en-US")} ${deploys === 1 ? "deploy" : "deploys"}`);
481 if (published > 0) parts.push(`${published.toLocaleString("en-US")} published`);
482 return parts.join(" · ");
483}
484
485/**
486 * Everything that landed in the span, newest first: pull requests merged,
487 * commits pushed straight to a default branch, production builds that went
488 * live, releases and package versions published.
489 */
490export function LandedCard({ landed, missing, code, now, tz }: { landed: LandedChange[] | null; missing: string[]; code: boolean; now: number; tz: string | null }) {
491 if (!code) return null;
492 return (
493 <Card title="Landed" hint={landed && landed.length > 0 ? landedHint(landed) : undefined}>
494 {!landed ? (
495 <Quiet>Code didn&apos;t answer, so what landed can&apos;t be listed right now.</Quiet>
496 ) : landed.length === 0 ? (
497 <Quiet>{missing.length > 0 ? "Nothing landed in what could be read." : "Nothing merged, pushed to a default branch, deployed to production or published in this span."}</Quiet>
498 ) : (
499 <Folded
500 items={landed}
501 render={(change) => (
502 <li key={change.key} className={rowClass}>
503 {LANDED_ICON[change.kind]}
504 <div className="min-w-0 grow">
505 <Link to={change.to} className="block truncate text-sm text-fg hover:underline">
506 {change.title}
507 </Link>
508 <p className="truncate text-xs text-muted">{change.detail}</p>
509 </div>
510 <When at={change.at} now={now} tz={tz} />
511 </li>
512 )}
513 />
514 )}
515 {landed && <Missing names={missing} what="everything that landed" />}
516 </Card>
517 );
518}
519
520export function DeploysCard({ deploys, complete, code, now, tz }: { deploys: DeployRow[] | null; complete: boolean; code: boolean; now: number; tz: string | null }) {
521 // A workspace that doesn't deploy has nothing to say here.
522 if (!code || (deploys && deploys.length === 0)) return null;
523 const failed = deploys?.filter((row) => row.outcome === "failed").length ?? 0;
524 return (
525 <Card title="Deploys" hint={deploys ? `${deploys.length.toLocaleString("en-US")} finished${failed ? ` · ${failed} failed` : ""}` : undefined}>
526 {!deploys ? (
527 <Quiet>Deployments didn&apos;t answer, so builds can&apos;t be listed right now.</Quiet>
528 ) : (
529 <Folded
530 items={deploys}
531 render={(row) => (
532 <li key={row.key} className={rowClass}>
533 <Rocket size={15} className={cn("shrink-0", row.outcome === "failed" ? "text-danger" : "text-success")} />
534 <div className="min-w-0 grow">
535 <Link to={row.to} className="block truncate text-sm text-fg hover:underline">
536 {row.kind === "production" ? "Production" : `Preview of ${row.branch ?? "a branch"}`} of {row.project}
537 <span className={cn("ml-2 text-xs font-medium", row.outcome === "failed" ? "text-danger" : "text-success")}>
538 {row.outcome === "failed" ? "Failed" : "Went live"}
539 </span>
540 </Link>
541 <p className="truncate text-xs text-muted">
542 <span className="font-mono">{row.commit}</span> · by {row.by}
543 </p>
544 </div>
545 <When at={row.at} now={now} tz={tz} />
546 </li>
547 )}
548 />
549 )}
550 {deploys && !complete && <p className="border-t border-line px-5 py-2.5 text-xs text-faint">Some projects&apos; builds couldn&apos;t be read.</p>}
551 </Card>
552 );
553}
554
555// --- Spend in the span ------------------------------------------------------------
556
557/**
558 * Each kind of charge keeps its colour, whatever its rank: sandboxes and
559 * runners one, hosting another, storage and the rest grey.
560 */
561function kindColour(kind: string): string {
562 if (/sandbox|runner/i.test(kind)) return "bg-info";
563 if (/deploy|domain/i.test(kind)) return "bg-fg-soft";
564 if (/storage|git|cache|package/i.test(kind)) return "bg-muted";
565 return "bg-faint";
566}
567
568const utcDay = (day: string) => new Intl.DateTimeFormat("en-US", { month: "short", day: "numeric", timeZone: "UTC" }).format(Date.parse(`${day}T12:00:00Z`));
569
570export function SpendCard({ spend, slug, span }: { spend: Spend | null; slug: string; span: Pick<Span, "key" | "note" | "words"> }) {
571 return (
572 <Card title="Spent" link={{ label: "Billing", to: `/${slug}/-/billing` }}>
573 {!spend ? (
574 <Quiet>Billing didn&apos;t answer, so spend can&apos;t be shown right now.</Quiet>
575 ) : (
576 <div className="px-5 pb-5">
577 <div className="text-3xl font-semibold tracking-tight text-fg tabular-nums">{money(spend.totalMicros)}</div>
578 <p className="mt-1 text-xs text-muted">
579 {spend.from === spend.to ? utcDay(spend.from) : `${utcDay(spend.from)} – ${utcDay(spend.to)}`}
580 {spend.monthMicros != null && ` · ${money(spend.monthMicros)} this month so far`}
581 </p>
582 {spend.lines.length === 0 ? (
583 <p className="mt-4 text-sm text-muted">Nothing on the statement {inSpan(span)}.</p>
584 ) : (
585 <>
586 <div className="mt-4 flex h-2.5 gap-0.5 overflow-hidden rounded-full" role="img" aria-label="Spend by kind of charge">
587 {spend.lines.map((line) => (
588 <span key={line.kind} className={`h-full min-w-0.75 ${kindColour(line.kind)}`} style={{ flexGrow: line.micros }} />
589 ))}
590 </div>
591 <ul className="mt-3 space-y-2">
592 {spend.lines.map((line) => (
593 <li key={line.kind} className="flex items-center gap-2 text-sm">
594 <span className={`size-2 shrink-0 rounded-xs ${kindColour(line.kind)}`} aria-hidden />
595 <span className="min-w-0 grow truncate text-fg-soft">{line.kind}</span>
596 <span className="text-fg tabular-nums">{money(line.micros)}</span>
597 </li>
598 ))}
599 </ul>
600 </>
601 )}
602 <p className="mt-4 text-[0.6875rem] leading-relaxed text-faint">
603 At price, as your statement shows it. The statement keeps whole days, midnight to midnight UTC, so this counts from the start of the day the span began.
604 </p>
605 </div>
606 )}
607 </Card>
608 );
609}
610
611export function SpendSkeleton() {
612 return (
613 <div className="space-y-3 px-5 pb-5" aria-busy="true">
614 <Skeleton className="h-8 w-28" />
615 <Skeleton className="h-2.5 w-full rounded-full" />
616 <Skeleton className="h-3 w-3/4" />
617 <Skeleton className="h-3 w-2/3" />
618 </div>
619 );
620}
621
622// --- Running now -------------------------------------------------------------------
623
624const RUNNING_ICON: Record<RunningRow["kind"], ReactNode> = {
625 workflow: <Workflow size={15} className="text-info" />,
626 deploy: <Rocket size={15} className="text-info" />,
627};
628
629export function RunningList({ rows, missing, now }: { rows: RunningRow[]; missing: string[]; now: number }) {
630 return (
631 <>
632 {rows.length === 0 ? (
633 <Quiet>{missing.length > 0 ? "Nothing is running in what could be read." : "Nothing is running. Workflow runs and builds show here while they go."}</Quiet>
634 ) : (
635 <Folded
636 items={rows}
637 render={(row) => (
638 <li key={row.key} className={rowClass}>
639 <span className="shrink-0">{RUNNING_ICON[row.kind]}</span>
640 <div className="min-w-0 grow">
641 <Link to={row.to} className="block truncate text-sm text-fg hover:underline">
642 {row.title}
643 </Link>
644 <p className="truncate text-xs text-muted">{row.detail}</p>
645 </div>
646 <span className="inline-flex shrink-0 items-center gap-1.5 rounded-full bg-raised px-2 py-0.5 text-xs text-fg-soft">
647 <Loader size={11} className="animate-spin text-accent motion-reduce:animate-none" aria-hidden />
648 {row.status}
649 </span>
650 <span className="hidden w-14 shrink-0 text-right text-xs text-faint tabular-nums sm:inline" suppressHydrationWarning>
651 {waited(row.at, now)}
652 </span>
653 </li>
654 )}
655 />
656 )}
657 <Missing names={missing} what="everything running" />
658 </>
659 );
660}