-
-
-
+
+ |
+
+ {incident.identifier}{" "}
+ {incident.title}
+
+ |
+
+
{incident.kind === "maintenance" && incident.scheduledStart !== null ? (
-
+ <>
Starts{" "}
-
+ >
) : (
-
+ <>
Open{" "}
-
+ >
)}
-
-
-
+ |
+
+ );
+}
+
+function HomeGroup({
+ label,
+ incidents,
+ emptyText,
+ nowMs,
+}: {
+ readonly label: string;
+ readonly incidents: readonly IncidentSummary[];
+ readonly emptyText: string;
+ readonly nowMs: number;
+}): React.JSX.Element {
+ return (
+
+
+ |
+ {label}
+ {incidents.length}
+ |
+
+ {incidents.length === 0 ? (
+
+ | {emptyText} |
+
+ ) : (
+ incidents.map((incident) => (
+
+ ))
+ )}
+
);
}
@@ -74,38 +98,23 @@ export function HomeCardView({
const open = sorted.filter((incident) => incident.kind === "incident");
const windows = sorted.filter((incident) => incident.kind === "maintenance");
return (
-
-
-
-
- Open incidents
-
- {open.length === 0 ? (
-
No open incidents.
- ) : (
-
- {open.map((incident) => (
-
- ))}
-
- )}
-
-
-
-
- Maintenance windows
-
- {windows.length === 0 ? (
-
No maintenance scheduled or underway.
- ) : (
-
- {windows.map((incident) => (
-
- ))}
-
- )}
-
-
+
When}
+ >
+
+
+
);
}
@@ -116,10 +125,7 @@ export function IncidentsHomeCard(): React.JSX.Element {
useIncidentStream(null, Loaded.getOrElse(incidents, null) !== null);
const nowMs = useNow();
return (
-
-
- Incidents
-
+ Incidents}>
Loading incidents…}
@@ -140,6 +146,6 @@ export function IncidentsHomeCard(): React.JSX.Element {
>
)}
-
+
);
}
diff --git a/packages/incidents/src/client/incidents.css b/packages/incidents/src/client/incidents.css
index 37b1ba14ba..1cc6c5823b 100644
--- a/packages/incidents/src/client/incidents.css
+++ b/packages/incidents/src/client/incidents.css
@@ -1,723 +1,83 @@
/*
- * Hub's incident pages. Colours are console-ui tokens (`--ui-*`). A page is
- * the shared header bar, edge to edge, then the body below it inset by the
- * console gutter. Layout adapts to Hub's `content` container, not the
- * viewport.
+ * Layout for Hub's incident pages. Everything visual (header bar, sections,
+ * tables, glyphs, chips, banners, dialogs, fields) comes from console-ui;
+ * this file only places form fields and lists that the shared package has no
+ * piece for.
*/
-.inc-page {
+.inc-stack,
+.inc-fields {
display: grid;
+ gap: var(--ui-space-3);
min-width: 0;
}
-.inc-body {
- display: grid;
- gap: 16px;
- min-width: 0;
- padding: var(--ui-space-4) var(--ui-gutter) var(--ui-space-6);
+.inc-fields {
+ padding-inline: var(--ui-gutter);
}
-.inc-acting {
- margin: -6px 0 0;
- color: var(--ui-muted);
- font-size: 12.5px;
+.inc-form {
+ padding-block: var(--ui-space-4);
}
-.inc-acting strong {
- color: var(--ui-ink);
- font-weight: 600;
+.inc-declare {
+ max-width: 54rem;
}
-/* ---- View links (Open, Maintenance, History) ---- */
-.inc-views {
+.inc-row {
display: flex;
flex-wrap: wrap;
- gap: 4px 18px;
- border-bottom: 1px solid var(--ui-line);
-}
-
-.inc-view {
- margin-bottom: -1px;
- padding: 6px 0 9px;
- border-bottom: 2px solid transparent;
- color: var(--ui-muted);
- font-weight: 500;
- text-decoration: none;
-}
-
-.inc-view:hover {
- color: var(--ui-ink);
-}
-
-.inc-view[aria-current="page"] {
- border-bottom-color: var(--ui-accent);
- color: var(--ui-ink);
-}
-
-/* ---- Live indicator ---- */
-.inc-live {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- min-width: 0;
- max-width: 100%;
- margin: 0;
- color: var(--ui-muted);
- font-size: 12.5px;
-}
-
-.inc-live svg {
- flex: none;
- color: var(--ui-faint);
-}
-
-.inc-live[data-connected] svg {
- color: var(--ui-sev-ok);
-}
-
-.inc-live-text {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-/* ---- Panels ---- */
-.inc-panel {
- min-width: 0;
- border: 1px solid var(--ui-line);
- border-radius: 10px;
- background: var(--ui-panel);
- overflow: clip;
-}
-
-.inc-panel-title {
- margin: 0;
- padding: 16px 20px 9px;
-}
-
-.inc-empty {
- margin: 0;
- padding: 0 20px 16px;
- color: var(--ui-muted);
-}
-
-.inc-calm {
- color: var(--ui-sev-ok-text);
-}
-
-.inc-notice {
- padding: 10px 14px;
- border: 1px solid color-mix(in srgb, var(--ui-sev) 40%, var(--ui-panel));
- border-radius: 8px;
- background: color-mix(in srgb, var(--ui-sev) 10%, var(--ui-panel));
- color: var(--ui-sev-ink);
- font-weight: 500;
-}
-
-/* ---- Badges ---- */
-.inc-sev {
- display: inline-block;
- padding: 1px 7px;
- border: 1px solid color-mix(in srgb, var(--ui-sev) 45%, var(--ui-panel));
- border-radius: 5px;
- background: color-mix(in srgb, var(--ui-sev) 12%, var(--ui-panel));
- color: var(--ui-sev-ink);
- font-family: var(--ui-font-mono);
- font-size: 11.5px;
- font-weight: 700;
- letter-spacing: 0.02em;
- white-space: nowrap;
-}
-
-.inc-systems {
- display: inline-flex;
- flex-wrap: wrap;
- gap: 4px;
-}
-
-.inc-system,
-.inc-kind,
-.inc-link-kind {
- display: inline-block;
- padding: 0 6px;
- border: 1px solid var(--ui-line);
- border-radius: 4px;
- color: var(--ui-ink-2);
- font-size: 12px;
- line-height: 20px;
- white-space: nowrap;
-}
-
-.inc-kind {
- margin-top: 4px;
- color: var(--ui-muted);
-}
-
-.inc-command {
- display: inline-grid;
- gap: 2px;
- min-width: 0;
- white-space: normal;
-}
-
-.inc-command-detail {
- color: var(--ui-muted);
- font-size: 12px;
-}
-
-/* ---- Filters and tables ---- */
-.inc-filters {
+ gap: var(--ui-space-3);
align-items: end;
- border-top: 1px solid var(--ui-line-soft);
-}
-
-.inc-filter {
- display: grid;
- gap: 4px;
- color: var(--ui-muted);
- font-size: 12px;
-}
-
-.inc-filter select {
- min-width: 9rem;
-}
-
-/* The wrapper is the size container, so a table stacks by its own width:
- the list stacks on a phone, the signals table in the narrow side column. */
-.inc-table-wrap {
- container: inc-table / inline-size;
- overflow-x: auto;
- max-inline-size: 100%;
-}
-
-.inc-table-wrap:focus-visible {
- outline: 2px solid var(--ui-accent);
- outline-offset: -2px;
-}
-
-/* Hub's global table rules set mono, 0.77rem, and uppercase row headers;
- the incident tables read as prose with mono only for ids and numbers. */
-.inc-table {
- font-family: var(--ui-font-sans);
- font-size: 13px;
-}
-
-.inc-table tbody th {
- color: var(--ui-ink);
- font-size: inherit;
- text-transform: none;
- letter-spacing: normal;
- background: none;
-}
-
-.inc-table td {
- height: auto;
- padding-block: 8px;
- vertical-align: top;
}
-.inc-table th.inc-lead {
- min-width: 18rem;
- padding-block: 8px;
- border-bottom: 1px solid var(--ui-line-soft);
- white-space: normal;
- vertical-align: top;
-}
-
-.inc-table tr[data-open="false"] .inc-title {
- color: var(--ui-muted);
-}
-
-.inc-row-link {
- display: grid;
- gap: 1px;
- color: var(--ui-ink);
- text-decoration: none;
-}
-
-.inc-row-link:hover .inc-title {
- color: var(--ui-accent);
- text-decoration: underline;
-}
-
-.inc-id {
- color: var(--ui-muted);
- font-family: var(--ui-font-mono);
- font-size: 12px;
-}
-
-.inc-title {
- font-weight: 600;
- overflow-wrap: anywhere;
-}
-
-.inc-key {
- display: block;
- color: var(--ui-muted);
- overflow-wrap: anywhere;
-}
-
-/* Narrow table: each row becomes a card whose cells carry their label. */
-@container inc-table (max-width: 720px) {
- .inc-table,
- .inc-table tbody,
- .inc-table tr,
- .inc-table th,
- .inc-table td {
- display: block;
- }
-
- .inc-table thead {
- display: none;
- }
-
- .inc-table tr {
- padding: 10px 16px;
- border-bottom: 1px solid var(--ui-line);
- }
-
- .inc-table :is(th, td),
- .inc-table :is(th, td):first-child,
- .inc-table :is(th, td):last-child {
- height: auto;
- min-width: 0;
- padding: 3px 0;
- border: 0;
- text-align: left;
- white-space: normal;
- }
-
- .inc-table th.inc-lead {
- min-width: 0;
- padding-bottom: 6px;
- border: 0;
- }
-
- .inc-table td {
- display: grid;
- grid-template-columns: 7.5rem minmax(0, 1fr);
- gap: 8px;
- align-items: baseline;
- }
-
- .inc-table td > * {
- justify-self: start;
- }
-
- .inc-table td::before {
- content: attr(data-label);
- color: var(--ui-muted);
- font-family: var(--ui-font-sans);
- font-size: 12px;
- }
-
- .inc-table tbody tr:hover td {
- background: none;
- }
-}
-
-/* ---- Detail ---- */
-.inc-detail {
- display: grid;
- gap: 16px;
- min-width: 0;
-}
-
-.inc-detail-grid {
- display: grid;
- grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
- gap: 16px;
- align-items: start;
-}
-
-.inc-detail-main,
-.inc-detail-side {
- display: grid;
- gap: 16px;
+.inc-grow {
+ flex: 1 1 12rem;
min-width: 0;
}
-@container content (max-width: 1000px) {
- .inc-detail-grid {
- grid-template-columns: minmax(0, 1fr);
- }
-}
-
-.inc-fact-grid {
+.inc-choice-grid {
display: grid;
- grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
- gap: 12px 20px;
- margin: 0;
- padding: 0 20px 14px;
-}
-
-.inc-fact {
- min-width: 0;
-}
-
-.inc-fact dt {
- color: var(--ui-muted);
- font-size: 12px;
-}
-
-.inc-fact dd {
- margin: 2px 0 0;
- overflow-wrap: anywhere;
+ grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
+ gap: var(--ui-space-2) var(--ui-space-3);
}
+/* Prose the author wrote keeps its line breaks. */
.inc-prose {
- padding: 0 20px 16px;
- border-top: 1px solid var(--ui-line-soft);
-}
-
-.inc-prose h3 {
- margin: 14px 0 4px;
-}
-
-.inc-prose p {
- margin: 0;
- color: var(--ui-ink);
- white-space: pre-wrap;
overflow-wrap: anywhere;
-}
-
-.inc-exit {
- padding-left: 10px;
- border-left: 3px solid var(--ui-accent);
-}
-
-.inc-command-panel .inc-command-body {
- display: grid;
- gap: 6px;
- padding: 0 20px 4px;
-}
-
-.inc-command-body p {
- margin: 0;
- font-size: 12.5px;
-}
-
-.inc-actions {
- padding-top: 8px;
-}
-
-.inc-inline-form {
- display: grid;
- gap: 8px;
- padding: 12px 20px 16px;
- border-top: 1px solid var(--ui-line-soft);
-}
-
-.inc-inline-form h3 {
- margin: 0;
-}
-
-.inc-form-row {
- display: flex;
- flex-wrap: wrap;
- gap: 10px;
- align-items: end;
-}
-
-.inc-form-row > div {
- min-width: 0;
-}
-
-.inc-grow {
- flex: 1 1 12rem;
-}
-
-.inc-form-actions {
- display: flex;
- flex-wrap: wrap;
- gap: 8px;
- align-items: center;
-}
-
-.inc-page textarea {
- resize: vertical;
+ white-space: pre-wrap;
}
.inc-list {
display: grid;
margin: 0;
- padding: 0 20px 14px;
+ padding: 0 var(--ui-gutter) var(--ui-space-3);
list-style: none;
}
-.inc-list li {
+.inc-list-item {
display: flex;
flex-wrap: wrap;
gap: 4px 10px;
- align-items: baseline;
- padding: 6px 0;
+ align-items: center;
+ min-height: var(--ui-row);
border-bottom: 1px solid var(--ui-line-soft);
overflow-wrap: anywhere;
}
-.inc-list li:last-child {
+.inc-list-item:last-child {
border-bottom: 0;
}
-.inc-list a {
+.inc-link {
display: inline-flex;
- align-items: center;
gap: 4px;
- color: var(--ui-accent);
-}
-
-.inc-list a svg {
- width: 12px;
- height: 12px;
-}
-
-/* ---- Timeline ---- */
-.inc-timeline {
- margin: 0;
- padding: 4px 20px 16px;
- list-style: none;
-}
-
-.inc-event {
- --inc-dot: var(--ui-faint);
- position: relative;
- padding: 0 0 14px 20px;
-}
-
-.inc-event::before {
- position: absolute;
- top: 5px;
- left: 0;
- width: 9px;
- height: 9px;
- border-radius: 50%;
- background: var(--inc-dot);
- content: "";
-}
-
-.inc-event:not(:last-child)::after {
- position: absolute;
- top: 16px;
- bottom: 0;
- left: 4px;
- width: 1px;
- background: var(--ui-line);
- content: "";
-}
-
-.inc-event:is(
- [data-type="claimed"],
- [data-type="resolved"],
- [data-type="signal-cleared"],
- [data-type="handed-off"]
-) {
- --inc-dot: var(--ui-sev-ok);
-}
-
-.inc-event:is([data-type="signal-firing"], [data-type="reopened"]) {
- --inc-dot: var(--ui-sev-error);
-}
-
-.inc-event:is(
- [data-type="dispatched"],
- [data-type="status-changed"],
- [data-type="update"]
-) {
- --inc-dot: var(--ui-accent);
-}
-
-.inc-event-head {
- display: flex;
- flex-wrap: wrap;
- gap: 2px 10px;
- align-items: baseline;
-}
-
-.inc-event-head time {
- font-size: 12px;
-}
-
-.inc-event-detail,
-.inc-event-body {
- margin: 3px 0 0;
- overflow-wrap: anywhere;
-}
-
-.inc-event-detail {
- color: var(--ui-muted);
- font-size: 12.5px;
-}
-
-.inc-event-body {
- color: var(--ui-ink);
- white-space: pre-wrap;
-}
-
-/* Keep scroll gestures inside the native action modal and its backdrop. */
-.inc-page dialog:modal {
- overscroll-behavior: contain;
-}
-
-.inc-page dialog::backdrop {
- overflow: hidden;
- overscroll-behavior: contain;
-}
-
-.inc-action-description {
- overflow-wrap: anywhere;
-}
-
-.inc-action-error {
- margin: 0;
- color: var(--ui-sev-error-text);
-}
-
-/* ---- Declare ---- */
-.inc-declare {
- display: grid;
- gap: 16px;
- max-width: 54rem;
- padding: 20px;
-}
-
-.inc-fieldset {
- min-width: 0;
- margin: 0;
- padding: 10px 14px 12px;
- border: 1px solid var(--ui-line-soft);
- border-radius: 8px;
-}
-
-.inc-fieldset legend {
- padding: 0 4px;
- color: var(--ui-muted);
- font-size: 12.5px;
-}
-
-.inc-choice {
- display: flex;
- gap: 8px;
- align-items: baseline;
-}
-
-.inc-choice input {
- accent-color: var(--ui-accent);
-}
-
-.inc-choice label {
- padding: 5px 0;
-}
-
-.inc-choice-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
- gap: 0 12px;
-}
-
-.inc-window {
- display: flex;
- flex-wrap: wrap;
- gap: 10px;
-}
-
-.inc-duplicate {
- display: grid;
- gap: 10px;
- padding: 16px 20px;
- border: 1px solid
- color-mix(in srgb, var(--ui-sev-warning) 45%, var(--ui-panel));
- border-radius: 10px;
- background: var(--ui-sev-warning-soft);
-}
-
-.inc-duplicate p {
- margin: 0;
- color: var(--ui-ink-2);
-}
-
-.inc-duplicate-card {
- display: grid;
- gap: 8px;
- padding: 12px 14px;
- border: 1px solid var(--ui-line);
- border-radius: 8px;
- background: var(--ui-panel);
-}
-
-.inc-duplicate-meta,
-.inc-home-meta {
- display: flex;
- flex-wrap: wrap;
- gap: 6px 10px;
align-items: center;
-}
-
-/* ---- Home ---- */
-.inc-home .block-heading a {
- color: inherit;
- text-decoration: none;
-}
-
-.inc-home .block-heading a:hover {
color: var(--ui-accent);
}
-.inc-home-grid {
- display: grid;
- grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
- gap: 14px;
- align-items: start;
-}
-
-@container content (max-width: 900px) {
- .inc-home-grid {
- grid-template-columns: minmax(0, 1fr);
- }
-}
-
-.inc-home-panel {
- padding: 4px 16px 6px;
-}
-
-.inc-home-title {
- display: flex;
- gap: 6px;
- align-items: center;
- margin: 10px 0 6px;
-}
-
-.inc-home-panel .inc-empty {
- padding: 2px 0 10px;
-}
-
-.inc-home-list {
- margin: 0;
- padding: 0;
- list-style: none;
-}
-
-.inc-home-row {
- display: grid;
- gap: 5px;
- padding: 9px 0;
- border-top: 1px solid var(--ui-line-soft);
-}
-
-/* Narrow layouts: a tighter declare form, and keep form text at 16px on touch
- screens so mobile browsers do not zoom into a focused field. */
-@container content (max-width: 720px) {
- .inc-declare {
- padding: 16px;
- }
-}
-
-@media (pointer: coarse) {
- .inc-page :is(select, input, textarea) {
- font-size: max(1rem, 1em);
- }
-
- .inc-page
- :is(select, input:not([type="checkbox"], [type="radio"]), textarea) {
- min-height: var(--ui-hit);
- }
+.inc-link-icon {
+ flex: none;
+ width: 14px;
+ height: 14px;
}
diff --git a/packages/incidents/src/client/list-page.tsx b/packages/incidents/src/client/list-page.tsx
index 636bffe94c..2ed53b7f28 100644
--- a/packages/incidents/src/client/list-page.tsx
+++ b/packages/incidents/src/client/list-page.tsx
@@ -1,9 +1,19 @@
-import { FigureStrip, State, type Figure } from "@shepherdjerred/console-ui";
+import {
+ ButtonLink,
+ Chip,
+ Field,
+ FigureStrip,
+ FilterBar,
+ NavTabs,
+ Section,
+ State,
+ type Figure,
+} from "@shepherdjerred/console-ui";
import { Loaded } from "@shepherdjerred/loaded/index.ts";
import { LoadingBlock } from "@shepherdjerred/loaded/react.tsx";
import { useQuery } from "@tanstack/react-query";
-import { PlusIcon, XIcon } from "lucide-react";
-import { useId, useMemo } from "react";
+import { PlusIcon } from "lucide-react";
+import { useMemo } from "react";
import { Link, useSearchParams } from "react-router";
import {
INCIDENT_SYSTEMS,
@@ -30,12 +40,10 @@ import { useIncidentStream, useNow } from "#client/live.ts";
import { INCIDENTS_BASE_PATH, incidentPath } from "#client/paths.ts";
import {
ActingAs,
- CommandState,
IncidentsHeading,
+ IncidentStateCells,
+ IncidentTableFrame,
LiveStatus,
- SeverityBadge,
- StatusBadge,
- SystemList,
} from "#client/ui.tsx";
import "./incidents.css";
@@ -44,28 +52,15 @@ export type ListPreset = "open" | "maintenance" | "history";
const PRESETS: Readonly<
Record<
ListPreset,
- {
- readonly title: string;
- readonly eyebrow: string;
- readonly filter: ListIncidentsInput;
- }
+ { readonly title: string; readonly filter: ListIncidentsInput }
>
> = {
- open: {
- title: "Open incidents",
- eyebrow: "Incidents · shared-system breakage",
- filter: { state: "open" },
- },
+ open: { title: "Open incidents", filter: { state: "open" } },
maintenance: {
title: "Maintenance",
- eyebrow: "Incidents · planned windows",
filter: { state: "open", kind: "maintenance" },
},
- history: {
- title: "Incident history",
- eyebrow: "Incidents · resolved and completed",
- filter: { state: "resolved" },
- },
+ history: { title: "Incident history", filter: { state: "resolved" } },
};
const StateParamSchema = ListIncidentsInputSchema.shape.state.unwrap();
@@ -153,180 +148,165 @@ const VIEW_LINKS: readonly {
{ preset: "history", label: "History", to: `${INCIDENTS_BASE_PATH}/history` },
];
-/** The three list views, as links: each is its own URL and history entry. */
-export function ViewLinks({
+/** The three list views as route tabs: each is its own URL and history entry. */
+export function ViewTabs({
current,
}: {
readonly current: ListPreset;
}): React.JSX.Element {
return (
-
+
({
+ href: view.to,
+ label: view.label,
+ current: view.preset === current,
+ }))}
+ renderLink={({ href, ...props }) => }
+ />
);
}
export function IncidentTable({
incidents,
nowMs,
- captionId,
+ caption,
}: {
readonly incidents: readonly IncidentSummary[];
readonly nowMs: number;
- readonly captionId: string;
+ /** The table's accessible name. */
+ readonly caption: string;
}): React.JSX.Element {
if (incidents.length === 0)
- return No incidents match these filters.
;
+ return No incidents match these filters.;
return (
-
+
+ Firing
+ |
+
+ Affected
+ |
+
+ Age
+ |
+ >
+ }
>
-
-
-
- | Incident |
- Severity |
- Status |
- Systems |
- Command |
-
- Firing
- |
-
- Affected
- |
-
- Age
+ |
+ {incidents.map((incident) => (
+
+ |
+
+ {incident.identifier}{" "}
+
+ {incident.title}
+
+
+ {incident.kind === "maintenance" ? (
+ <>
+ {" "}
+ {KIND_LABEL.maintenance}
+ >
+ ) : null}
|
+
+
+ {incident.firingSignals}
+ |
+
+ {incident.affectedCount}
+ |
+
+
+ |
-
-
- {incidents.map((incident) => (
-
- |
-
- {incident.identifier}
- {incident.title}
-
- {incident.kind === "maintenance" ? (
- {KIND_LABEL.maintenance}
- ) : null}
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
- {incident.firingSignals}
- |
-
- {incident.affectedCount}
- |
-
-
- |
-
- ))}
-
-
-
+ ))}
+
+
);
}
-function FilterBar({
+type FilterKey = "kind" | "state" | "system";
+
+function ListFilters({
filter,
onChange,
onReset,
- baseId,
+ end,
}: {
readonly filter: ListIncidentsInput;
- readonly onChange: (key: "kind" | "state" | "system", value: string) => void;
+ readonly onChange: (key: FilterKey, value: string) => void;
readonly onReset: (() => void) | null;
- readonly baseId: string;
+ readonly end: React.ReactNode;
}): React.JSX.Element {
return (
-
-
-
-
-
-
-
-
-
-
-
-
-
- {onReset === null ? null : (
-
- )}
-
+
+
+ {(control) => (
+
+ )}
+
+
+ {(control) => (
+
+ )}
+
+
+ {(control) => (
+
+ )}
+
+ >
+ }
+ />
);
}
@@ -341,14 +321,12 @@ function ListPage({ preset }: { readonly preset: ListPreset }) {
const viewerQueryResult = useQuery(viewerQuery());
const viewer = Loaded.fromQueryOutcome(viewerQueryResult);
const nowMs = useNow();
- const baseId = useId();
- const captionId = `${baseId}-caption`;
- const { title, eyebrow } = PRESETS[preset];
+ const { title } = PRESETS[preset];
const hasOverrides = ["kind", "state", "system"].some((key) =>
params.has(key),
);
- const change = (key: "kind" | "state" | "system", value: string) => {
+ const change = (key: FilterKey, value: string) => {
const next = new URLSearchParams(params);
if (value === "") next.delete(key);
else next.set(key, value);
@@ -360,87 +338,77 @@ function ListPage({ preset }: { readonly preset: ListPreset }) {
const stream = useIncidentStream(null, items !== null);
return (
-
+
{`${title} · Hub`}
-
- {items !== null && }
+ }
+ meta={items === null ? undefined : }
+ >
{viewerValue !== undefined && (
- }
>
Declare incident
-
+
)}
-
- {viewerValue !== undefined && (
-
- )}
- {viewer.status === "error" && items !== null && (
-
{
- void viewerQueryResult.refetch();
- }}
- />
- )}
-
- {items !== null && }
-
-
-
- {title}
-
- {items !== null && {items.length}}
-
- {
- setParams(new URLSearchParams(), { replace: true });
- }
- : null
- }
- baseId={baseId}
- />
- Loading incidents…}
- renderError={(errors) => (
- {
- void listQuery.refetch();
- }}
+ {viewer.status === "error" && items !== null && (
+ {
+ void viewerQueryResult.refetch();
+ }}
+ />
+ )}
+ {items !== null && }
+
+ {
+ setParams(new URLSearchParams(), { replace: true });
+ }
+ : null
+ }
+ end={
+ viewerValue === undefined ? undefined : (
+
+ )
+ }
+ />
+ Loading incidents…}
+ renderError={(errors) => (
+ {
+ void listQuery.refetch();
+ }}
+ />
+ )}
+ >
+ {({ incidents: rows }, meta) => (
+ <>
+
- )}
- >
- {({ incidents: rows }, meta) => (
- <>
-
-
- >
- )}
-
-
-
+
+ >
+ )}
+
+
);
}
diff --git a/packages/incidents/src/client/ui.tsx b/packages/incidents/src/client/ui.tsx
index 09730585d0..b8c64e562a 100644
--- a/packages/incidents/src/client/ui.tsx
+++ b/packages/incidents/src/client/ui.tsx
@@ -4,12 +4,19 @@
*/
import {
BackLink,
+ Banner,
Button,
+ Chip,
+ Dialog,
+ DialogClose,
+ Field,
HeaderBar,
+ StatusDot,
StatusGlyph,
+ Textarea,
} from "@shepherdjerred/console-ui";
-import { RadioIcon, type LucideIcon } from "lucide-react";
-import { useCallback, useId, useRef, useState, type ReactNode } from "react";
+import type { LucideIcon } from "lucide-react";
+import { useId, useState, type ReactNode } from "react";
import { Link } from "react-router";
import type {
ActorInput,
@@ -17,6 +24,7 @@ import type {
IncidentKind,
IncidentSeverity,
IncidentStatus,
+ IncidentSummary,
IncidentSystem,
} from "#shared/contract.ts";
import { IncidentsApiError } from "#client/api.ts";
@@ -32,15 +40,16 @@ import {
import { describeFrame, type StreamSnapshot } from "#client/live.ts";
import { INCIDENTS_BASE_PATH } from "#client/paths.ts";
-export function SeverityBadge({
+export function SeverityGlyph({
severity,
}: {
readonly severity: IncidentSeverity;
}): React.JSX.Element {
return (
-
- {SEVERITY_LABEL[severity]}
-
+
);
}
@@ -67,12 +76,80 @@ export function CommandState({
}): React.JSX.Element {
const view = describeCommand(command, nowMs, kind);
return (
-
+ <>
{withDetail && view.detail !== null ? (
- {view.detail}
+ <>
+ {" "}
+ {view.detail}
+ >
) : null}
-
+ >
+ );
+}
+
+/** The severity, status, systems and command cells every incident row shares. */
+export function IncidentStateCells({
+ incident,
+ nowMs,
+}: {
+ readonly incident: IncidentSummary;
+ readonly nowMs: number;
+}): React.JSX.Element {
+ return (
+ <>
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+ >
+ );
+}
+
+/** The scrolling, phone-stacking incident table with its five shared columns. */
+export function IncidentTableFrame({
+ caption,
+ trailingHead,
+ children,
+}: {
+ readonly caption: string;
+ /** Header cells after the shared Incident, Severity, Status, Systems, Command. */
+ readonly trailingHead: ReactNode;
+ readonly children: ReactNode;
+}): React.JSX.Element {
+ return (
+
+
+
+
+ | Incident |
+ Severity |
+ Status |
+ Systems |
+ Command |
+ {trailingHead}
+
+
+ {children}
+
+
);
}
@@ -82,35 +159,36 @@ export function SystemList({
readonly systems: readonly IncidentSystem[];
}): React.JSX.Element {
return (
-
+
{systems.map((system) => (
-
- {systemLabel(system)}
-
+ {systemLabel(system)}
))}
);
}
/**
- * The page's header bar: the title as its ``, the old eyebrow as muted
- * meta at the right, an optional back link before the title, and actions.
+ * The page's header bar: the title as its ``, optional route tabs, muted
+ * meta, an optional back link before the title, and actions.
*/
export function IncidentsHeading({
- eyebrow,
title,
+ meta,
+ tabs,
lead,
children,
}: {
- readonly eyebrow: string;
readonly title: string;
+ readonly meta?: ReactNode;
+ readonly tabs?: ReactNode;
readonly lead?: ReactNode;
readonly children?: ReactNode;
}): React.JSX.Element {
return (
@@ -137,16 +215,16 @@ export function ActingAs({
readonly actor: ActorInput;
}): React.JSX.Element {
return (
-
- Acting as {actorLabel(actor)}
+
+ Acting as {actorLabel(actor)}
{viewer === null ? " (no Tailscale identity on this request)" : null}
-
+
);
}
/**
* The live indicator and the polite live region that announces stream
- * frames. The text is visible, so sighted users see the same update.
+ * frames.
*/
export function LiveStatus({
snapshot,
@@ -154,18 +232,14 @@ export function LiveStatus({
readonly snapshot: StreamSnapshot;
}): React.JSX.Element {
return (
-
-
- {snapshot.connected ? "Live" : "Reconnecting…"}
-
+ <>
+
+
{snapshot.lastFrame === null
? ""
: `Updated ${describeFrame(snapshot.lastFrame)}`}
-
+ >
);
}
@@ -186,9 +260,9 @@ export function Notice({
readonly children: ReactNode;
}): React.JSX.Element {
return (
-
+
{children}
-
+
);
}
@@ -202,16 +276,17 @@ export type ActionDialogProps = {
readonly submitLabel: string;
readonly noteLabel: string;
readonly noteRequired: boolean;
- /** Extra fields rendered above the note. */
+ /** Extra fields rendered above the note; the first of them takes focus. */
readonly children?: ReactNode;
/** Resolve to close the dialog; throw to keep it open with the message. */
readonly onSubmit: (form: FormData) => Promise;
};
/**
- * A command that needs a reason (resolve, reopen, hand off, force) as a
- * native modal `