Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions packages/alert-dashboard/e2e/kit.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { expect, test } from "@playwright/test";

import {
DESKTOP,
expectPagesFitViewport,
gotoLoadedPage,
PHONE,
violations,
} from "./helpers.ts";

/** The console-ui gallery: every shared piece, on a list and a detail page. */
const KIT_PATHS = ["/kit", "/kit/detail"] as const;

test("the gallery opens from the command palette, not the sidebar", async ({
page,
}) => {
await page.setViewportSize(DESKTOP);
await gotoLoadedPage(page, "/");
const sidebar = page.getByRole("navigation", { name: "Primary navigation" });
await expect(sidebar.getByRole("link", { name: /kit/i })).toHaveCount(0);
await page.keyboard.press("ControlOrMeta+k");
const palette = page.getByRole("dialog", { name: "Search and commands" });
await palette.getByRole("combobox").fill("gallery");
await palette
.getByRole("option", { name: "Open the console kit gallery" })
.click();
await expect(page).toHaveURL(/\/kit$/);
await expect(
page.getByRole("heading", { level: 1, name: "Console kit" }),
).toBeVisible();
});

for (const viewport of [PHONE, DESKTOP]) {
test(`the gallery fits ${String(viewport.width)}px without horizontal overflow`, async ({
page,
}) => {
await expectPagesFitViewport(page, viewport, KIT_PATHS);
});
}

for (const colorScheme of ["light", "dark"] as const) {
test(`the gallery and its dialog have zero axe violations in ${colorScheme} mode`, async ({
page,
}) => {
await page.emulateMedia({ colorScheme });
for (const viewport of [DESKTOP, PHONE]) {
await page.setViewportSize(viewport);
for (const path of KIT_PATHS) {
await gotoLoadedPage(page, path);
expect(await violations(page), path).toEqual([]);
}
}
await page.setViewportSize(DESKTOP);
await gotoLoadedPage(page, "/kit");
await page.getByRole("button", { name: "Delete link…" }).click();
const dialog = page.getByRole("dialog", { name: "Delete go/ha?" });
await expect(dialog).toBeVisible();
// Axe reads colours mid-fade as low contrast; wait for the open transition.
await expect(dialog).toHaveCSS("opacity", "1");
expect(await violations(page), "dialog").toEqual([]);
await dialog.getByRole("button", { name: "Cancel" }).click();
await expect(dialog).toHaveCount(0);
await expect(
page.getByRole("button", { name: "Delete link…" }),
).toBeFocused();
});
}

test("a stacked table reads as label and value lines on a phone", async ({
page,
}) => {
await page.setViewportSize(PHONE);
await gotoLoadedPage(page, "/kit");
const status = page
.getByRole("table")
.first()
.locator('td[data-label="Status"]')
.first();
const label = await status.evaluate(
(cell) => getComputedStyle(cell, "::before").content,
);
expect(label).toBe('"Status"');
await expect(page.locator("thead").first()).toHaveCSS("position", "absolute");
});
134 changes: 134 additions & 0 deletions packages/alert-dashboard/src/client/conformance-allowlist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
[
{
"rule": "theme-color",
"file": "index.html",
"count": 3,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "inline-typography",
"file": "src/client/ops/pages/the-storm-page.tsx",
"count": 2,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "inline-typography",
"file": "src/client/ops/service-views/product-analytics-views.tsx",
"count": 1,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "shared-class-patch",
"file": "src/client/promotion/promotion.css",
"count": 15,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "local-copy",
"file": "src/styles/engineering.css",
"count": 2,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "shared-class-patch",
"file": "src/styles/engineering.css",
"count": 1,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "colour-literal",
"file": "src/styles/globals.css",
"count": 2,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "local-copy",
"file": "src/styles/globals.css",
"count": 33,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "shared-class-patch",
"file": "src/styles/globals.css",
"count": 8,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "shared-class-patch",
"file": "src/styles/ledger.css",
"count": 16,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "local-copy",
"file": "src/styles/platform.css",
"count": 2,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "local-copy",
"file": "src/styles/primitives.css",
"count": 3,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "shared-class-patch",
"file": "src/styles/primitives.css",
"count": 15,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "token-redefinition",
"file": "src/styles/primitives.css",
"count": 3,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "local-copy",
"file": "src/styles/product.css",
"count": 2,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "colour-literal",
"file": "src/styles/reports.css",
"count": 2,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "local-copy",
"file": "src/styles/reports.css",
"count": 2,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "shared-class-patch",
"file": "src/styles/signals.css",
"count": 14,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "shared-class-patch",
"file": "src/styles/tables.css",
"count": 11,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "colour-literal",
"file": "src/styles/visuals.css",
"count": 1,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "shared-class-patch",
"file": "src/styles/visuals.css",
"count": 3,
"reason": "Baseline at CU1. Hub moves onto the shared pieces in H1–H4."
},
{
"rule": "deprecated-class",
"file": "src/client/ops/pages/renovate-ranking.tsx",
"count": 1,
"reason": "Native ui-select on the Renovate queue filter (#5272, after the CU1 baseline). The shared Select arrives in CU4; Hub moves onto it in H3/H4."
}
]
11 changes: 11 additions & 0 deletions packages/alert-dashboard/src/client/conformance.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { expect, test } from "vitest";
import { conformanceProblems } from "@shepherdjerred/console-ui/testing";

// console-ui's per-app scan; conformance-allowlist.json may only shrink.
test("follows the console-ui vocabulary", async () => {
expect(
await conformanceProblems(import.meta.dirname, {
also: ["../styles", "../modules", "../components"],
}),
).toEqual([]);
});
11 changes: 11 additions & 0 deletions packages/alert-dashboard/src/client/core-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ const HistoryPage = lazy(async () => {
const module = await import("./history-page.tsx");
return { default: module.HistoryPage };
});
// The console-ui gallery: reachable from the palette, not the sidebar.
const KitPage = lazy(async () => {
const module = await import("./kit/kit-page.tsx");
return { default: module.KitPage };
});
const KitDetailPage = lazy(async () => {
const module = await import("./kit/kit-detail-page.tsx");
return { default: module.KitDetailPage };
});
const SystemPage = lazy(async () => {
const module = await import("./system-page.tsx");
return { default: module.SystemPage };
Expand Down Expand Up @@ -156,6 +165,8 @@ export const coreModule: ClientModule = {
{ path: "house", page: HousePage },
{ path: "history", page: HistoryPage },
{ path: "system", page: SystemPage },
{ path: "kit", page: KitPage },
{ path: "kit/detail", page: KitDetailPage },
],
// Entries without a `group` sit under the module title, "Ops".
nav: [
Expand Down
17 changes: 16 additions & 1 deletion packages/alert-dashboard/src/client/core-palette.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import type { OpsFacets } from "@shepherdjerred/ops-model/facets.ts";
import { MailIcon, MonitorIcon, MoonIcon, SunIcon } from "lucide-react";
import {
LayoutTemplateIcon,
MailIcon,
MonitorIcon,
MoonIcon,
SunIcon,
} from "lucide-react";

import { APPS, TOOLS } from "./external-links.ts";
import type {
Expand Down Expand Up @@ -83,6 +89,15 @@ export const coreCommands: readonly ModuleCommand[] = [
navigate("/reports?verdict=attention");
},
},
{
id: "kit",
label: "Open the console kit gallery",
icon: LayoutTemplateIcon,
keywords: ["kit", "gallery", "components", "console-ui", "design"],
run: ({ navigate }) => {
navigate("/kit");
},
},
{
id: "theme:light",
label: "Use light theme",
Expand Down
Loading