Console
Lab and support work on the same tokens at a denser register, with filters, pagination and detail on selection.
The console register
Lab and support screens use the same tokens and components as the rest of Oxidase at a denser register. Density mode="console" sets controls to 32 pixels and tightens rows and cells; type, colors and focus stay the same, so moving between member and staff screens feels like one product.
- Filters sit beside the list they narrow, pagination is always visible, and a record opens beside the list on selection.
- Long lists may keep a sticky header inside a scroll area; everything else scrolls with the page.
A queue
| Ticket | Status | Age | Open |
|---|---|---|---|
| 1042: Hold phase ended early | Open | 2h | |
| 1041: Two-factor code not accepted | Open | 5h | |
| 1039: Export is missing a session | Waiting | 1d | |
| 1036: Change of login email | Waiting | 2d |
Code
"use client";
import { useMemo, useState } from "react";
import {
Button,
DataTable,
Density,
EmptyState,
Field,
FilterChip,
KeyValue,
Pagination,
SearchInput,
SplitView,
Stack,
StatusBadge,
Text,
Toolbar,
type Column,
} from "@oxidase/ui";
type Ticket = { id: string; subject: string; status: "Open" | "Waiting"; age: string };
/* Invented tickets for the example. */
const ALL: Ticket[] = [
{ id: "1042", subject: "Hold phase ended early", status: "Open", age: "2h" },
{ id: "1041", subject: "Two-factor code not accepted", status: "Open", age: "5h" },
{ id: "1039", subject: "Export is missing a session", status: "Waiting", age: "1d" },
{ id: "1036", subject: "Change of login email", status: "Waiting", age: "2d" },
];
const columns: Column<Ticket>[] = [
{ key: "subject", header: "Ticket", cell: (row) => `${row.id}: ${row.subject}`, primary: true },
{ key: "status", header: "Status", cell: (row) => <StatusBadge tone={row.status === "Open" ? "indicator" : "warning"}>{row.status}</StatusBadge> },
{ key: "age", header: "Age", cell: (row) => row.age, align: "end" },
];
/** A support queue in the console register: filters beside the list, visible pagination, detail on selection. */
export function QueueDemo() {
const [waitingOnly, setWaitingOnly] = useState(false);
const [query, setQuery] = useState("");
const [open, setOpen] = useState<string | null>(null);
const rows = useMemo(
() =>
ALL.filter((ticket) => (!waitingOnly || ticket.status === "Waiting") && ticket.subject.toLowerCase().includes(query.toLowerCase())),
[waitingOnly, query],
);
const ticket = rows.find((row) => row.id === open) ?? null;
return (
<Density mode="console">
<Stack gap="s12">
<Toolbar
label="Queue filters"
start={
<>
<Field label="Search tickets" labelHidden>
<SearchInput placeholder="Search tickets" value={query} onChange={(event) => setQuery(event.currentTarget.value)} />
</Field>
<FilterChip pressed={waitingOnly} onToggle={() => setWaitingOnly((value) => !value)}>
Waiting on member
</FilterChip>
</>
}
/>
<SplitView
detailLabel={ticket ? `Ticket ${ticket.id}` : "Ticket"}
closeLabel={ticket ? `Close ticket ${ticket.id}` : "Close ticket"}
onCloseDetail={() => setOpen(null)}
list={
<Stack gap="s8">
<DataTable
label="Tickets"
rows={rows}
rowKey={(row) => row.id}
rowLabel={(row) => `ticket ${row.id}`}
columns={[
...columns,
{
key: "open",
header: "Open",
cell: (row) => (
<Button size="small" pressed={open === row.id} onClick={() => setOpen(row.id)}>
Open ticket {row.id}
</Button>
),
align: "end",
},
]}
activeKey={open ?? undefined}
empty={<EmptyState title="No tickets match">Clear the search or the filter to see the whole queue.</EmptyState>}
/>
<Pagination summary={`Showing 1 to ${rows.length} of ${rows.length}`} previous={{ disabled: true }} next={{ disabled: true }} />
</Stack>
}
detail={
ticket ? (
<Stack gap="s12">
<Text as="h3" variant="title">
{ticket.subject}
</Text>
<KeyValue
columns={2}
items={[
{ label: "Status", value: ticket.status },
{ label: "Age", value: ticket.age },
]}
/>
<div>
<Button>Close ticket {ticket.id}</Button>
</div>
</Stack>
) : null
}
/>
</Stack>
</Density>
);
}Actions name their object
Staff screens act on many records at once, so a button says which one it affects. A selection bar disappears with the selection, and a detail panel shows controls only for the record it shows, so an action can never land on a record that is no longer selected.
Do
The verb and the record.
Avoid
Close what? After the selection changes, this could act on the wrong ticket.
Empty is not failed
A query that returns nothing and a request that failed look different and say different things. A refresh keeps the last result visible but marked as stale, rather than flashing to empty.
No tickets match
The queue could not load.
Code
<Stack gap="s12">
<EmptyState title="No tickets match">
Clear the search or the filter to see the whole queue.
</EmptyState>
<Notice
tone="danger"
title="The queue could not load."
action={<Button size="small">Try again</Button>}
>
The list below may be out of date.
</Notice>
</Stack>