diff --git a/ui/src/components/runDetail.test.ts b/ui/src/components/runDetail.test.ts index 85913c3e..26c55af7 100644 --- a/ui/src/components/runDetail.test.ts +++ b/ui/src/components/runDetail.test.ts @@ -29,7 +29,7 @@ describe("cellShade", () => { expect(cellShade(0, false).background).toContain("--bad) 0%"); }); it("uses white text only on a strong diagonal", () => { - expect(cellShade(0.8, true).color).toBe("var(--mantine-color-white)"); + expect(cellShade(0.8, true).color).toBe("var(--inverse-ink)"); expect(cellShade(0.8, false).color).toBe("var(--text-primary)"); expect(cellShade(0.3, true).color).toBe("var(--text-primary)"); }); diff --git a/ui/src/kit/ErrorAlert.tsx b/ui/src/kit/ErrorAlert.tsx index 6c1aca14..471f54bd 100644 --- a/ui/src/kit/ErrorAlert.tsx +++ b/ui/src/kit/ErrorAlert.tsx @@ -1,10 +1,29 @@ /** The one way to show a failed request: the message plus the API's per-field details. */ import type { ReactNode } from "react"; -import { Alert, List } from "@mantine/core"; +import { Alert, Box, List } from "@mantine/core"; import { describeError } from "../toast"; -export function ErrorAlert({ error, title, children }: { error: unknown; title?: string; children?: ReactNode }) { +export function ErrorAlert({ + error, + title, + children, + page, +}: { + error: unknown; + title?: string; + children?: ReactNode; + /** The whole page failed: the alert sits inside the page's padding instead of edge to edge under the bar. */ + page?: boolean; +}) { if (!error) return null; + if (page) + return ( + + + {children} + + + ); const e = error as { message?: string; details?: string[] }; return ( diff --git a/ui/src/kit/JobStatus.tsx b/ui/src/kit/JobStatus.tsx index 1c1aa5a6..26c38533 100644 --- a/ui/src/kit/JobStatus.tsx +++ b/ui/src/kit/JobStatus.tsx @@ -38,7 +38,15 @@ export function JobStatus({ const pct = progress == null ? null : Math.round(Math.max(0, Math.min(1, progress)) * 100); return ( - + {look.label} {live && ( diff --git a/ui/src/pages/batch/BatchPage.tsx b/ui/src/pages/batch/BatchPage.tsx index 1c0adc45..5b88a9c4 100644 --- a/ui/src/pages/batch/BatchPage.tsx +++ b/ui/src/pages/batch/BatchPage.tsx @@ -18,6 +18,7 @@ import { oneVsRestValues, } from "../../batches"; import { BatchDialog } from "../experiment/BatchDialog"; +import { Page } from "../experiment/Page"; import { useDatasetContext } from "../../components/DatasetLayout"; import { ErrorAlert } from "../../kit"; import { batchDeployment } from "../../deployments"; @@ -177,25 +178,27 @@ function BatchView() { if (batch.error && !b) { const missing = (batch.error as { status?: number }).status === 404; return ( - - {missing ? ( - + + + {missing ? ( + + Back to the runs + + } + /> + ) : ( + + + - } - /> - ) : ( - - - - - )} - + + )} + + ); } if (!b || !registration) return ; diff --git a/ui/src/pages/batch/common.tsx b/ui/src/pages/batch/common.tsx index 44c9a020..f1ccb143 100644 --- a/ui/src/pages/batch/common.tsx +++ b/ui/src/pages/batch/common.tsx @@ -15,6 +15,9 @@ const LOOK: Record + {children ?? look.label} ); diff --git a/ui/src/pages/connections/ConnectionPage.tsx b/ui/src/pages/connections/ConnectionPage.tsx index 2bc07a0d..8f08b713 100644 --- a/ui/src/pages/connections/ConnectionPage.tsx +++ b/ui/src/pages/connections/ConnectionPage.tsx @@ -354,10 +354,19 @@ export function ConnectionPage() { enabled: cid !== null, }); const c = q.data ?? null; - const readOnlyBar = useMemo(() => ({ title: c?.name ?? "Connection", subtitle: c ? "Connection" : undefined }), [c]); - usePageBar(readOnlyBar, c !== null && !c.can.manage); + const kind = params.get("kind") as ConnectionKind | null; + // The editor sets its own bar; every other state (read-only, no kind chosen, not an owner) shows this one. + const noEditor = + cid === null ? !kind || !KINDS.includes(kind) || (!instanceMode && (all || role !== "owner")) : false; + const readOnlyBar = useMemo( + () => ({ + title: c?.name ?? (cid === null ? "New connection" : "Connection"), + subtitle: c ? "Connection" : undefined, + }), + [c, cid], + ); + usePageBar(readOnlyBar, (c !== null && !c.can.manage) || noEditor); if (cid === null) { - const kind = params.get("kind") as ConnectionKind | null; if (!kind || !KINDS.includes(kind)) return Start from Connections, New connection.; if (instanceMode) return ; @@ -365,7 +374,7 @@ export function ConnectionPage() { return Open a project you own.; return ; } - if (q.error) return ; + if (q.error) return ; if (!c) return {""}; if (c.can.manage) return ; diff --git a/ui/src/pages/connections/ConnectionsPage.tsx b/ui/src/pages/connections/ConnectionsPage.tsx index 1077303f..5a01e049 100644 --- a/ui/src/pages/connections/ConnectionsPage.tsx +++ b/ui/src/pages/connections/ConnectionsPage.tsx @@ -138,7 +138,7 @@ export function ConnectionsPage() { cell: (c) => fmtInt(c.datasets), }, ]; - if (list.error) return ; + if (list.error) return ; const rows = list.data ?? []; return ( diff --git a/ui/src/pages/data/CompositionPage.tsx b/ui/src/pages/data/CompositionPage.tsx index dfc96fbf..2089568b 100644 --- a/ui/src/pages/data/CompositionPage.tsx +++ b/ui/src/pages/data/CompositionPage.tsx @@ -139,7 +139,7 @@ export function CompositionPage({ id: given }: { id?: number } = {}) { [c?.name, c?.version, c?.status, c?.dataset_id, c?.created_at, owner], ); usePageBar(bar); - if (q.error) return ; + if (q.error) return ; if (!c) return null; const used = c.used_by; return ( diff --git a/ui/src/pages/data/DataPage.tsx b/ui/src/pages/data/DataPage.tsx index c4dee8d3..a8954a21 100644 --- a/ui/src/pages/data/DataPage.tsx +++ b/ui/src/pages/data/DataPage.tsx @@ -183,7 +183,7 @@ export function DataPage() { secondary: editor ? [{ label: "Compose…", to: projectPath(target.project ?? slug, "/data/compose") }] : [], children: editor || target.choosing ? ( - + {editor && ( <> diff --git a/ui/src/pages/endpoints/EndpointPage.tsx b/ui/src/pages/endpoints/EndpointPage.tsx index 28e02619..b636ffd3 100644 --- a/ui/src/pages/endpoints/EndpointPage.tsx +++ b/ui/src/pages/endpoints/EndpointPage.tsx @@ -184,7 +184,7 @@ export function EndpointPage() { [e, member, change, at], ); usePageBar(spec); - if (q.error) return ; + if (q.error) return ; if (!e) return null; const origin = typeof window === "undefined" ? "" : window.location.origin; const look = ENDPOINT_LOOK[e.status]; diff --git a/ui/src/pages/evaluations/EvaluationPage.tsx b/ui/src/pages/evaluations/EvaluationPage.tsx index f69c6528..52f60118 100644 --- a/ui/src/pages/evaluations/EvaluationPage.tsx +++ b/ui/src/pages/evaluations/EvaluationPage.tsx @@ -52,7 +52,7 @@ export function EvaluationPage() { [e, version.data, at], ); usePageBar(spec); - if (q.error) return ; + if (q.error) return ; if (!e) return null; const binary = (e.columns?.labels?.length ?? 0) > 0 && version.data?.models.some((m) => m.kind === "binary") === true; const target = e.columns?.label_field ?? (version.data ? targetOf(version.data) : "the target"); diff --git a/ui/src/pages/experiment/RunsTable.tsx b/ui/src/pages/experiment/RunsTable.tsx index 796e6f2e..7f0d35ee 100644 --- a/ui/src/pages/experiment/RunsTable.tsx +++ b/ui/src/pages/experiment/RunsTable.tsx @@ -268,7 +268,7 @@ export function RunsTable({ )} {(r.report?.hardware?.device_used ?? r.report?.device ?? r.config?.device)?.startsWith("cuda") ? ( - + GPU ) : ( diff --git a/ui/src/pages/models/ModelPage.tsx b/ui/src/pages/models/ModelPage.tsx index fe6956d3..4853057f 100644 --- a/ui/src/pages/models/ModelPage.tsx +++ b/ui/src/pages/models/ModelPage.tsx @@ -207,7 +207,7 @@ export function ModelPage() { [m, member, owner, removeModel, at], ); usePageBar(spec); - if (q.error) return ; + if (q.error) return ; if (!m) return null; const versions = m.versions; return ( diff --git a/ui/src/pages/models/ModelsPage.tsx b/ui/src/pages/models/ModelsPage.tsx index 7530475e..64fd7dff 100644 --- a/ui/src/pages/models/ModelsPage.tsx +++ b/ui/src/pages/models/ModelsPage.tsx @@ -164,7 +164,7 @@ export function ModelsPage() { width: 140, }, ]; - if (list.error) return ; + if (list.error) return ; return ( ; + if (model.error) return ; if (!model.data) return null; if (!v) return ; const o = v.origin; diff --git a/ui/src/pages/runs/detail/ConfusionTable.tsx b/ui/src/pages/runs/detail/ConfusionTable.tsx index ba90e593..31be63fb 100644 --- a/ui/src/pages/runs/detail/ConfusionTable.tsx +++ b/ui/src/pages/runs/detail/ConfusionTable.tsx @@ -9,9 +9,12 @@ import type { TargetEvaluation } from "../../../types"; * the error colour, so mistakes stand out from near-empty cells. */ export function cellShade(share: number, diag: boolean): { background: string; color: string } { const pct = Math.round(Math.min(1, Math.max(0, share)) * 100); + const mix = diag ? pct : Math.round(pct * 0.8); return { - background: `color-mix(in srgb, var(${diag ? "--series-1" : "--bad"}) ${diag ? pct : Math.round(pct * 0.8)}%, var(--surface-1))`, - color: diag && share > 0.55 ? "var(--mantine-color-white)" : "var(--text-primary)", + background: `color-mix(in srgb, var(${diag ? "--series-1" : "--bad"}) ${mix}%, var(--surface-1))`, + // Past about three quarters the cell is the full colour: dark in Day, bright in Night, so the ink flips with the + // scheme (white in Day, black in Night); below it the ordinary text reads in both. + color: mix > 75 ? "var(--inverse-ink)" : "var(--text-primary)", }; } diff --git a/ui/src/theme/mantine.ts b/ui/src/theme/mantine.ts index 7ea00d4f..5b19347f 100644 --- a/ui/src/theme/mantine.ts +++ b/ui/src/theme/mantine.ts @@ -261,6 +261,16 @@ function scheme(side: "light" | "dark"): Record { "--mantine-color-warn-light-color": c.warn[side], "--mantine-color-bad-light": c["bad-weak"][side], "--mantine-color-bad-light-color": c.bad[side], + // Neutral chips (gray light) sit on the hover ground, so they read on white cards, the page and the sidebar in + // both schemes; Mantine's own dark value (gray 9 darkened) was the card colour itself. Outlines take the 3:1 + // control border, and coloured outlines the token, not a near-white tint of the dark ramp. + "--mantine-color-gray-light": c["surface-hover"][side], + "--mantine-color-gray-light-hover": c.border[side], + "--mantine-color-gray-outline": c["border-strong"][side], + "--mantine-color-accent-outline": c.accent[side], + "--mantine-color-good-outline": c.good[side], + "--mantine-color-warn-outline": c.warn[side], + "--mantine-color-bad-outline": c.bad[side], // A filled danger button needs white on it: the strong (Day) orange in both schemes. "--mantine-color-bad-filled": c.bad.light, "--mantine-color-bad-filled-hover": "#8a2f12",