Skip to content

The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.

Settings: one filter chip, Card only, AdminList on ColumnHeads, ListEmpty, one fold-out (PR 1916)

Janik8e53fc5610c1
diff --git a/apps/web/src/admin/AdminList.tsx b/apps/web/src/admin/AdminList.tsx
index ebd1d100..6efa03f5 100644
--- a/apps/web/src/admin/AdminList.tsx
+++ b/apps/web/src/admin/AdminList.tsx
@@ -7,6 +7,7 @@ import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } fro
import { cx, Icon } from '../ui/kit.tsx'
import { ShortcutHints } from '../ui/listPage.tsx'
import { type SortDir, sortRows } from './model.ts'
+import { ColumnHeads, ListEmpty } from '../ui/list.tsx'
export type Column<T> = {
key: string
@@ -113,7 +114,7 @@ export function AdminList<T>({
return (
<>
- <div className="adm-card adm-listcard">
+ <div className="k-card adm-listcard">
<label className="k-input adm-search">
<Icon name="search" size={15} />
<input
@@ -142,33 +143,22 @@ export function AdminList<T>({
aria-label={label ?? searchLabel}
ref={list}
>
- <div className="adm-row adm-row-head" role="row">
- {columns.map(c => (
- <div
- key={c.key}
- role="columnheader"
- className={cx('adm-cell', c.numeric && 'adm-num', c.wide && 'adm-wide')}
- aria-sort={sort.key === c.key ? (sort.dir === 'asc' ? 'ascending' : 'descending') : undefined}
- >
- {c.sort ? (
- <button
- type="button"
- className="adm-sort"
- title={t('admin.list.sortBy', { column: c.label })}
- onClick={() => toggle(c)}
- >
- {c.label}
- <span aria-hidden="true">{sort.key === c.key ? (sort.dir === 'asc' ? '↑' : '↓') : ''}</span>
- </button>
- ) : (
- c.label
- )}
- </div>
- ))}
- {rowActions && (
- <div role="columnheader" className="adm-cell adm-cell-acts" aria-label={t('admin.actions.menu')} />
- )}
- </div>
+ <ColumnHeads
+ table
+ className="adm-row adm-row-head"
+ labels={columns.map(c => ({
+ label: c.label,
+ className: cx('adm-cell', c.numeric && 'adm-num', c.wide && 'adm-wide'),
+ sort: c.sort ? (sort.key === c.key ? sort.dir : null) : undefined,
+ onSort: c.sort ? () => toggle(c) : undefined,
+ sortTitle: t('admin.list.sortBy', { column: c.label }),
+ }))}
+ trailing={
+ rowActions && (
+ <div role="columnheader" className="adm-cell adm-cell-acts" aria-label={t('admin.actions.menu')} />
+ )
+ }
+ />
{shown.map((row, i) => (
<div
key={rowId(row)}
@@ -192,7 +182,7 @@ export function AdminList<T>({
{rowActions && <div className="adm-cell adm-cell-acts">{rowActions(row)}</div>}
</div>
))}
- {!shown.length && <p className="adm-empty">{query ? t('admin.list.noMatch', { query }) : empty}</p>}
+ {!shown.length && <ListEmpty>{query ? t('admin.list.noMatch', { query }) : empty}</ListEmpty>}
</div>
</div>
<ShortcutHints
diff --git a/apps/web/src/admin/AdminMode.tsx b/apps/web/src/admin/AdminMode.tsx
index 89e7b870..7601230b 100644
--- a/apps/web/src/admin/AdminMode.tsx
+++ b/apps/web/src/admin/AdminMode.tsx
@@ -12,7 +12,7 @@ import { i18n } from '../i18n/index.tsx'
import { Toast } from '../shell/Toast.tsx'
import { HelpTip } from '../ui/form.tsx'
import { helpContent } from '../ui/HelpTip.tsx'
-import { Button, Icon } from '../ui/kit.tsx'
+import { Button, Icon, Note } from '../ui/kit.tsx'
import { Loading, SkeletonRows } from '../ui/LoadStates.tsx'
import { SettingsLayout } from '../ui/SettingsLayout.tsx'
import { StatusMark } from '../ui/StatusMark.tsx'
@@ -248,7 +248,7 @@ export function AdminMode({ currentUserId, onExit }: Props) {
const ready = place.section === 'providers' ? data : lists
if (!ready)
return (
- <div className="adm-card adm-listcard">
+ <div className="k-card adm-listcard">
<Loading
what={t('shell.page.admin')}
loading
@@ -259,8 +259,7 @@ export function AdminMode({ currentUserId, onExit }: Props) {
</div>
)
// Providers' ids are groups and providers (Providers.tsx), not rows.
- if (place.id && !detailTitle && place.section !== 'providers')
- return <p className="adm-notice">{t('admin.mode.notFound')}</p>
+ if (place.id && !detailTitle && place.section !== 'providers') return <Note>{t('admin.mode.notFound')}</Note>
switch (place.section) {
case 'workspaces':
return workspace ? (
diff --git a/apps/web/src/admin/AuditLog.tsx b/apps/web/src/admin/AuditLog.tsx
index d826f99a..f55255da 100644
--- a/apps/web/src/admin/AuditLog.tsx
+++ b/apps/web/src/admin/AuditLog.tsx
@@ -21,6 +21,8 @@ import { SetupReports } from './SettingsCards.tsx'
import { fmt } from '../i18n/format.ts'
import { i18n } from '../i18n/index.tsx'
import { EMPTY } from './parts.tsx'
+import { FilterChips, FilterChip } from '../ui/FilterChips.tsx'
+import { ListEmpty } from '../ui/list.tsx'
type Translate = ReturnType<typeof i18n>['t']
/** The active language's `t`, looked up on each call (the language can change while the module stays loaded). */
@@ -72,26 +74,17 @@ function KindChips({ value, onPick }: { value: KindValue; onPick: (value: KindVa
?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' })
}, [pressed])
return (
- <div ref={row} className="adm-chips adm-audit-kinds" role="group" aria-label={t('admin.audit.kind.label')}>
+ <FilterChips ref={row} className="adm-audit-kinds" label={t('admin.audit.kind.label')}>
{mainKinds.map(k => (
- <button
- key={k.value}
- type="button"
- className="adm-chip"
- data-kind={k.value}
- aria-pressed={value === k.value}
- onClick={() => onPick(k.value)}
- >
+ <FilterChip key={k.value} data-kind={k.value} pressed={value === k.value} onClick={() => onPick(k.value)}>
{t(k.label)}
- </button>
+ </FilterChip>
))}
<div className="adm-audit-more-kinds" ref={menu.root}>
- <button
+ <FilterChip
ref={menu.trigger}
- type="button"
- className="adm-chip"
data-kind="more"
- aria-pressed={Boolean(picked)}
+ pressed={Boolean(picked)}
aria-haspopup="menu"
aria-expanded={menu.open}
onClick={() => menu.setOpen(!menu.open)}
@@ -100,7 +93,7 @@ function KindChips({ value, onPick }: { value: KindValue; onPick: (value: KindVa
>
<span className="adm-audit-more-label">{t(picked?.label ?? 'admin.audit.kind.more')}</span>
<Icon name="down" size={13} />
- </button>
+ </FilterChip>
{menu.open && (
<div
ref={list}
@@ -126,7 +119,7 @@ function KindChips({ value, onPick }: { value: KindValue; onPick: (value: KindVa
</div>
)}
</div>
- </div>
+ </FilterChips>
)
}
@@ -870,7 +863,7 @@ function AuditEntries({ workspaces, kind }: { workspaces: AdminWorkspace[]; kind
]
return (
- <div className="adm-card">
+ <div className="k-card">
<div className="adm-audit-filters">
<Input
className="adm-audit-who"
@@ -910,7 +903,7 @@ function AuditEntries({ workspaces, kind }: { workspaces: AdminWorkspace[]; kind
skeleton={<SkeletonRows rows={8} columns={4} className="adm-sk-rows" />}
/>
)}
- {!error && entries && entries.length === 0 && <p className="adm-notice">{t('admin.audit.empty')}</p>}
+ {!error && entries && entries.length === 0 && <ListEmpty>{t('admin.audit.empty')}</ListEmpty>}
{!error && entries && entries.length > 0 && (
<div className="adm-scroll">
<table className="adm-table adm-stack adm-audit-table">
diff --git a/apps/web/src/admin/Billing.test.tsx b/apps/web/src/admin/Billing.test.tsx
index 45d41242..0efbf91e 100644
--- a/apps/web/src/admin/Billing.test.tsx
+++ b/apps/web/src/admin/Billing.test.tsx
@@ -183,7 +183,7 @@ test('the bills list filters by status with counted chips and colour badges', ()
expect(html).toContain('aria-pressed="true"')
expect(html).toContain('k-badge-info')
// Only statuses that have bills get a chip, each with its count.
- expect(html).toContain('Trial<span class="n">1</span>')
+ expect(html).toContain('Trial<span class="k-chip-n">1</span>')
expect(html).not.toContain('Past due<span')
// Nothing canceled: no "All bills" chip, it would show the same.
expect(html).not.toContain('All bills<span')
@@ -200,9 +200,9 @@ test('the bills list hides canceled bills by default; the Canceled and All bills
},
]
const html = renderList('bills')
- expect(html).toContain('Current<span class="n">1</span>')
- expect(html).toContain('Canceled<span class="n">1</span>')
- expect(html).toContain('All bills<span class="n">2</span>')
+ expect(html).toContain('Current<span class="k-chip-n">1</span>')
+ expect(html).toContain('Canceled<span class="k-chip-n">1</span>')
+ expect(html).toContain('All bills<span class="k-chip-n">2</span>')
expect(html).toContain('[email protected]')
expect(html).not.toContain('[email protected]')
})
diff --git a/apps/web/src/admin/Billing.tsx b/apps/web/src/admin/Billing.tsx
index 8c65a030..edca4345 100644
--- a/apps/web/src/admin/Billing.tsx
+++ b/apps/web/src/admin/Billing.tsx
@@ -95,6 +95,8 @@ import { errorText, type Notify } from './notify.ts'
import { day, EMPTY, when } from './parts.tsx'
import { type BillingTab, billingTab } from './route.ts'
import { Fact } from './WorkspacesPage.tsx'
+import { FilterChips, FilterChip } from '../ui/FilterChips.tsx'
+import { ListEmpty } from '../ui/list.tsx'
type Translate = ReturnType<typeof useT>
@@ -400,7 +402,7 @@ function BillsList({ onOpen, keysRef }: { onOpen: (id: string) => void; keysRef:
const shown = useMemo(() => filterBills(query.data ?? [], filter), [query.data, filter])
if (!query.data)
return (
- <div className="adm-card adm-listcard">
+ <div className="k-card adm-listcard">
<Loading
what={t('admin.bills.what')}
loading
@@ -423,20 +425,18 @@ function BillsList({ onOpen, keysRef }: { onOpen: (id: string) => void; keysRef:
<AdminList
rows={shown}
tools={
- <div className="adm-chips" role="group" aria-label={t('admin.bills.filter.label')}>
+ <FilterChips label={t('admin.bills.filter.label')}>
{chips.map(value => (
- <button
+ <FilterChip
key={value}
- type="button"
- className="adm-chip"
- aria-pressed={filter === value}
+ pressed={filter === value}
+ count={filterBills(bills, value).length}
onClick={() => setFilter(value)}
>
{filterLabel(t, value)}
- <span className="n">{fmt().number(filterBills(bills, value).length)}</span>
- </button>
+ </FilterChip>
))}
- </div>
+ </FilterChips>
}
rowId={b => b.id}
columns={columns}
@@ -542,9 +542,9 @@ function ReviewCard({ onOpen, notify }: { onOpen: (id: string) => void; notify:
</table>
</div>
) : (
- <p className="adm-notice">
+ <ListEmpty>
{t('admin.bills.review.empty')} {t('admin.bills.review.emptyHint')}
- </p>
+ </ListEmpty>
)}
</Loading>
{deciding && (
@@ -715,14 +715,14 @@ function EventsCard({ notify, headActions }: { notify: Notify; headActions: HTML
</table>
</div>
) : filter === 'all' ? (
- <p className="adm-notice">
+ <ListEmpty>
<T k="admin.bills.events.emptyHow" values={{ link: appLink('#admin/providers/stripe') }} />
- </p>
+ </ListEmpty>
) : (
- <p className="adm-notice">
+ <ListEmpty>
{t('admin.bills.events.empty')}{' '}
<LinkButton onClick={() => setFilter('all')}>{t('admin.bills.events.showAll')}</LinkButton>
- </p>
+ </ListEmpty>
)}
{next && (
<div>
@@ -1500,7 +1500,7 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
const customer = useQuery(bill?.stripeCustomerId ? customerKey(id) : null, loadCustomer(id))
if (!bill)
return (
- <div className="adm-card">
+ <div className="k-card">
<Loading
what={t('admin.bills.detail.what')}
loading
@@ -1761,7 +1761,7 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
</table>
</div>
) : (
- <p className="adm-notice">{t('admin.bills.noWorkspaces')}</p>
+ <ListEmpty>{t('admin.bills.noWorkspaces')}</ListEmpty>
)}
</Card>
@@ -1808,7 +1808,7 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
</table>
</div>
) : (
- <p className="adm-notice">{t('admin.bills.ledger.empty')}</p>
+ <ListEmpty>{t('admin.bills.ledger.empty')}</ListEmpty>
)}
</Card>
@@ -1863,7 +1863,7 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
</table>
</div>
) : (
- <p className="adm-notice">{t('admin.bills.recharges.empty')}</p>
+ <ListEmpty>{t('admin.bills.recharges.empty')}</ListEmpty>
)}
</Card>
@@ -1910,7 +1910,7 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
</table>
</div>
) : (
- <p className="adm-notice">{t('admin.bills.invoices.empty')}</p>
+ <ListEmpty>{t('admin.bills.invoices.empty')}</ListEmpty>
)}
</Card>
diff --git a/apps/web/src/admin/CallQuality.tsx b/apps/web/src/admin/CallQuality.tsx
index c1b50467..632f6e0e 100644
--- a/apps/web/src/admin/CallQuality.tsx
+++ b/apps/web/src/admin/CallQuality.tsx
@@ -19,11 +19,12 @@ import { pricePerMinute } from '../settings/levelModel.ts'
import { appLink } from '../ui/AppLink.tsx'
import { Select, type SelectOption, Switch } from '../ui/controls.tsx'
import { Card } from '../ui/form.tsx'
-import { Badge, Icon } from '../ui/kit.tsx'
+import { Badge } from '../ui/kit.tsx'
import { Loading } from '../ui/LoadStates.tsx'
import { SettingRow, SkeletonSettingRow } from '../ui/SettingRow.tsx'
import { type AdminInputs, runAdmin } from './api.ts'
import { errorText, type Notify } from './notify.ts'
+import { FoldOut } from '../ui/FoldOut.tsx'
export const CALL_QUALITY = 'admin.callQuality'
export const loadCallQuality = async () => (await runAdmin('callQuality.get', {})) as unknown as CallQualityAdminData
@@ -160,20 +161,20 @@ export function CallQualityCard({ notify }: { notify: Notify }) {
/>
}
/>
- <details className="vp-more adm-cq-models" open={open} onToggle={e => setOpen(e.currentTarget.open)}>
- <summary>
- <Icon name="down" size={14} className="vp-chevron" />
- {open ? t('admin.callQuality.hideModels') : t('admin.callQuality.showModels')}
- </summary>
- <div className="vp-more-body">
- <p className="help adm-cq-foot">{t('admin.callQuality.modelsHelp')}</p>
- {(['standard', 'premium'] as const).map(l => {
- const lv = level(l)
- return lv && <StageModels key={l} level={lv} change={change} />
- })}
- {level('ultra') && <UltraModels level={level('ultra')!} change={change} />}
- </div>
- </details>
+ <FoldOut
+ className="adm-cq-models"
+ open={open}
+ onToggle={setOpen}
+ summary={t('admin.callQuality.showModels')}
+ openSummary={t('admin.callQuality.hideModels')}
+ >
+ <p className="help adm-cq-foot">{t('admin.callQuality.modelsHelp')}</p>
+ {(['standard', 'premium'] as const).map(l => {
+ const lv = level(l)
+ return lv && <StageModels key={l} level={lv} change={change} />
+ })}
+ {level('ultra') && <UltraModels level={level('ultra')!} change={change} />}
+ </FoldOut>
</>
)}
</Loading>
diff --git a/apps/web/src/admin/CallReviews.tsx b/apps/web/src/admin/CallReviews.tsx
index 673f097b..42bec967 100644
--- a/apps/web/src/admin/CallReviews.tsx
+++ b/apps/web/src/admin/CallReviews.tsx
@@ -11,6 +11,7 @@ import { Select } from '../ui/controls.tsx'
import { Card } from '../ui/form.tsx'
import { Loading, SkeletonList } from '../ui/LoadStates.tsx'
import { type CallReview, loadCallReviews } from './api.ts'
+import { ListEmpty } from '../ui/list.tsx'
import '../settings/knowledge.css'
import '../review/review.css'
@@ -57,7 +58,7 @@ export function CallReviews() {
skeleton={<SkeletonList rows={4} action />}
>
{reviews && reviews.length === 0 ? (
- <p className="adm-empty">{t('admin.callReviews.empty')}</p>
+ <ListEmpty>{t('admin.callReviews.empty')}</ListEmpty>
) : (
<ul className="kn-list rv-list">
{reviews?.map(r => (
diff --git a/apps/web/src/admin/InternationalTransfers.tsx b/apps/web/src/admin/InternationalTransfers.tsx
index 1dc3fbf4..078ec06a 100644
--- a/apps/web/src/admin/InternationalTransfers.tsx
+++ b/apps/web/src/admin/InternationalTransfers.tsx
@@ -134,15 +134,15 @@ export function InternationalTransfers() {
<span className="adm-countries-label" id="adm-countries-label">
{t('admin.system.transfers.allowed')}
</span>
- <div className="adm-chips" role="group" aria-labelledby="adm-countries-label">
+ <div className="adm-tags" role="group" aria-labelledby="adm-countries-label">
{countries.map(country => (
- <span key={country} className="adm-chip">
+ <span key={country} className="adm-tag">
<span aria-hidden>{flagOf(country)}</span>
{name(country)}
{editable && (
<button
type="button"
- className="adm-chip-x"
+ className="adm-tag-x"
disabled={busy}
title={t('admin.system.transfers.remove', { country: name(country) })}
aria-label={t('admin.system.transfers.remove', { country: name(country) })}
@@ -153,9 +153,9 @@ export function InternationalTransfers() {
)}
</span>
))}
- {!countries.length && <span className="adm-chips-empty">{t('admin.system.transfers.onlyOwn')}</span>}
+ {!countries.length && <span className="adm-tags-empty">{t('admin.system.transfers.onlyOwn')}</span>}
{editable && (
- <span className="adm-chips-add">
+ <span className="adm-tags-add">
<SearchSelect
id="adm-countries-add"
value=""
diff --git a/apps/web/src/admin/Onboarding.tsx b/apps/web/src/admin/Onboarding.tsx
index 6e21ac8a..6a45f0bf 100644
--- a/apps/web/src/admin/Onboarding.tsx
+++ b/apps/web/src/admin/Onboarding.tsx
@@ -331,7 +331,7 @@ export function AtRisk({ views, onOpen, keysRef }: AtRiskProps) {
empty={emptyText(t, query.data?.oldEnough ?? 0, days)}
/>
) : (
- <div className="adm-card adm-listcard">
+ <div className="k-card adm-listcard">
<Loading
what={t('admin.onboarding.listWhat')}
loading
diff --git a/apps/web/src/admin/Overview.tsx b/apps/web/src/admin/Overview.tsx
index bb9087b6..d6a613f4 100644
--- a/apps/web/src/admin/Overview.tsx
+++ b/apps/web/src/admin/Overview.tsx
@@ -14,6 +14,7 @@ import { type AdminOverview, loadOverview } from './api.ts'
import { Funnel } from './Funnel.tsx'
import { EMPTY } from './parts.tsx'
import { ShopifySetups } from './ShopifySetups.tsx'
+import { Card } from '../ui/form.tsx'
const usd = (amount: number) => fmt().currency(amount, 'USD', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
const money = (amount: number) =>
@@ -135,7 +136,7 @@ export function Overview({ onOpen }: Props) {
return (
<>
<LoadProblem
- className="adm-card"
+ className="k-card"
what={t('admin.overview.what')}
message={overview.error ?? undefined}
slow={!overview.error}
@@ -182,12 +183,9 @@ export function Overview({ onOpen }: Props) {
</div>
<ShopifySetups />
{o && (
- <section className="adm-card" aria-label={t('admin.overview.people.title')}>
- <div className="adm-card-head">
- <h2>{t('admin.overview.people.title')}</h2>
- </div>
+ <Card id="adm-people" title={t('admin.overview.people.title')}>
<People o={o} onOpen={onOpen} />
- </section>
+ </Card>
)}
<FeatureLine
title={t('admin.overview.costs.title')}
diff --git a/apps/web/src/admin/Partners.test.tsx b/apps/web/src/admin/Partners.test.tsx
index 15b37e44..8bf81571 100644
--- a/apps/web/src/admin/Partners.test.tsx
+++ b/apps/web/src/admin/Partners.test.tsx
@@ -8,12 +8,12 @@ const link = (html: string, href: string) => html.match(new RegExp(`<a[^>]*href=
test('All and Waiting for approval: chips, each its own address; the number only while partners wait', () => {
const html = renderToStaticMarkup(<PartnerViews waiting={false} count={2} />)
- expect(link(html, '#admin/partners')).toContain('class="adm-chip"')
+ expect(link(html, '#admin/partners')).toContain('class="k-chip"')
expect(link(html, '#admin/partners')).toContain('aria-current="page"')
- expect(link(html, '#admin/partners/waiting')).toContain('Waiting for approval<span class="n">2</span>')
+ expect(link(html, '#admin/partners/waiting')).toContain('Waiting for approval<span class="k-chip-n">2</span>')
const none = renderToStaticMarkup(<PartnerViews waiting count={0} />)
expect(link(none, '#admin/partners/waiting')).toContain('aria-current="page"')
- expect(none).not.toContain('class="n"')
+ expect(none).not.toContain('k-chip-n')
})
test('the owner: name over email; an owner without a name shows the email once', () => {
diff --git a/apps/web/src/admin/Partners.tsx b/apps/web/src/admin/Partners.tsx
index 1e62c3f9..7b68aec1 100644
--- a/apps/web/src/admin/Partners.tsx
+++ b/apps/web/src/admin/Partners.tsx
@@ -9,12 +9,12 @@
// instance admins, D3).
import type { AdminPartnerList, PartnerBrandReview } from '@linedesk/actions'
import { type MessageKey, msg } from '@linedesk/i18n'
-import { useFormat, useT } from '@linedesk/i18n/react'
-import { type FormEvent, useMemo, useState } from 'react'
+import { useT } from '@linedesk/i18n/react'
+import { useMemo, useState } from 'react'
import { createPortal } from 'react-dom'
import { useQuery } from '../cachedQuery.ts'
import { useSupportAccess } from '../supportAccess.ts'
-import { Card, Dialog, FormField, Input } from '../ui/form.tsx'
+import { Dialog, FormField, Input } from '../ui/form.tsx'
import { Badge, Button } from '../ui/kit.tsx'
import { Loading, SkeletonRows } from '../ui/LoadStates.tsx'
import { AdminList, type Column, type ListKeys } from './AdminList.tsx'
@@ -31,6 +31,7 @@ import {
waitingPartners,
} from './partnersModel.ts'
import { day, EMPTY } from './parts.tsx'
+import { FilterChips, FilterChip } from '../ui/FilterChips.tsx'
export const PARTNERS = 'admin.partners'
export const loadPartners = async () => (await runAdmin('partner.adminList', {})) as AdminPartnerList
@@ -64,17 +65,15 @@ export function usePartnersWaiting(): number | null {
* link land on it. */
export function PartnerViews({ waiting, count }: { waiting: boolean; count: number }) {
const t = useT()
- const format = useFormat()
return (
- <nav className="adm-chips" aria-label={t('admin.partners.tabs')}>
- <a href="#admin/partners" className="adm-chip" aria-current={waiting ? undefined : 'page'}>
+ <FilterChips nav label={t('admin.partners.tabs')}>
+ <FilterChip href="#admin/partners" current={!waiting}>
{t('admin.partners.tabAll')}
- </a>
- <a href="#admin/partners/waiting" className="adm-chip" aria-current={waiting ? 'page' : undefined}>
+ </FilterChip>
+ <FilterChip href="#admin/partners/waiting" current={waiting} count={count || null}>
{t('admin.partners.tabWaiting')}
- {count ? <span className="n">{format.number(count)}</span> : null}
- </a>
- </nav>
+ </FilterChip>
+ </FilterChips>
)
}
@@ -387,7 +386,7 @@ export function Partners({ notify, waiting = false, keysRef, headActions }: Prop
}
/>
) : (
- <div className="adm-card adm-listcard">
+ <div className="k-card adm-listcard">
<Loading
what={t('admin.sections.partners.label')}
loading
diff --git a/apps/web/src/admin/ProviderDialog.tsx b/apps/web/src/admin/ProviderDialog.tsx
index e7097322..344de1e2 100644
--- a/apps/web/src/admin/ProviderDialog.tsx
+++ b/apps/web/src/admin/ProviderDialog.tsx
@@ -49,6 +49,7 @@ import { Logo, presetMeta, providerMeta, redirectUris } from './ProviderLogo.tsx
import { testedAgo } from './providerStatus.ts'
import { TryOut, tryKindOf } from './TryOut.tsx'
import { i18n } from '../i18n/index.tsx'
+import { FoldOut } from '../ui/FoldOut.tsx'
/** A value that comes from the server's settings: a small server icon, the rest in its tooltip. */
export function ServerSet() {
@@ -417,8 +418,7 @@ export function KeyGuide({ provider, open }: { provider: ProviderStatus; open: b
const { label } = providerSpec(provider.provider)
const guide = providerGuide(provider.provider, i18n())
return (
- <details className="adm-guide" open={open}>
- <summary>{t('admin.providerDialog.howToGetKey')}</summary>
+ <FoldOut className="adm-guide" defaultOpen={open} summary={t('admin.providerDialog.howToGetKey')}>
<ol className="adm-guide-steps">
{guide.steps.map(step => (
<li key={step}>{step}</li>
@@ -435,7 +435,7 @@ export function KeyGuide({ provider, open }: { provider: ProviderStatus; open: b
)}
{guide.cost}
</p>
- </details>
+ </FoldOut>
)
}
diff --git a/apps/web/src/admin/ProviderError.test.tsx b/apps/web/src/admin/ProviderError.test.tsx
index b37ac884..2101b05d 100644
--- a/apps/web/src/admin/ProviderError.test.tsx
+++ b/apps/web/src/admin/ProviderError.test.tsx
@@ -12,7 +12,7 @@ const lineOf = (html: string) => /<span class="adm-prov-error-line"[^>]*>([^<]*)
test('a raw provider error: one short human line, the full text and its time only under Details', () => {
const html = renderToStaticMarkup(<ProviderError message={RAW} at="2026-11-15T01:00:00.000Z" />)
expect(lineOf(html)).toBe('A call sent two replies at once. Calls still work.')
- expect(html).toContain('<details class="adm-prov-error-details"><summary')
+ expect(html).toContain('<details class="k-fold adm-prov-error-details"><summary')
expect(html).toContain('dateTime="2026-11-15T01:00:00.000Z"')
// The raw JSON is in the details only, never in the visible line.
expect(html.split('<details')[0]).not.toContain('{')
diff --git a/apps/web/src/admin/ProviderError.tsx b/apps/web/src/admin/ProviderError.tsx
index a9563164..935180a0 100644
--- a/apps/web/src/admin/ProviderError.tsx
+++ b/apps/web/src/admin/ProviderError.tsx
@@ -6,6 +6,7 @@ import { useT } from '@linedesk/i18n/react'
import { cx } from '../ui/kit.tsx'
import { when } from './parts.tsx'
import { providerErrorLine } from './providerStatus.ts'
+import { FoldOut } from '../ui/FoldOut.tsx'
export function ProviderError({
message,
@@ -26,13 +27,16 @@ export function ProviderError({
{summary}
</span>
{(full !== summary || at) && (
- <details className="adm-prov-error-details">
- <summary title={t('admin.providerError.fullTip')}>{t('admin.providerError.details')}</summary>
+ <FoldOut
+ className="adm-prov-error-details"
+ title={t('admin.providerError.fullTip')}
+ summary={t('admin.providerError.details')}
+ >
<span className="adm-prov-error-full">
{at && <time dateTime={at}>{when(at)}</time>}
{full}
</span>
- </details>
+ </FoldOut>
)}
</span>
)
diff --git a/apps/web/src/admin/ProviderGroup.tsx b/apps/web/src/admin/ProviderGroup.tsx
index 1752cb51..948103f0 100644
--- a/apps/web/src/admin/ProviderGroup.tsx
+++ b/apps/web/src/admin/ProviderGroup.tsx
@@ -47,6 +47,7 @@ import {
wayOfCategory,
} from './providerList.ts'
import { groupAttention, groupHelp, groupNote, groupProblem, rowStatus } from './providerStatus.ts'
+import { FoldOut } from '../ui/FoldOut.tsx'
/** "Works", "Failing: Key rejected", "Partly works: voice missing", in red only when it fails. */
export function StatusWords({ status }: { status: { state: StatusState; detail: string | null } }) {
@@ -351,8 +352,7 @@ function CallAudio({ group, health }: { group: GroupStatus; health: AdminHealth
function CallAudioGuide({ open }: { open: boolean }) {
const t = useT()
return (
- <details className="adm-guide" open={open}>
- <summary>{t('admin.providers.callAudio.howTo')}</summary>
+ <FoldOut className="adm-guide" defaultOpen={open} summary={t('admin.providers.callAudio.howTo')}>
<ol className="adm-guide-steps">
{callAudioGuide.stepKeys
.map(key => callAudioStep(key, i18n()))
@@ -367,6 +367,6 @@ function CallAudioGuide({ open }: { open: boolean }) {
{' · '}
{t(callAudioGuide.costKey)}
</p>
- </details>
+ </FoldOut>
)
}
diff --git a/apps/web/src/admin/ReplyDelay.tsx b/apps/web/src/admin/ReplyDelay.tsx
index f1088817..725f2a24 100644
--- a/apps/web/src/admin/ReplyDelay.tsx
+++ b/apps/web/src/admin/ReplyDelay.tsx
@@ -7,7 +7,7 @@ import { type MessageKey, msg } from '@linedesk/i18n'
import { useT } from '@linedesk/i18n/react'
import { useContext } from 'react'
import { useQuery } from '../cachedQuery.ts'
-import { CardInline } from '../ui/form.tsx'
+import { CardInline, Card } from '../ui/form.tsx'
import { Loading, SkeletonRows } from '../ui/LoadStates.tsx'
import { loadLatency, type PipelineLatency, type Percentiles } from './api.ts'
import { fmt } from '../i18n/format.ts'
@@ -180,13 +180,7 @@ export function ReplyDelay() {
)
if (!data)
return (
- <section className="adm-card" aria-label={t('admin.replyDelay.title')}>
- <div className="adm-card-head">
- <div>
- <h2>{t('admin.replyDelay.title')}</h2>
- <p className="help">{note}</p>
- </div>
- </div>
+ <Card id="adm-reply-delay" title={t('admin.replyDelay.title')} description={note}>
<Loading
what={t('admin.replyDelay.title')}
loading
@@ -194,23 +188,17 @@ export function ReplyDelay() {
onRetry={() => void query.reload()}
skeleton={<SkeletonRows rows={2} columns={2} className="adm-sk-rows" />}
/>
- </section>
+ </Card>
)
// One scale for all pipelines, so their bars compare.
const scale = Math.max(1, ...data.pipelines.map(p => sumOf(partsOf(p))))
return (
- <section className="adm-card" aria-label={t('admin.replyDelay.title')}>
- <div className="adm-card-head">
- <div>
- <h2>{t('admin.replyDelay.title')}</h2>
- <p className="help">{note}</p>
- </div>
- </div>
+ <Card id="adm-reply-delay" title={t('admin.replyDelay.title')} description={note}>
{data.pipelines.length ? (
data.pipelines.map(p => <PipelineBar key={p.pipeline} latency={p} scale={scale} />)
) : (
<p className="help">{t('admin.replyDelay.empty')}</p>
)}
- </section>
+ </Card>
)
}
diff --git a/apps/web/src/admin/SettingsCards.tsx b/apps/web/src/admin/SettingsCards.tsx
index da821d7c..1fc75f23 100644
--- a/apps/web/src/admin/SettingsCards.tsx
+++ b/apps/web/src/admin/SettingsCards.tsx
@@ -28,11 +28,12 @@ import { externalLink } from '../settings/ZapierGuide.tsx'
import { appLink, ExternalLink, LinkButton } from '../ui/AppLink.tsx'
import { Switch } from '../ui/controls.tsx'
import { Card, Input } from '../ui/form.tsx'
-import { Badge, Button, cx } from '../ui/kit.tsx'
+import { Badge, Button, cx, Note } from '../ui/kit.tsx'
import { Loading, Skeleton, SkeletonRows } from '../ui/LoadStates.tsx'
import { SettingRow } from '../ui/SettingRow.tsx'
import { StatusMark } from '../ui/StatusMark.tsx'
import { runAdmin } from './api.ts'
+import { ListEmpty } from '../ui/list.tsx'
export const CLONING = 'admin.voiceCloning'
export const loadCloning = async () => (await runAdmin('voiceCloning.get', {})) as VoiceCloningData
@@ -528,7 +529,7 @@ export function SetupReports() {
format.dateTime(new Date(iso), { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' })
return (
<Card title={t('admin.system.setupReports.title')} help={t('admin.system.setupReports.help')}>
- {data?.sendingOff && <p className="adm-notice">{t('admin.system.setupReports.off')}</p>}
+ {data?.sendingOff && <Note>{t('admin.system.setupReports.off')}</Note>}
<Loading
what={t('admin.system.setupReports.title')}
loading={!data}
@@ -537,7 +538,7 @@ export function SetupReports() {
skeleton={<SkeletonRows rows={2} columns={5} className="adm-sk-rows" />}
>
{data && data.reports.length === 0 ? (
- <p className="adm-notice">{t('admin.system.setupReports.empty')}</p>
+ <ListEmpty>{t('admin.system.setupReports.empty')}</ListEmpty>
) : (
<div className="adm-scroll">
<table className="adm-table adm-stack">
diff --git a/apps/web/src/admin/ShopifySetups.tsx b/apps/web/src/admin/ShopifySetups.tsx
index 30e636ed..0762713f 100644
--- a/apps/web/src/admin/ShopifySetups.tsx
+++ b/apps/web/src/admin/ShopifySetups.tsx
@@ -7,6 +7,7 @@ import { useFormat, useT } from '@linedesk/i18n/react'
import { useQuery } from '../cachedQuery.ts'
import { Badge } from '../ui/kit.tsx'
import { runAdmin } from './api.ts'
+import { Card } from '../ui/form.tsx'
const load = async () => (await runAdmin('shopifySetup.list', {})) as ShopifySetupListData
@@ -24,13 +25,7 @@ export function ShopifySetups() {
if (!requests.length) return null
const title = t('admin.shopifySetups.title')
return (
- <section className="adm-card" aria-label={title}>
- <div className="adm-card-head">
- <div>
- <h2>{title}</h2>
- <p className="help">{t('admin.shopifySetups.note')}</p>
- </div>
- </div>
+ <Card id="adm-shopify-setups" title={title} description={t('admin.shopifySetups.note')}>
<div className="adm-scroll">
<table className="adm-table">
<thead>
@@ -64,6 +59,6 @@ export function ShopifySetups() {
</tbody>
</table>
</div>
- </section>
+ </Card>
)
}
diff --git a/apps/web/src/admin/StatusCard.tsx b/apps/web/src/admin/StatusCard.tsx
index c5f38aa5..3169a050 100644
--- a/apps/web/src/admin/StatusCard.tsx
+++ b/apps/web/src/admin/StatusCard.tsx
@@ -426,7 +426,7 @@ const headlineMark = (state: ReturnType<typeof readiness>['state'], serverDown:
export function StatusCard({ status, keys }: { status: ProviderStatusState; keys?: KeyFixes }) {
const t = useT()
const [open, setOpen] = useState<boolean | null>(null)
- if (!status.status) return <Skeleton className="adm-card adm-skel-card" />
+ if (!status.status) return <Skeleton className="k-card adm-skel-card" />
const { groups } = status.status
const ready = readiness(groups, i18n())
const server = serverRows(status.health)
@@ -447,7 +447,7 @@ export function StatusCard({ status, keys }: { status: ProviderStatusState; keys
ready.reason ??
(serverDown ? t('admin.status.partProblem', { part: serverDown.label, problem: serverDown.problem }) : null))
return (
- <section className="adm-card adm-ready" aria-label={t('admin.status.readyLabel')}>
+ <section className="k-card adm-ready" aria-label={t('admin.status.readyLabel')}>
<div className="adm-ready-head">
<StatusMark state={mark} label={headline} />
<div className="adm-ready-text">
diff --git a/apps/web/src/admin/SystemPrompt.tsx b/apps/web/src/admin/SystemPrompt.tsx
index 32405645..19bc1140 100644
--- a/apps/web/src/admin/SystemPrompt.tsx
+++ b/apps/web/src/admin/SystemPrompt.tsx
@@ -20,6 +20,7 @@ import { LineGroup } from '../ui/FeatureLine.tsx'
import { Badge, Button, cx, Icon, Note } from '../ui/kit.tsx'
import { Loading, SkeletonRows } from '../ui/LoadStates.tsx'
import { runAdmin } from './api.ts'
+import { FoldOut } from '../ui/FoldOut.tsx'
const QUERY = 'admin.systemPrompt'
const load = async () => (await runAdmin('systemPrompt.get', {})) as SystemPromptData
@@ -321,10 +322,9 @@ function Part({ partKey, edit, onSave, onReset, onEmpty }: PartProps) {
<p className="adm-prompt-hint">{dirty ? t('admin.prompt.unsaved') : t('admin.prompt.autoSaveHint')}</p>
)}
{edit && (
- <details className="adm-prompt-default">
- <summary>{t('admin.prompt.defaultText')}</summary>
+ <FoldOut className="adm-prompt-default" summary={t('admin.prompt.defaultText')}>
<ReadOnlyText text={def.text} />
- </details>
+ </FoldOut>
)}
</form>
)
@@ -405,7 +405,7 @@ export function SystemPrompt() {
return (
<section
key={section}
- className={cx('adm-card adm-prompt-section', isOpen && 'is-open')}
+ className={cx('k-card adm-prompt-section', isOpen && 'is-open')}
aria-label={t(SECTIONS[section])}
>
<button
diff --git a/apps/web/src/admin/Usage.tsx b/apps/web/src/admin/Usage.tsx
index 73710682..a5ef5778 100644
--- a/apps/web/src/admin/Usage.tsx
+++ b/apps/web/src/admin/Usage.tsx
@@ -55,7 +55,7 @@ export function Usage({ workspaces, usage, months }: Props) {
const billed = listed.some(u => u.charged_micros !== null)
return (
- <div className="adm-card adm-listcard">
+ <div className="k-card adm-listcard">
<div className="adm-scroll adm-usage-scroll" ref={scroller}>
<table className="adm-table adm-stack adm-stack-grid adm-usage">
<thead>
diff --git a/apps/web/src/admin/UsersPage.tsx b/apps/web/src/admin/UsersPage.tsx
index 270b2e55..eb0a5cb8 100644
--- a/apps/web/src/admin/UsersPage.tsx
+++ b/apps/web/src/admin/UsersPage.tsx
@@ -15,6 +15,7 @@ import type { Notify } from './notify.ts'
import { day, when } from './parts.tsx'
import { ServerSet } from './ProviderDialog.tsx'
import { Fact } from './WorkspacesPage.tsx'
+import { FilterChips, FilterChip } from '../ui/FilterChips.tsx'
const label = (u: AdminUser) => u.name || u.email
@@ -95,19 +96,13 @@ const FILTER_LABELS: Record<UserFilter, MessageKey> = {
export function UserFilters({ filter, onPick }: { filter: UserFilter; onPick: (filter: UserFilter) => void }) {
const t = useT()
return (
- <div className="adm-chips" role="group" aria-label={t('admin.users.filter.label')}>
+ <FilterChips label={t('admin.users.filter.label')}>
{USER_FILTERS.map(value => (
- <button
- key={value}
- type="button"
- className="adm-chip"
- aria-pressed={filter === value}
- onClick={() => onPick(value)}
- >
+ <FilterChip key={value} pressed={filter === value} onClick={() => onPick(value)}>
{t(FILTER_LABELS[value])}
- </button>
+ </FilterChip>
))}
- </div>
+ </FilterChips>
)
}
diff --git a/apps/web/src/admin/WorkspacesPage.tsx b/apps/web/src/admin/WorkspacesPage.tsx
index fc3ce0ef..2c155fba 100644
--- a/apps/web/src/admin/WorkspacesPage.tsx
+++ b/apps/web/src/admin/WorkspacesPage.tsx
@@ -17,6 +17,7 @@ import { day, EMPTY, when } from './parts.tsx'
import { formatNumber } from '../onboarding/flow.ts'
import { WORKSPACE_VIEWS, type WorkspaceView, workspaceViewOfHash, workspacesHref } from './route.ts'
import { NewWorkspaceDialog } from '../shell/NewWorkspace.tsx'
+import { FilterChips, FilterChip } from '../ui/FilterChips.tsx'
type Translate = ReturnType<typeof useT>
@@ -143,19 +144,13 @@ export function useWorkspaceView() {
export function WorkspaceViews({ view, onPick }: { view: WorkspaceView; onPick: (view: WorkspaceView) => void }) {
const t = useT()
return (
- <div className="adm-chips" role="group" aria-label={t('admin.workspaces.view.label')}>
+ <FilterChips label={t('admin.workspaces.view.label')}>
{WORKSPACE_VIEWS.map(value => (
- <button
- key={value}
- type="button"
- className="adm-chip"
- aria-pressed={view === value}
- onClick={() => onPick(value)}
- >
+ <FilterChip key={value} pressed={view === value} onClick={() => onPick(value)}>
{t(VIEW_LABELS[value])}
- </button>
+ </FilterChip>
))}
- </div>
+ </FilterChips>
)
}
diff --git a/apps/web/src/admin/admin.css b/apps/web/src/admin/admin.css
index 08c031f1..38a80f43 100644
--- a/apps/web/src/admin/admin.css
+++ b/apps/web/src/admin/admin.css
@@ -108,28 +108,6 @@
grid-column: 1 / -1;
}
}
-.adm-sort {
- display: inline-flex;
- align-items: center;
- gap: 4px;
- padding: 0;
- border: 0;
- background: none;
- font: inherit;
- color: inherit;
- cursor: pointer;
-}
-.adm-sort:hover {
- color: var(--ink);
-}
-.adm-sort:focus-visible {
- outline: 2px solid var(--focus);
- outline-offset: 2px;
- border-radius: var(--radius-xs);
-}
-.adm-sort span {
- width: 8px;
-}
.adm-sub {
display: block;
font-size: 12px;
@@ -153,17 +131,6 @@
font-family: var(--font-mono);
font-size: 12px;
}
-.adm-notice {
- margin: 0;
- padding: 10px 12px;
- border-radius: var(--radius-sm);
- background: var(--surface-hover);
- font-size: 13px;
-}
-.adm-notice code {
- font-family: var(--font-mono);
- font-size: 12px;
-}
/* ---- Admin mode: the frame of Workspace and Account settings (SettingsLayout), with a back button in the title bar. ---- */
.adm-mode {
@@ -233,14 +200,6 @@
grid-template-columns: minmax(0, 1fr);
gap: 12px;
}
-.adm-card {
- background: var(--surface);
- border-radius: var(--radius-lg);
- box-shadow: var(--shadow-1);
- padding: 18px 20px;
- display: grid;
- gap: 14px;
-}
/* Lists: search on top, comfortable rows, a cursor row like the inbox. */
.adm-listcard {
@@ -268,12 +227,17 @@
cursor: pointer;
outline: none;
}
-.adm-row-head {
- min-height: 32px;
+/* The headings (ColumnHeads): the list's own grid and padding; the hairline under them is the first row's line. */
+.ib-cols.adm-row-head {
+ position: static;
+ min-height: 0;
+ padding: 0 12px;
+ border-radius: 0;
+ background: none;
cursor: default;
- font-size: 11px;
- font-weight: 500;
- color: var(--ink-muted);
+}
+.adm-row-head + .adm-row {
+ background-image: none;
}
/* --adm-col2-min: a second column that must never be cut (Workspaces: the number, in full). */
.adm-row:has(> :nth-child(4):not(.adm-cell-acts)) {
@@ -311,11 +275,9 @@
gap: 10px;
min-width: 0;
}
-.adm-empty {
- margin: 0;
+/* No rows (ListEmpty): at the rows' inset, where the first row would be. */
+.adm-list > .k-list-empty {
padding: 20px 12px;
- font-size: 13px;
- color: var(--ink-muted);
}
/* The shortcut line sits under the card, as under the inbox and Contacts (ShortcutHints). */
.adm-body > .ib-hint {
@@ -396,13 +358,13 @@
font-size: 13.5px;
font-weight: 500;
}
-.adm-chips {
+.adm-tags {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
}
-.adm-chip {
+.adm-tag {
display: inline-flex;
align-items: center;
gap: 6px;
@@ -413,10 +375,10 @@
font-size: 13px;
white-space: nowrap;
}
-.adm-chip:has(.adm-chip-x) {
+.adm-tag:has(.adm-tag-x) {
padding-right: 4px;
}
-.adm-chip-x {
+.adm-tag-x {
display: inline-grid;
place-items: center;
width: 20px;
@@ -428,20 +390,20 @@
color: var(--ink-muted);
cursor: pointer;
}
-.adm-chip-x:hover {
+.adm-tag-x:hover {
color: var(--ink);
background: var(--line);
}
-.adm-chip-x:focus-visible {
+.adm-tag-x:focus-visible {
outline: 2px solid var(--focus);
outline-offset: 1px;
}
-.adm-chips-empty {
+.adm-tags-empty {
font-size: 13px;
color: var(--ink-muted);
margin-right: 4px;
}
-.adm-chips-add {
+.adm-tags-add {
min-width: 170px;
}
.adm-risky-actions {
@@ -785,6 +747,10 @@
text-overflow: ellipsis;
white-space: nowrap;
}
+ /* Phones stack the rows, so the headings are hidden, as on every list (ColumnHeads). */
+ .adm-list > .ib-cols.adm-row-head {
+ display: none;
+ }
/* A row stacks: the first column on its own line at full width, the other columns on one quiet line under it
("Last sign-in Nov 18 · Plan Starter"), the ⋯ at the right of the first line. Nothing squeezes the name or the address. */
.adm-list > .adm-row:not(.adm-row-head),
@@ -833,16 +799,6 @@
.adm-list-acts > .adm-row:not(.adm-row-head) > .adm-cell:first-child {
order: -2;
}
- /* The head keeps only what sorts: its labels side by side. */
- .adm-row.adm-row-head,
- .adm-list-acts > .adm-row.adm-row-head,
- .adm-list-acts > .adm-row.adm-row-head:has(> :nth-child(4):not(.adm-cell-acts)) {
- display: flex;
- gap: 16px;
- }
- .adm-row-head > .adm-cell-acts {
- display: none;
- }
.adm-facts > div {
grid-template-columns: minmax(0, 1fr);
gap: 2px;
@@ -884,20 +840,6 @@
font-size: 11.5px;
color: var(--ink-muted);
}
-.adm-card-head {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- gap: 12px;
-}
-.adm-card-head h2 {
- margin: 0;
- font-size: 14px;
- font-weight: 600;
-}
-.adm-card-head p {
- margin: 2px 0 0;
-}
/* "Ready for calls" (StatusCard.tsx): one calm line, the parts as list rows (ui/list.tsx) under it. */
.adm-ready {
gap: 10px;
@@ -1117,7 +1059,7 @@
.adm-sk-rows .sk-row {
padding: 0 12px;
}
-.adm-card.load-problem {
+.k-card.load-problem {
max-width: none;
margin: 0;
padding: 28px 20px;
@@ -1157,7 +1099,7 @@
.adm-audit-more-kinds {
display: inline-flex;
}
-.adm-audit-more-kinds .adm-chip {
+.adm-audit-more-kinds .k-chip {
gap: 4px;
padding-right: 8px;
}
@@ -1171,7 +1113,7 @@
/* On a phone the chips stay one row that scrolls sideways; the person and workspace each take a line, the dates share
one. */
@media (max-width: 559px) {
- .adm-chips.adm-audit-kinds {
+ .k-chips.adm-audit-kinds {
flex-wrap: nowrap;
overflow-x: auto;
scrollbar-width: none;
@@ -1388,11 +1330,6 @@
white-space: nowrap;
text-overflow: ellipsis;
}
-.adm-prov-error-details > summary {
- width: fit-content;
- cursor: pointer;
- color: var(--ink-muted);
-}
.adm-prov-error-full {
display: grid;
gap: 2px;
@@ -1446,24 +1383,12 @@
margin: 0;
}
/* "How to get a key" in the dialog, "How to set it up" for call audio: open until it works. */
-.adm-guide {
- padding: 10px 12px;
+.adm-guide .k-fold-body {
+ gap: 6px;
font-size: 13px;
- background: var(--bg);
- border-radius: var(--radius-md);
-}
-.adm-guide summary {
- cursor: pointer;
- font-weight: 500;
-}
-.adm-guide[open] summary {
- margin-bottom: 6px;
-}
-.adm-guide > :last-child {
- margin-bottom: 0;
}
.adm-guide-steps {
- margin: 0 0 6px;
+ margin: 0;
padding-left: 18px;
display: grid;
gap: 3px;
@@ -1872,15 +1797,7 @@
user-select: none;
cursor: default;
}
-.adm-prompt-default {
- font-size: 12px;
- color: var(--ink-muted);
-}
-.adm-prompt-default summary {
- cursor: pointer;
-}
.adm-prompt-default .adm-prompt-text {
- margin-top: 4px;
font-size: 12px;
}
@@ -1894,47 +1811,6 @@
.adm-billhome > .k-line-group:first-of-type {
margin-top: 0;
}
-/* The bills filter: one chip per status that has bills, with its count. */
-.adm-chips {
- display: flex;
- flex-wrap: wrap;
- gap: 6px;
-}
-.adm-chip {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- height: var(--control-h-sm);
- padding: 0 10px;
- border: 1px solid var(--line);
- border-radius: var(--radius-full);
- background: var(--surface);
- color: var(--ink-muted);
- font: inherit;
- font-size: 12.5px;
- font-weight: 500;
- cursor: pointer;
-}
-.adm-chip:hover {
- color: var(--ink);
-}
-/* A chip that is a link to a view of its own (Partners: All, Waiting for approval). */
-a.adm-chip {
- text-decoration: none;
-}
-.adm-chip[aria-pressed="true"],
-.adm-chip[aria-current="page"] {
- border-color: var(--ink);
- color: var(--ink);
-}
-.adm-chip:focus-visible {
- outline: 2px solid var(--focus);
- outline-offset: 2px;
-}
-.adm-chip .n {
- font-variant-numeric: tabular-nums;
- color: var(--ink-muted);
-}
.adm-rules {
display: grid;
gap: 12px;
diff --git a/apps/web/src/admin/parts.tsx b/apps/web/src/admin/parts.tsx
index 5a3a4c86..a4bcba73 100644
--- a/apps/web/src/admin/parts.tsx
+++ b/apps/web/src/admin/parts.tsx
@@ -39,7 +39,7 @@ export function SortTh<K extends string>({ label, column, first = 'asc', sort, o
>
<button
type="button"
- className="adm-sort"
+ className="k-sort"
title={t('admin.list.sortBy', { column: label })}
onClick={() => onSort(column, first)}
>
diff --git a/apps/web/src/integrations/Integrations.tsx b/apps/web/src/integrations/Integrations.tsx
index ef0dcf4c..c4b8de3d 100644
--- a/apps/web/src/integrations/Integrations.tsx
+++ b/apps/web/src/integrations/Integrations.tsx
@@ -63,6 +63,7 @@ import { markFromIntegrations } from './fromIntegrations.tsx'
import { IntegrationMark } from './IntegrationMark.tsx'
import { SupportEmailPage } from './SupportEmail.tsx'
import { connectPlan } from './connectPlan.ts'
+import { ListEmpty } from '../ui/list.tsx'
import './integrations.css'
const SEARCH_ID = 'integrations-search'
@@ -305,7 +306,7 @@ function Catalog({ canManageKeys, toast }: Props) {
</section>
)}
{groups.length === 0 && folded.length === 0 ? (
- <p className="ig-empty">{t('settings.integrations.search.none', { query })}</p>
+ <ListEmpty>{t('settings.integrations.search.none', { query })}</ListEmpty>
) : (
groups.map(g => (
<section key={g.category} className="ig-group" aria-labelledby={`ig-cat-${g.category}`}>
diff --git a/apps/web/src/integrations/integrations.css b/apps/web/src/integrations/integrations.css
index b96a4016..324a1650 100644
--- a/apps/web/src/integrations/integrations.css
+++ b/apps/web/src/integrations/integrations.css
@@ -52,10 +52,6 @@
outline: 2px solid var(--focus);
outline-offset: 2px;
}
-.ig-empty {
- margin: 8px 0;
- color: var(--ink-muted);
-}
.ig-group {
display: grid;
gap: 8px;
diff --git a/apps/web/src/settings/AssistantSettings.tsx b/apps/web/src/settings/AssistantSettings.tsx
index ee0b5c75..cf23e78e 100644
--- a/apps/web/src/settings/AssistantSettings.tsx
+++ b/apps/web/src/settings/AssistantSettings.tsx
@@ -120,6 +120,7 @@ import { TestCallPanel } from './TestCallPanel.tsx'
import { TransferContacts, transferFieldId } from './TransferContacts.tsx'
import { RealtimeVoiceSettings, useVoiceOptions, VoiceLoading, VoiceSettings } from './VoiceSettings.tsx'
import { WEBHOOK_SECTION_ID, Webhooks } from './Webhooks.tsx'
+import { FoldOutButton } from '../ui/FoldOut.tsx'
type SectionId = 'general' | 'business' | 'hours' | 'rules' | 'transfers' | 'emails' | 'booking' | 'advanced'
const SECTION_IDS: readonly SectionId[] = [
@@ -392,9 +393,7 @@ function Greeting({
)}
{canAddOutside && (
<div className="as-greet-add">
- <Button size="sm" variant="ghost" icon="plus" onClick={outsideGreeting.add}>
- {t('settings.assistant.greeting.addOutside')}
- </Button>
+ <FoldOutButton onClick={outsideGreeting.add}>{t('settings.assistant.greeting.addOutside')}</FoldOutButton>
</div>
)}
</Section>
diff --git a/apps/web/src/settings/CallQuality.tsx b/apps/web/src/settings/CallQuality.tsx
index f2ccaf39..0945d1d8 100644
--- a/apps/web/src/settings/CallQuality.tsx
+++ b/apps/web/src/settings/CallQuality.tsx
@@ -18,12 +18,13 @@ import { useState } from 'react'
import { i18n } from '../i18n/index.tsx'
import { LinkButton } from '../ui/AppLink.tsx'
import { RadioCard, Select, type SelectOption } from '../ui/controls.tsx'
-import { Badge, Icon } from '../ui/kit.tsx'
+import { Badge } from '../ui/kit.tsx'
import { SettingRow } from '../ui/SettingRow.tsx'
import type { Draft } from './assistantDraft.ts'
import { Section } from './fields.tsx'
import { DEFAULT_CHOICE, levelName, levelPrice, pricePerMinute } from './levelModel.ts'
import { useVoiceOptions } from './VoiceSettings.tsx'
+import { FoldOut } from '../ui/FoldOut.tsx'
type Picks = Pick<Draft, 'call_quality' | 'voice' | 'llm_model' | 'realtime_model'>
@@ -135,89 +136,88 @@ export function CallQualitySettings({ picks, onChange, name, savedLevel }: Props
</div>
{anyLocked && <p className="help">{t('settings.voice.quality.adminsChange')}</p>}
{current && (
- <details className="vp-more cq-models" open={open} onToggle={e => setOpen(e.currentTarget.open)}>
- <summary>
- <Icon name="down" size={14} className="vp-chevron" />
- {open ? t('settings.voice.quality.hideModels') : t('settings.voice.quality.showModels')}
- </summary>
- <div className="vp-more-body">
- {level === 'ultra' ? (
- <SettingRow
- title={t('settings.voice.quality.realtimeModel')}
- description={t('settings.voice.quality.realtimeModelHelp')}
- control={
- <Select
- id="as-realtime-model"
- size="sm"
- align="end"
- value={picks.realtime_model}
- options={modelOptions(current.realtimeModels, current.defaults.realtime, picks.realtime_model)}
- onChange={realtime_model => onChange({ ...picks, realtime_model })}
- label={t('settings.voice.quality.realtimeModel')}
- />
- }
- />
- ) : (
+ <FoldOut
+ open={open}
+ onToggle={setOpen}
+ summary={t('settings.voice.quality.showModels')}
+ openSummary={t('settings.voice.quality.hideModels')}
+ >
+ {level === 'ultra' ? (
+ <SettingRow
+ title={t('settings.voice.quality.realtimeModel')}
+ description={t('settings.voice.quality.realtimeModelHelp')}
+ control={
+ <Select
+ id="as-realtime-model"
+ size="sm"
+ align="end"
+ value={picks.realtime_model}
+ options={modelOptions(current.realtimeModels, current.defaults.realtime, picks.realtime_model)}
+ onChange={realtime_model => onChange({ ...picks, realtime_model })}
+ label={t('settings.voice.quality.realtimeModel')}
+ />
+ }
+ />
+ ) : (
+ <>
+ {current.models.length > 0 && (
+ <SettingRow
+ title={t('settings.voice.quality.languageModel')}
+ description={t('settings.voice.quality.languageModelHelp', { name })}
+ control={
+ <Select
+ id="as-llm-model"
+ size="sm"
+ align="end"
+ value={picks.llm_model}
+ options={modelOptions(current.models, current.defaults.llm, picks.llm_model)}
+ onChange={llm_model => onChange({ ...picks, llm_model })}
+ label={t('settings.voice.quality.languageModel')}
+ />
+ }
+ />
+ )}
+ {voiceChoices.length > 0 && (
+ <SettingRow
+ title={t('settings.voice.quality.voiceModel')}
+ description={t('settings.voice.quality.voiceModelHelp')}
+ control={
+ <Select
+ id="as-voice-model"
+ size="sm"
+ align="end"
+ value={picks.voice.model}
+ options={modelOptions(
+ voiceChoices,
+ current.defaults.voice[picks.voice.provider],
+ picks.voice.model,
+ )}
+ onChange={model => onChange({ ...picks, voice: { ...picks.voice, model } })}
+ label={t('settings.voice.quality.voiceModel')}
+ />
+ }
+ />
+ )}
+ </>
+ )}
+ <p className="help cq-foot">
+ {price
+ ? t('settings.voice.quality.footPrice', { level: levelName(level), price })
+ : t('settings.voice.quality.foot', { level: levelName(level) })}
+ {ownPicks && (
<>
- {current.models.length > 0 && (
- <SettingRow
- title={t('settings.voice.quality.languageModel')}
- description={t('settings.voice.quality.languageModelHelp', { name })}
- control={
- <Select
- id="as-llm-model"
- size="sm"
- align="end"
- value={picks.llm_model}
- options={modelOptions(current.models, current.defaults.llm, picks.llm_model)}
- onChange={llm_model => onChange({ ...picks, llm_model })}
- label={t('settings.voice.quality.languageModel')}
- />
- }
- />
- )}
- {voiceChoices.length > 0 && (
- <SettingRow
- title={t('settings.voice.quality.voiceModel')}
- description={t('settings.voice.quality.voiceModelHelp')}
- control={
- <Select
- id="as-voice-model"
- size="sm"
- align="end"
- value={picks.voice.model}
- options={modelOptions(
- voiceChoices,
- current.defaults.voice[picks.voice.provider],
- picks.voice.model,
- )}
- onChange={model => onChange({ ...picks, voice: { ...picks.voice, model } })}
- label={t('settings.voice.quality.voiceModel')}
- />
- }
- />
- )}
+ {' '}
+ <LinkButton
+ onClick={() =>
+ onChange({ ...picks, llm_model: '', realtime_model: '', voice: { ...picks.voice, model: '' } })
+ }
+ >
+ {t('settings.voice.quality.backToDefaults')}
+ </LinkButton>
</>
)}
- <p className="help cq-foot">
- {price
- ? t('settings.voice.quality.footPrice', { level: levelName(level), price })
- : t('settings.voice.quality.foot', { level: levelName(level) })}
- {ownPicks && (
- <>
- {' '}
- <LinkButton
- onClick={() =>
- onChange({ ...picks, llm_model: '', realtime_model: '', voice: { ...picks.voice, model: '' } })
- }
- >
- {t('settings.voice.quality.backToDefaults')}
- </LinkButton>
- </>
- )}
- </p>
- </div>
- </details>
+ </p>
+ </FoldOut>
)}
</Section>
)
diff --git a/apps/web/src/settings/Knowledge.tsx b/apps/web/src/settings/Knowledge.tsx
index 2fa5661f..4e6885fa 100644
--- a/apps/web/src/settings/Knowledge.tsx
+++ b/apps/web/src/settings/Knowledge.tsx
@@ -31,6 +31,7 @@ import { callAction } from './settings-api.ts'
import { WriteWithHelp } from './WriteWithHelp.tsx'
import { OpenQuestionRow, useOpenQuestions } from './OpenQuestions.tsx'
import { SuggestedRow, useSuggestions } from './SuggestedQuestions.tsx'
+import { ListEmpty } from '../ui/list.tsx'
import './knowledge.css'
type Props = {
@@ -286,7 +287,7 @@ function Questions(props: QuestionsProps) {
</div>
)}
{nothing ? (
- <p className="kn-sub kn-empty">{t('settings.knowledge.qa.empty')}</p>
+ <ListEmpty>{t('settings.knowledge.qa.empty')}</ListEmpty>
) : (
<>
<div className="kn-qlist">
@@ -334,7 +335,7 @@ function Questions(props: QuestionsProps) {
)}
</div>
{whole && groups.length + suggestions.length + answers.length === 0 && (
- <p className="kn-sub kn-empty">{t('settings.knowledge.qa.noMatch')}</p>
+ <ListEmpty>{t('settings.knowledge.qa.noMatch')}</ListEmpty>
)}
<div className="kn-mores">
{more(
diff --git a/apps/web/src/settings/TransferContacts.tsx b/apps/web/src/settings/TransferContacts.tsx
index 2fc37b93..eefded26 100644
--- a/apps/web/src/settings/TransferContacts.tsx
+++ b/apps/web/src/settings/TransferContacts.tsx
@@ -41,6 +41,7 @@ import { i18n } from '../i18n/index.tsx'
import { fmt, intlLocale } from '../i18n/format.ts'
import { shortDuration } from '../time.ts'
import { type ContactWho, useContactWho } from './transferOwner.ts'
+import { ListEmpty } from '../ui/list.tsx'
const FALLBACKS: { value: TransferFallback; label: MessageKey }[] = [
{ value: 'message', label: msg('settings.transfer.fallback.message') },
@@ -180,7 +181,7 @@ export function TransferContacts({ transfers, onChange, hoursOn, assistantName,
})}
</ol>
) : (
- <p className="tc-empty">{t('settings.transfer.empty', { name: assistantName })}</p>
+ <ListEmpty>{t('settings.transfer.empty', { name: assistantName })}</ListEmpty>
)}
</Section>
)
diff --git a/apps/web/src/settings/VoiceSettings.tsx b/apps/web/src/settings/VoiceSettings.tsx
index 22626bf7..a4a21ffa 100644
--- a/apps/web/src/settings/VoiceSettings.tsx
+++ b/apps/web/src/settings/VoiceSettings.tsx
@@ -62,6 +62,7 @@ import {
voiceKey,
voiceWords,
} from './voiceModel.ts'
+import { FoldOut } from '../ui/FoldOut.tsx'
const VOICE_OPTIONS = 'voice.options'
const VOICE_CATALOG = 'voice.catalog'
@@ -371,7 +372,7 @@ export function MoreVoices({
error={error}
onRetry={onRetry}
skeleton={
- <div className="vp-more-body">
+ <div className="vp-voices">
<Skeleton shape="field" width="100%" />
<SkeletonList rows={4} lead={16} />
</div>
@@ -382,7 +383,7 @@ export function MoreVoices({
// No voice to show because a provider's list could not be read: one problem with Try again, not "No voices yet".
if (!voices.length && failed.length)
return (
- <div className="vp-more-body">
+ <div className="vp-voices">
<CatalogProblem failed={failed} onRetry={onRetry} />
<ProviderHints providers={catalog.providers} />
</div>
@@ -422,7 +423,7 @@ export function MoreVoices({
},
]
return (
- <div className="vp-more-body">
+ <div className="vp-voices">
<div className="vp-tools">
<span className="vp-search">
<Icon name="search" size={14} />
@@ -621,8 +622,7 @@ function CloneVoice({
}
}
return (
- <details className="vc-clone">
- <summary>{t('settings.voice.clone.title')}</summary>
+ <FoldOut className="vc-clone" summary={t('settings.voice.clone.title')}>
<Field id="vc-clone-name" label={t('settings.voice.clone.name')}>
<TextInput
id="vc-clone-name"
@@ -654,7 +654,7 @@ function CloneVoice({
</Button>
<span className="help">{t('settings.voice.clone.notKept')}</span>
</div>
- </details>
+ </FoldOut>
)
}
@@ -912,11 +912,7 @@ export function VoiceSettings({
</p>
)}
{failure && <FormMessage>{failure.message}</FormMessage>}
- <details className="vp-more" onToggle={e => setMoreOpen(e.currentTarget.open)}>
- <summary title={t('settings.voice.moreTip')}>
- <Icon name="down" size={14} className="vp-chevron" />
- {t('settings.voice.more')}
- </summary>
+ <FoldOut onToggle={setMoreOpen} title={t('settings.voice.moreTip')} summary={t('settings.voice.more')}>
{moreOpen && (
<MoreVoices
catalog={catalog}
@@ -932,7 +928,7 @@ export function VoiceSettings({
preview={preview}
/>
)}
- </details>
+ </FoldOut>
{options?.canClone && <CloneVoice assistantId={assistantId} toast={toast} disabled={!canEdit} />}
</Section>
)
@@ -984,8 +980,8 @@ export function VoiceLoading({ children }: { children: ReactNode }) {
<>
<div className="vp-group-label">{t('settings.voice.suggested')}</div>
<VoiceRowsSkeleton rows={VOICE_SKELETON_ROWS} />
- <div className="vp-more">
- <span className="vp-more-sk">
+ <div className="k-fold">
+ <span className="k-fold-sk">
<Skeleton width={14} height={14} />
<Skeleton shape="text" width={76} />
</span>
@@ -1085,11 +1081,7 @@ export function RealtimeVoiceSettings({
))}
</div>
{failure && <FormMessage>{failure.message}</FormMessage>}
- <details className="vp-more" onToggle={e => setMoreOpen(e.currentTarget.open)}>
- <summary title={t('settings.voice.realtime.moreTip')}>
- <Icon name="down" size={14} className="vp-chevron" />
- {t('settings.voice.more')}
- </summary>
+ <FoldOut onToggle={setMoreOpen} title={t('settings.voice.realtime.moreTip')} summary={t('settings.voice.more')}>
{moreOpen && (
<MoreVoices
catalog={catalog}
@@ -1106,7 +1098,7 @@ export function RealtimeVoiceSettings({
openOn=""
/>
)}
- </details>
+ </FoldOut>
<p className="help">
{t('settings.voice.quality.ultraVoices')}{' '}
<T k="settings.assistant.realtimeVoice.body" values={{ link: adminLink('#admin/providers/answering') }} />
diff --git a/apps/web/src/settings/assistant.css b/apps/web/src/settings/assistant.css
index 00134037..d5183c47 100644
--- a/apps/web/src/settings/assistant.css
+++ b/apps/web/src/settings/assistant.css
@@ -101,7 +101,6 @@
display: flex;
flex-wrap: wrap;
gap: 4px;
- margin-left: -8px;
}
.as-numbers {
display: flex;
@@ -344,34 +343,15 @@ a.as-chip:hover {
display: grid;
gap: 12px;
}
-.vp-more > summary,
-.vp-more-sk {
+/* More voices' list in its fold-out (FoldOut), and the fold-out's line while the voices load. */
+.vp-voices {
+ display: grid;
+ gap: 10px;
+}
+.k-fold-sk {
display: inline-flex;
align-items: center;
gap: 4px;
- font-size: 12px;
- font-weight: 500;
- color: var(--ink-muted);
- cursor: pointer;
- list-style: none;
-}
-.vp-more > summary::-webkit-details-marker {
- display: none;
-}
-.vp-more > summary:hover {
- color: var(--ink);
-}
-.vp-chevron {
- transform: rotate(-90deg);
- transition: transform 120ms ease;
-}
-.vp-more[open] .vp-chevron {
- transform: none;
-}
-.vp-more-body {
- display: grid;
- gap: 10px;
- margin-top: 10px;
}
.vp-problem {
display: flex;
@@ -410,12 +390,6 @@ a.as-chip:hover {
.vc-clone {
border-top: 1px solid var(--line);
padding-top: 12px;
- display: grid;
- gap: 12px;
-}
-.vc-clone > summary {
- cursor: pointer;
- font-weight: 500;
}
.vc-actions {
display: flex;
@@ -780,10 +754,6 @@ a.as-chip:hover {
gap: 8px;
margin-left: auto;
}
-.tc-empty {
- margin: 0;
- color: var(--ink-muted);
-}
@media (max-width: 640px) {
/* The actions go under the text, so the name and condition keep the full width. */
.tc-line {
diff --git a/apps/web/src/settings/knowledge.css b/apps/web/src/settings/knowledge.css
index 8d0dd2ef..dfe68b80 100644
--- a/apps/web/src/settings/knowledge.css
+++ b/apps/web/src/settings/knowledge.css
@@ -209,12 +209,6 @@ a.kn-sub:hover {
display: block;
margin-top: var(--space-2);
}
-.kn-empty {
- margin: 0;
- padding: var(--space-3);
- border: 1px dashed var(--line);
- border-radius: var(--radius-md);
-}
.kn-toolbar {
display: flex;
flex-wrap: wrap;
diff --git a/apps/web/src/ui/FilterChips.tsx b/apps/web/src/ui/FilterChips.tsx
new file mode 100644
index 00000000..77f4331b
--- /dev/null
+++ b/apps/web/src/ui/FilterChips.tsx
@@ -0,0 +1,64 @@
+// The one filter chip row (Server admin's views and filters: Workspaces, Users, Partners, Bills, Audit log): a row of
+// quiet rounded chips above a list, the picked one outlined in ink. A chip is a button that filters in place
+// (`pressed`) or a link to a view with its own address (`href`, `current`). Styles in filter-chips.css.
+import type { ComponentProps, ReactNode, Ref } from 'react'
+import { useFormat } from '@linedesk/i18n/react'
+import { cx } from './kit.tsx'
+import './filter-chips.css'
+
+type ChipsProps = {
+ /** What the chips choose, for screen readers ("Show bills"). */
+ label: string
+ /** Links to views of their own: a `nav` instead of a button group. */
+ nav?: boolean
+ className?: string
+ ref?: Ref<HTMLDivElement>
+ children: ReactNode
+}
+
+export function FilterChips({ label, nav, className, ref, children }: ChipsProps) {
+ if (nav)
+ return (
+ <nav className={cx('k-chips', className)} aria-label={label}>
+ {children}
+ </nav>
+ )
+ return (
+ <div ref={ref} className={cx('k-chips', className)} role="group" aria-label={label}>
+ {children}
+ </div>
+ )
+}
+
+type ChipProps = {
+ /** A count after the label, in grey. */
+ count?: number | null
+ children: ReactNode
+} & (
+ | ({ href?: undefined; pressed: boolean } & Omit<ComponentProps<'button'>, 'children'>)
+ | { href: string; current: boolean; pressed?: undefined }
+)
+
+/** One chip: a button that filters (`pressed`), or a link to a view (`href`, `current`). */
+export function FilterChip(props: ChipProps) {
+ const format = useFormat()
+ const { count, children } = props
+ const body = (
+ <>
+ {children}
+ {count != null && <span className="k-chip-n">{format.number(count)}</span>}
+ </>
+ )
+ if (props.href !== undefined)
+ return (
+ <a href={props.href} className="k-chip" aria-current={props.current ? 'page' : undefined}>
+ {body}
+ </a>
+ )
+ const { pressed, count: _count, children: _children, className, ...rest } = props
+ return (
+ <button type="button" {...rest} className={cx('k-chip', className)} aria-pressed={pressed}>
+ {body}
+ </button>
+ )
+}
diff --git a/apps/web/src/ui/FoldOut.tsx b/apps/web/src/ui/FoldOut.tsx
new file mode 100644
index 00000000..e162a916
--- /dev/null
+++ b/apps/web/src/ui/FoldOut.tsx
@@ -0,0 +1,56 @@
+// The one fold-out: a quiet line with a chevron that opens what most people don't need ("Show default models", "More
+// voices", "How to get a key"). Native <details>, so it works with the keyboard and find-in-page. The chevron points
+// right while closed and down while open. `FoldOutButton` is the same line for an opener that adds something instead
+// of showing it (a second greeting). Styles in fold-out.css.
+import type { ReactNode } from 'react'
+import { cx, Icon } from './kit.tsx'
+import './fold-out.css'
+
+type Props = {
+ /** The line's words; `openSummary`: its words while open ("Hide default models"). */
+ summary: ReactNode
+ openSummary?: ReactNode
+ /** Controlled: open now. Leave out to let the fold-out keep its own state (`defaultOpen` to start open). */
+ open?: boolean
+ defaultOpen?: boolean
+ onToggle?: (open: boolean) => void
+ /** The summary's tooltip. */
+ title?: string
+ className?: string
+ children: ReactNode
+}
+
+export function FoldOut({ summary, openSummary, open, defaultOpen, onToggle, title, className, children }: Props) {
+ return (
+ <details
+ className={cx('k-fold', className)}
+ open={open ?? defaultOpen}
+ onToggle={e => onToggle?.(e.currentTarget.open)}
+ >
+ <summary title={title}>
+ <Icon name="down" size={14} className="k-fold-chevron" />
+ <span className="k-fold-closed">{summary}</span>
+ {openSummary && <span className="k-fold-open">{openSummary}</span>}
+ </summary>
+ <div className="k-fold-body">{children}</div>
+ </details>
+ )
+}
+
+/** The fold-out's line as a button: it adds or opens something in place (a second greeting). */
+export function FoldOutButton({
+ onClick,
+ title,
+ children,
+}: {
+ onClick: () => void
+ title?: string
+ children: ReactNode
+}) {
+ return (
+ <button type="button" className="k-fold-button" title={title} onClick={onClick}>
+ <Icon name="down" size={14} className="k-fold-chevron" />
+ {children}
+ </button>
+ )
+}
diff --git a/apps/web/src/ui/filter-chips.css b/apps/web/src/ui/filter-chips.css
new file mode 100644
index 00000000..893d6232
--- /dev/null
+++ b/apps/web/src/ui/filter-chips.css
@@ -0,0 +1,40 @@
+/* FilterChips (FilterChips.tsx): the one filter chip row above a list; the picked chip outlined in ink. */
+.k-chips {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 6px;
+}
+.k-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ height: var(--control-h-sm);
+ padding: 0 10px;
+ border: 1px solid var(--line);
+ border-radius: var(--radius-full);
+ background: var(--surface);
+ color: var(--ink-muted);
+ font: inherit;
+ font-size: 12.5px;
+ font-weight: 500;
+ white-space: nowrap;
+ text-decoration: none;
+ cursor: pointer;
+}
+.k-chip:hover {
+ color: var(--ink);
+}
+.k-chip[aria-pressed="true"],
+.k-chip[aria-current="page"] {
+ border-color: var(--ink);
+ color: var(--ink);
+}
+.k-chip:focus-visible {
+ outline: 2px solid var(--focus);
+ outline-offset: 2px;
+}
+.k-chip-n {
+ font-variant-numeric: tabular-nums;
+ color: var(--ink-muted);
+}
diff --git a/apps/web/src/ui/fold-out.css b/apps/web/src/ui/fold-out.css
new file mode 100644
index 00000000..ee92379f
--- /dev/null
+++ b/apps/web/src/ui/fold-out.css
@@ -0,0 +1,50 @@
+/* FoldOut (FoldOut.tsx): a quiet line with a chevron, right while closed, down while open. */
+.k-fold > summary,
+.k-fold-button {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ padding: 0;
+ border: 0;
+ background: none;
+ font: inherit;
+ font-size: 12px;
+ font-weight: 500;
+ color: var(--ink-muted);
+ cursor: pointer;
+ list-style: none;
+}
+.k-fold > summary::-webkit-details-marker {
+ display: none;
+}
+.k-fold > summary:hover,
+.k-fold-button:hover {
+ color: var(--ink);
+}
+.k-fold > summary:focus-visible,
+.k-fold-button:focus-visible {
+ outline: 2px solid var(--focus);
+ outline-offset: 2px;
+ border-radius: var(--radius-xs);
+}
+.k-fold-chevron {
+ transform: rotate(-90deg);
+ transition: transform 120ms ease;
+}
+.k-fold[open] > summary > .k-fold-chevron {
+ transform: none;
+}
+.k-fold[open]:has(> summary > .k-fold-open) > summary > .k-fold-closed,
+.k-fold:not([open]) > summary > .k-fold-open {
+ display: none;
+}
+.k-fold-body {
+ display: grid;
+ gap: 10px;
+ margin-top: 10px;
+}
+@media (prefers-reduced-motion: reduce) {
+ .k-fold-chevron {
+ transition: none;
+ }
+}
diff --git a/apps/web/src/ui/list.css b/apps/web/src/ui/list.css
index bb92c1a6..6dbf9557 100644
--- a/apps/web/src/ui/list.css
+++ b/apps/web/src/ui/list.css
@@ -186,3 +186,27 @@
flex-basis: 150px;
}
}
+
+/* A column heading that sorts its list (ColumnHeads, `onSort`). */
+.k-sort {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ padding: 0;
+ border: 0;
+ background: none;
+ font: inherit;
+ color: inherit;
+ cursor: pointer;
+}
+.k-sort:hover {
+ color: var(--ink);
+}
+.k-sort:focus-visible {
+ outline: 2px solid var(--focus);
+ outline-offset: 2px;
+ border-radius: var(--radius-xs);
+}
+.k-sort span {
+ width: 8px;
+}
diff --git a/apps/web/src/ui/list.tsx b/apps/web/src/ui/list.tsx
index 0a0eb823..5638c6e2 100644
--- a/apps/web/src/ui/list.tsx
+++ b/apps/web/src/ui/list.tsx
@@ -61,30 +61,71 @@ export function ListRow({ lead, title, sub, aside, actions, below, off, classNam
)
}
+/** A column heading that sorts its list: a button with the direction's arrow (Server admin's lists). */
+export type ColumnHead = {
+ label: string
+ className?: string
+ /** This column sorts the list now, in this direction; null: it can sort, but doesn't now. */
+ sort?: 'asc' | 'desc' | null
+ onSort?: () => void
+ /** The sort button's tooltip ("Sort by Name"). */
+ sortTitle?: string
+}
+
/**
- * Column headings above a page's list of grid rows (inbox calls, contacts): muted, sticky while the
- * list scrolls, on the rows' own grid (the list sets `grid-template-columns` for both; styles under
- * `.ib-cols` in styles.css and app.css). Phones stack the rows, so the headings are hidden there.
- * Screen readers skip them: each row already says what it is. `lead` sits in the rows' gutter, where
- * their checkboxes are (the inbox's select-all box).
+ * Column headings above a page's list of grid rows (inbox calls, contacts, Server admin's lists): muted, sticky while
+ * the list scrolls, on the rows' own grid (the list sets `grid-template-columns` for both; styles under `.ib-cols` in
+ * styles.css and app.css). Phones stack the rows, so the headings are hidden there. Screen readers skip them: each
+ * row already says what it is. `lead` sits in the rows' gutter, where their checkboxes are (the inbox's select-all
+ * box). `table`: the headings of a `role="table"` list (a row of column headers, a heading with `onSort` a button);
+ * `trailing`: an empty heading over the rows' actions.
*/
export function ColumnHeads({
labels,
lead,
+ table,
+ trailing,
className,
ref,
}: {
- labels: readonly string[]
+ labels: readonly (string | ColumnHead)[]
lead?: ReactNode
+ table?: boolean
+ trailing?: ReactNode
className?: string
ref?: Ref<HTMLDivElement>
}) {
+ const heads = labels.map(l => (typeof l === 'string' ? { label: l } : l))
+ if (table)
+ return (
+ <div className={cx('ib-cols', className)} role="row" ref={ref}>
+ {lead}
+ {heads.map(h => (
+ <div
+ key={h.label}
+ role="columnheader"
+ className={h.className}
+ aria-sort={h.sort ? (h.sort === 'asc' ? 'ascending' : 'descending') : undefined}
+ >
+ {h.onSort ? (
+ <button type="button" className="k-sort" title={h.sortTitle} onClick={h.onSort}>
+ {h.label}
+ <span aria-hidden="true">{h.sort === 'asc' ? '↑' : h.sort === 'desc' ? '↓' : ''}</span>
+ </button>
+ ) : (
+ h.label
+ )}
+ </div>
+ ))}
+ {trailing}
+ </div>
+ )
return (
<div className={cx('ib-cols', className)} role="presentation" ref={ref}>
{lead}
- {labels.map(label => (
- <span key={label} aria-hidden="true">
- {label}
+ {heads.map(h => (
+ <span key={h.label} aria-hidden="true" className={h.className}>
+ {h.label}
</span>
))}
</div>