Dense controls, lists and styles for admin screens.
Automations
env_…ZK4M8Q2
Workflows running in production.
- Environment
- Production
- Schedule
- Hourly, 09:00 to 18:00 UTC
| Workflow | Started | Status |
|---|---|---|
| Daily digest | 09:00 | Running |
| Document index | 08:30 | Idle |
| Invoice sync | 08:00 | Failed |
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { Chip, DataTable, Description, DescriptionList, PageHeader } from "./ui/uicontext/components/compact-dashboard/collection.ts"import { Button, Field, Select } from "./ui/uicontext/components/compact-dashboard/controls.ts"import { sx } from "./ui/uicontext/components/compact-dashboard/sx.ts"import { color, font, space } from "./ui/uicontext/components/compact-dashboard/tokens.stylex.ts"const styles = stylex.create({ dashboard: { display: "grid", gap: space.page, padding: space.page, minWidth: 0, backgroundColor: color.background, color: color.foreground, fontFamily: font.sans }, tools: { display: "flex", flexWrap: "wrap", gap: space.md, alignItems: "end" }, filter: { width: "10rem" },})const Status = Schema.Literals(["All", "Running", "Idle", "Failed"])const Message = UiSchema.TaggedEnum({ ChangedStatus: { status: Status }, ClickedReset: {} })const runs = [ { id: "run_01HZK4", title: "Daily digest", status: "Running", started: "09:00" }, { id: "run_01HZK3", title: "Document index", status: "Idle", started: "08:30" }, { id: "run_01HZK2", title: "Invoice sync", status: "Failed", started: "08:00" },] as constconst tone = { Running: "green", Idle: "gray", Failed: "red" } as constexport const OpsDashboard = Html.component({ name: "OpsDashboard", model: Schema.Struct({ status: Status }), message: Message,}).make({ init: () => ({ status: "All" }), update: { ChangedStatus: ($, { status }) => $.evolve({ status }), ClickedReset: ($) => $.evolve({ status: "All" }), }, view: (h, { status }) => h.div.attrs(sx(styles.dashboard)).children( PageHeader(h, { title: "Automations", id: "env_01HZK4M8Q2", description: "Workflows running in production." }), DescriptionList(h, [...Description(h, "Environment", ["Production"]), ...Description(h, "Schedule", ["Hourly, 09:00 to 18:00 UTC"])]), h.div.attrs(sx(styles.tools)).children( Field(h, { id: "ops-status", label: "Status", style: styles.filter }, (attrs) => [ Select(h).attrs(attrs).value(status).on("change", ({ value }) => Schema.is(Status)(value) ? Message.ChangedStatus({ status: value }) : undefined, ).children(Status.literals.map((option) => h.option.key(option).attr("value", option).children(option))), ]), Button(h, { variant: "outline" }).disabled(status === "All").on("click", Message.ClickedReset()).children("Reset"), ), DataTable(h, { label: "Runs", rows: runs.filter((run) => status === "All" || run.status === status), rowKey: ({ id }) => id, columns: [ { key: "title", heading: "Workflow", cell: ({ title }) => title }, { key: "started", heading: "Started", cell: ({ started }) => started }, { key: "status", heading: "Status", cell: (run) => Chip(h, run.status, tone[run.status], run.status === "Running") }, ], empty: "No runs match this status.", }), ),})Installation
pnpm dlx shadcn@latest add checkfu/uicontext/compact-dashboardUsage
import { Chip, DataTable } from "./ui/uicontext/components/compact-dashboard/collection.ts"const runs = [{ id: "run_001", title: "Daily digest", status: "Running" }]export const RunsTable = <M>(h: Html.H<M>) => DataTable(h, { label: "Recent runs", rows: runs, rowKey: (run) => run.id, columns: [ { key: "title", heading: "Workflow", cell: (run) => run.title }, { key: "status", heading: "Status", cell: (run) => Chip(h, run.status, "green", true) }, ], empty: "No runs yet.", })API reference
PageHeaderView function
Options
| Name | Type | Description |
|---|---|---|
id | string | The record's id, shown short under the title with a button that copies it in full |
DataTableView function
Options
| Name | Type | Description |
|---|---|---|
rowsrequired | Row[] | The rows to show, in order |
rowKeyrequired | (row: Row) => string | A stable key for each row |
columnsrequired | Column<Row, Message>[] | Each column's key, heading, cell and optional style |
emptyrequired | string | What the table says when there are no rows |
label | string | What the table lists, read as its name: "Recent runs" |
Accessibility
- Tables have a header row with
scope="col", and fields tie their label, description and error to the control.