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.

Server admin: one list frame for every list, chips for filters, detail actions in the header (PR 1919)

Janik8cd7ddd27c49
diff --git a/apps/web/src/admin/AdminList.tsx b/apps/web/src/admin/AdminList.tsx
index 6efa03f5..089c7ea2 100644
--- a/apps/web/src/admin/AdminList.tsx
+++ b/apps/web/src/admin/AdminList.tsx
@@ -2,8 +2,12 @@
// / searches) and a click that opens the row. `rowActions` adds quick actions in a column of their own at the end of
// a row, so they never cover a cell's text. A list whose rows have no page of their own (Partners) leaves out
// `onOpen`: a row then opens nothing, and Enter moves focus to its actions.
+//
+// The frame's parts are exported for lists that page or filter on the server (Audit log, Billing › Review and Stripe
+// events): `ListSearch` (the search field on top) and `ListTable` (the headings, the rows and the empty line), in
+// `ListCard`. So every admin list has one look, whether it sorts in the browser or not.
import { useT } from '@linedesk/i18n/react'
-import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { type KeyboardEvent, type ReactNode, type Ref, useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { cx, Icon } from '../ui/kit.tsx'
import { ShortcutHints } from '../ui/listPage.tsx'
import { type SortDir, sortRows } from './model.ts'
@@ -24,6 +28,129 @@ export type Column<T> = {
/** Keys the list handles; admin mode routes them here while the list is shown. */
export type ListKeys = (key: string) => boolean
+/** The raised card a list sits in. */
+export function ListCard({ children }: { children: ReactNode }) {
+ return <div className="k-card adm-listcard">{children}</div>
+}
+
+/** The search field on top of a list; / focuses it (AdminMode routes the key). */
+export function ListSearch({
+ value,
+ onChange,
+ label,
+ inputRef,
+ onKeyDown,
+}: {
+ value: string
+ onChange: (value: string) => void
+ label: string
+ inputRef?: Ref<HTMLInputElement>
+ onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void
+}) {
+ return (
+ <label className="k-input adm-search">
+ <Icon name="search" size={15} />
+ <input
+ ref={inputRef}
+ value={value}
+ placeholder={label}
+ aria-label={label}
+ onChange={e => onChange(e.target.value)}
+ onKeyDown={onKeyDown}
+ />
+ <kbd className="k-kbd">/</kbd>
+ </label>
+ )
+}
+
+type TableProps<T> = {
+ rows: readonly T[]
+ rowId: (row: T) => string
+ columns: Column<T>[]
+ /** The table's name for screen readers. */
+ label: string
+ /** The column the rows are sorted by now; with `onSort`, the sortable headings are buttons. */
+ sort?: { key: string; dir: SortDir }
+ onSort?: (column: Column<T>) => void
+ /** The keyboard cursor's row (J/K); leave out for a list without one. */
+ cursor?: number
+ onCursor?: (index: number) => void
+ onOpen?: (row: T) => void
+ rowActions?: (row: T) => ReactNode
+ /** The line in place of the rows when there are none (the headings stay above it). */
+ empty: ReactNode
+ className?: string
+ listRef?: Ref<HTMLDivElement>
+}
+
+/** The headings, the rows and the empty line of an admin list. */
+export function ListTable<T>({
+ rows,
+ rowId,
+ columns,
+ label,
+ sort,
+ onSort,
+ cursor,
+ onCursor,
+ onOpen,
+ rowActions,
+ empty,
+ className,
+ listRef,
+}: TableProps<T>) {
+ const t = useT()
+ return (
+ <div
+ className={cx('adm-list', rowActions && 'adm-list-acts', !onOpen && 'adm-list-static', className)}
+ role="table"
+ aria-label={label}
+ ref={listRef}
+ >
+ <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 && onSort ? (sort?.key === c.key ? sort.dir : null) : undefined,
+ onSort: c.sort && onSort ? () => onSort(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')} />
+ )
+ }
+ />
+ {rows.map((row, i) => (
+ <div
+ key={rowId(row)}
+ role="row"
+ tabIndex={-1}
+ data-cursor={cursor === undefined ? undefined : i === cursor}
+ className={cx('adm-row', i === cursor && 'is-cursor')}
+ onMouseEnter={onCursor && (() => onCursor(i))}
+ onClick={onOpen && (() => onOpen(row))}
+ >
+ {columns.map(c => (
+ <div
+ key={c.key}
+ role="cell"
+ data-label={c.label}
+ className={cx('adm-cell', c.numeric && 'adm-num', c.wide && 'adm-wide')}
+ >
+ {c.render(row)}
+ </div>
+ ))}
+ {rowActions && <div className="adm-cell adm-cell-acts">{rowActions(row)}</div>}
+ </div>
+ ))}
+ {!rows.length && <ListEmpty>{empty}</ListEmpty>}
+ </div>
+ )
+}
+
type Props<T> = {
rows: readonly T[]
rowId: (row: T) => string
@@ -39,8 +166,6 @@ type Props<T> = {
empty: ReactNode
/** Quick actions in the last column of a row (icons on hover, focus or the cursor; a ⋯ menu on phones and touch). */
rowActions?: (row: T) => ReactNode
- /** Controls under the search, such as a filter (Users: "No workspace"). */
- tools?: ReactNode
/** A class on the list, for its column widths (Workspaces: the number in full). */
className?: string
}
@@ -57,7 +182,6 @@ export function AdminList<T>({
keysRef,
empty,
rowActions,
- tools,
className,
}: Props<T>) {
const t = useT()
@@ -114,77 +238,39 @@ export function AdminList<T>({
return (
<>
- <div className="k-card adm-listcard">
- <label className="k-input adm-search">
- <Icon name="search" size={15} />
- <input
- ref={search}
- value={query}
- placeholder={searchLabel}
- aria-label={searchLabel}
- onChange={e => {
- setQuery(e.target.value)
- setCursor(0)
- }}
- onKeyDown={e => {
- if (e.key === 'ArrowDown' || e.key === 'Enter') {
- e.preventDefault()
- e.currentTarget.blur()
- if (e.key === 'Enter') enter(shown[at])
- }
- }}
- />
- <kbd className="k-kbd">/</kbd>
- </label>
- {tools}
- <div
- className={cx('adm-list', rowActions && 'adm-list-acts', !onOpen && 'adm-list-static', className)}
- role="table"
- aria-label={label ?? searchLabel}
- ref={list}
- >
- <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')} />
- )
+ <ListCard>
+ <ListSearch
+ inputRef={search}
+ value={query}
+ label={searchLabel}
+ onChange={value => {
+ setQuery(value)
+ setCursor(0)
+ }}
+ onKeyDown={e => {
+ if (e.key === 'ArrowDown' || e.key === 'Enter') {
+ e.preventDefault()
+ e.currentTarget.blur()
+ if (e.key === 'Enter') enter(shown[at])
}
- />
- {shown.map((row, i) => (
- <div
- key={rowId(row)}
- role="row"
- tabIndex={-1}
- data-cursor={i === at}
- className={cx('adm-row', i === at && 'is-cursor')}
- onMouseEnter={() => setCursor(i)}
- onClick={onOpen && (() => onOpen(row))}
- >
- {columns.map(c => (
- <div
- key={c.key}
- role="cell"
- data-label={c.label}
- className={cx('adm-cell', c.numeric && 'adm-num', c.wide && 'adm-wide')}
- >
- {c.render(row)}
- </div>
- ))}
- {rowActions && <div className="adm-cell adm-cell-acts">{rowActions(row)}</div>}
- </div>
- ))}
- {!shown.length && <ListEmpty>{query ? t('admin.list.noMatch', { query }) : empty}</ListEmpty>}
- </div>
- </div>
+ }}
+ />
+ <ListTable
+ rows={shown}
+ rowId={rowId}
+ columns={columns}
+ label={label ?? searchLabel}
+ sort={sort}
+ onSort={toggle}
+ cursor={at}
+ onCursor={setCursor}
+ onOpen={onOpen}
+ rowActions={rowActions}
+ empty={query ? t('admin.list.noMatch', { query }) : empty}
+ className={className}
+ listRef={list}
+ />
+ </ListCard>
<ShortcutHints
hints={[
[['⏎'], onOpen ? t('common.shortcut.open') : t('admin.list.actions')],
diff --git a/apps/web/src/admin/AdminMode.tsx b/apps/web/src/admin/AdminMode.tsx
index 7601230b..15ec2358 100644
--- a/apps/web/src/admin/AdminMode.tsx
+++ b/apps/web/src/admin/AdminMode.tsx
@@ -269,6 +269,7 @@ export function AdminMode({ currentUserId, onExit }: Props) {
onDeleted={() => go({ section: 'workspaces', id: null })}
viewerWorkspaces={viewerWorkspaces}
currentUserId={currentUserId}
+ headActions={headActions}
{...shared}
/>
) : workspaceView === 'usage' ? (
@@ -288,7 +289,13 @@ export function AdminMode({ currentUserId, onExit }: Props) {
)
case 'users':
return user ? (
- <UserDetail user={user} workspaces={ready.workspaces} currentUserId={currentUserId} {...shared} />
+ <UserDetail
+ user={user}
+ workspaces={ready.workspaces}
+ currentUserId={currentUserId}
+ headActions={headActions}
+ {...shared}
+ />
) : (
<UsersList
users={ready.users}
@@ -312,7 +319,7 @@ export function AdminMode({ currentUserId, onExit }: Props) {
/>
) : null
case 'audit':
- return <AuditLog workspaces={ready.workspaces} />
+ return <AuditLog workspaces={ready.workspaces} keysRef={listKeys} />
}
}
diff --git a/apps/web/src/admin/AuditLog.tsx b/apps/web/src/admin/AuditLog.tsx
index f55255da..649b0047 100644
--- a/apps/web/src/admin/AuditLog.tsx
+++ b/apps/web/src/admin/AuditLog.tsx
@@ -1,19 +1,20 @@
// Server admin › Audit log: who did what on this install, newest first. Sign-ins with their method,
// sign-in methods added or removed, admin actions, team changes, provider keys and impersonation.
-// Kept forever; the kinds are chips above the list (LIN-833), the other filters (person, workspace, dates) one row in
-// it; "Show older" pages back. The setup reports AI agents sent are a list of their own (LIN-747); Stripe's events are
+// Kept forever; the kinds are chips above the list (LIN-833); in the frame of every admin list (AdminList.tsx) the
+// person is its search and the workspace and dates one row under it; "Show older" pages back. The setup reports AI agents sent are a list of their own (LIN-747); Stripe's events are
// a part of Billing again (LIN-833, `#admin/billing/events`).
import { CALL_QUALITY_LABELS, type CallQuality } from '@linedesk/actions'
import { type MessageKey, msg } from '@linedesk/i18n'
import { useT } from '@linedesk/i18n/react'
-import { useCallback, useEffect, useRef, useState } from 'react'
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useMenu } from '../shell/useMenu.ts'
import { dateTimeLabel } from '../time.ts'
import { OptionCheck, Select, type SelectOption } from '../ui/controls.tsx'
import { useAnchoredList } from '../ui/floating.ts'
-import { DateInput, Input } from '../ui/form.tsx'
+import { DateInput } from '../ui/form.tsx'
import { Badge, Button, Icon } from '../ui/kit.tsx'
import { Loading, SkeletonRows } from '../ui/LoadStates.tsx'
+import { type Column, ListCard, type ListKeys, ListSearch, ListTable } from './AdminList.tsx'
import { type AdminWorkspace, type AuditEntry, type AuditFilter, type AuditKind, loadAudit } from './api.ts'
import { errorText } from './notify.ts'
import { AUDIT_LISTS, type AuditList } from './route.ts'
@@ -22,7 +23,6 @@ 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). */
@@ -65,25 +65,16 @@ function KindChips({ value, onPick }: { value: KindValue; onPick: (value: KindVa
const list = useRef<HTMLDivElement>(null)
useAnchoredList(menu.open, menu.trigger, list, { minWidth: 200, natural: true })
const picked = moreKinds.find(k => k.value === value)
- // On a phone the row scrolls sideways: the chip picked (also from More, or from the address) stays in view.
- const row = useRef<HTMLDivElement>(null)
- const pressed = picked ? 'more' : value
- useEffect(() => {
- row.current
- ?.querySelector<HTMLElement>(`[data-kind="${pressed}"]`)
- ?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' })
- }, [pressed])
return (
- <FilterChips ref={row} className="adm-audit-kinds" label={t('admin.audit.kind.label')}>
+ <FilterChips label={t('admin.audit.kind.label')}>
{mainKinds.map(k => (
- <FilterChip key={k.value} data-kind={k.value} pressed={value === k.value} onClick={() => onPick(k.value)}>
+ <FilterChip key={k.value} pressed={value === k.value} onClick={() => onPick(k.value)}>
{t(k.label)}
</FilterChip>
))}
<div className="adm-audit-more-kinds" ref={menu.root}>
<FilterChip
ref={menu.trigger}
- data-kind="more"
pressed={Boolean(picked)}
aria-haspopup="menu"
aria-expanded={menu.open}
@@ -123,7 +114,13 @@ function KindChips({ value, onPick }: { value: KindValue; onPick: (value: KindVa
)
}
-export function AuditLog({ workspaces }: { workspaces: AdminWorkspace[] }) {
+export function AuditLog({
+ workspaces,
+ keysRef,
+}: {
+ workspaces: AdminWorkspace[]
+ keysRef: { current: ListKeys | null }
+}) {
const [kind, setKind] = useState<KindValue>(() => kindOfHash(window.location.hash))
useEffect(() => {
const onHash = () => setKind(kindOfHash(window.location.hash))
@@ -138,7 +135,7 @@ export function AuditLog({ workspaces }: { workspaces: AdminWorkspace[] }) {
return (
<>
<KindChips value={kind} onPick={pick} />
- {isAuditList(kind) ? <SetupReports /> : <AuditEntries workspaces={workspaces} kind={kind} />}
+ {isAuditList(kind) ? <SetupReports /> : <AuditEntries workspaces={workspaces} kind={kind} keysRef={keysRef} />}
</>
)
}
@@ -788,8 +785,101 @@ const today = () => new Date().toISOString().slice(0, 10)
/** The day after, so "to" includes the whole day picked. */
const dayAfter = (day: string) => new Date(Date.parse(`${day}T00:00:00Z`) + 86_400_000).toISOString().slice(0, 10)
-function AuditEntries({ workspaces, kind }: { workspaces: AdminWorkspace[]; kind: AuditKind | 'all' }) {
+/**
+ * The workspace an entry is about, by name: a workspace deleted since has none in the database any more, so its name
+ * comes from the entry itself (a delete names it) or it is "Deleted workspace"; never its raw id.
+ */
+export function workspaceLabel(e: Pick<AuditEntry, 'workspace' | 'input'>): string | null {
+ if (!e.workspace) return null
+ if (e.workspace.name) return e.workspace.name
+ const named = (e.input as { name?: unknown } | null)?.name
+ return typeof named === 'string' && named.trim() ? named.trim() : t('admin.audit.deletedWorkspace')
+}
+
+const auditColumns = (t: Translate): Column<AuditEntry>[] => [
+ {
+ key: 'when',
+ label: t('admin.audit.column.when'),
+ render: e => (
+ <time dateTime={e.at} title={fmt().dateTime(new Date(e.at), { dateStyle: 'full', timeStyle: 'long' })}>
+ {dateTimeLabel(new Date(e.at))}
+ </time>
+ ),
+ },
+ {
+ key: 'who',
+ label: t('admin.audit.column.who'),
+ render: e => (
+ <span className="adm-who">
+ <span className="adm-strong">{actorLabel(e.actor)}</span>
+ {e.actor.name?.trim() && e.actor.email && <span className="adm-sub">{e.actor.email}</span>}
+ {e.impersonatedBy && (
+ <span className="adm-sub">
+ {t('admin.audit.impersonatedBy', {
+ email: e.impersonatedBy.name?.trim() || e.impersonatedBy.email || '',
+ known: e.impersonatedBy.name?.trim() || e.impersonatedBy.email ? 'yes' : 'no',
+ })}
+ </span>
+ )}
+ {e.viaSetupKey && <span className="adm-sub">{t('admin.audit.viaSetupKey')}</span>}
+ </span>
+ ),
+ },
+ {
+ key: 'what',
+ label: t('admin.audit.column.what'),
+ render: e => (
+ <span className="adm-who adm-audit-what">
+ <span>
+ {auditLabel(e)}
+ {e.refused && (
+ <>
+ {' '}
+ <Badge tone="danger">{t('admin.audit.refused')}</Badge>
+ </>
+ )}
+ </span>
+ {auditReason(e) && <span className="adm-sub">{auditReason(e)}</span>}
+ {e.ipAddress && <span className="adm-sub">{e.ipAddress}</span>}
+ </span>
+ ),
+ },
+ {
+ key: 'workspace',
+ label: t('admin.audit.column.workspace'),
+ render: e => {
+ const name = workspaceLabel(e)
+ return name ? <span title={name}>{name}</span> : <span className="adm-none">{EMPTY}</span>
+ },
+ },
+]
+
+/**
+ * The entries in the frame of every admin list: the person as its search field, the workspace and the dates as one
+ * row under it, the headings, the rows, and "Show older" (the log pages on the server, newest first).
+ */
+function AuditEntries({
+ workspaces,
+ kind,
+ keysRef,
+}: {
+ workspaces: AdminWorkspace[]
+ kind: AuditKind | 'all'
+ keysRef: { current: ListKeys | null }
+}) {
const t = useT()
+ const search = useRef<HTMLInputElement>(null)
+ // / searches, as on every admin list.
+ useEffect(() => {
+ keysRef.current = key => {
+ if (key !== '/') return false
+ search.current?.focus()
+ return true
+ }
+ return () => {
+ keysRef.current = null
+ }
+ }, [keysRef])
const [filter, setFilter] = useState<{
who: string
workspace: string
@@ -805,6 +895,7 @@ function AuditEntries({ workspaces, kind }: { workspaces: AdminWorkspace[]; kind
const [next, setNext] = useState<string | null>(null)
const [error, setError] = useState<string | null>(null)
const [loadingMore, setLoadingMore] = useState(false)
+ const columns = useMemo(() => auditColumns(t), [t])
const query = useCallback(
(before?: string): AuditFilter => ({
@@ -863,22 +954,23 @@ function AuditEntries({ workspaces, kind }: { workspaces: AdminWorkspace[]; kind
]
return (
- <div className="k-card">
- <div className="adm-audit-filters">
- <Input
- className="adm-audit-who"
- value={filter.who}
- onChange={e => set('who')(e.target.value)}
- placeholder={t('admin.audit.personPlaceholder')}
- aria-label={t('admin.audit.person')}
- />
+ <ListCard>
+ <ListSearch
+ inputRef={search}
+ value={filter.who}
+ onChange={set('who')}
+ label={t('admin.audit.personPlaceholder')}
+ />
+ <div className="adm-list-tools adm-audit-filters">
<Select
+ size="sm"
value={filter.workspace}
options={workspaceOptions}
onChange={set('workspace')}
label={t('admin.audit.column.workspace')}
/>
<DateInput
+ size="sm"
value={filter.from}
max={filter.to || today()}
onChange={set('from')}
@@ -886,6 +978,7 @@ function AuditEntries({ workspaces, kind }: { workspaces: AdminWorkspace[]; kind
aria-label={t('admin.audit.from')}
/>
<DateInput
+ size="sm"
value={filter.to}
min={filter.from || undefined}
max={today()}
@@ -903,70 +996,18 @@ function AuditEntries({ workspaces, kind }: { workspaces: AdminWorkspace[]; kind
skeleton={<SkeletonRows rows={8} columns={4} className="adm-sk-rows" />}
/>
)}
- {!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">
- <thead>
- <tr>
- <th scope="col">{t('admin.audit.column.when')}</th>
- <th scope="col">{t('admin.audit.column.who')}</th>
- <th scope="col">{t('admin.audit.column.what')}</th>
- <th scope="col">{t('admin.audit.column.workspace')}</th>
- </tr>
- </thead>
- <tbody>
- {entries.map(e => (
- <tr key={e.id}>
- <td data-label={t('admin.audit.column.when')}>
- <time
- dateTime={e.at}
- title={fmt().dateTime(new Date(e.at), { dateStyle: 'full', timeStyle: 'long' })}
- >
- {dateTimeLabel(new Date(e.at))}
- </time>
- </td>
- <th scope="row">
- {actorLabel(e.actor)}
- {e.actor.name?.trim() && e.actor.email && <span className="adm-sub">{e.actor.email}</span>}
- {e.impersonatedBy && (
- <span className="adm-sub">
- {t('admin.audit.impersonatedBy', {
- email: e.impersonatedBy.name?.trim() || e.impersonatedBy.email || '',
- known: e.impersonatedBy.name?.trim() || e.impersonatedBy.email ? 'yes' : 'no',
- })}
- </span>
- )}
- {e.viaSetupKey && <span className="adm-sub">{t('admin.audit.viaSetupKey')}</span>}
- </th>
- <td className="adm-audit-what" data-label={t('admin.audit.column.what')}>
- {auditLabel(e)}
- {e.refused && (
- <>
- {' '}
- <Badge tone="danger">{t('admin.audit.refused')}</Badge>
- </>
- )}
- {auditReason(e) && <span className="adm-sub">{auditReason(e)}</span>}
- {e.ipAddress && <span className="adm-sub">{e.ipAddress}</span>}
- </td>
- <td data-label={t('admin.audit.column.workspace')}>
- {e.workspace ? (
- <span className="adm-audit-workspace" title={e.workspace.name ?? e.workspace.id}>
- {e.workspace.name ?? e.workspace.id}
- </span>
- ) : (
- EMPTY
- )}
- </td>
- </tr>
- ))}
- </tbody>
- </table>
- </div>
+ {!error && entries && (
+ <ListTable
+ rows={entries}
+ rowId={e => e.id}
+ columns={columns}
+ label={t('admin.sections.audit.label')}
+ className="adm-audit-list"
+ empty={t('admin.audit.empty')}
+ />
)}
{next && (
- <div className="adm-audit-more">
+ <div className="adm-list-more">
<Button
busy={loadingMore}
size="sm"
@@ -978,6 +1019,6 @@ function AuditEntries({ workspaces, kind }: { workspaces: AdminWorkspace[]; kind
</Button>
</div>
)}
- </div>
+ </ListCard>
)
}
diff --git a/apps/web/src/admin/Billing.test.tsx b/apps/web/src/admin/Billing.test.tsx
index 0efbf91e..9257ca41 100644
--- a/apps/web/src/admin/Billing.test.tsx
+++ b/apps/web/src/admin/Billing.test.tsx
@@ -13,7 +13,8 @@ const useQuery = vi.fn((key: string | null) => ({
}))
vi.mock('../cachedQuery.ts', async original => ({ ...(await original<object>()), useQuery }))
-const { Billing, SelfServeCard, SignupRulesCard } = await import('./Billing.tsx')
+const { Billing, billActions, SelfServeCard, SignupRulesCard } = await import('./Billing.tsx')
+const { i18n } = await import('../i18n/index.tsx')
const bill: AdminBillDetail = {
id: 'bill_1',
@@ -77,13 +78,17 @@ test("a bill's page: paid from the ledger, invoices in the Stripe Dashboard, onl
// The extra calls at the same time the owner bought (LIN-450): on the bill and per workspace.
expect(html).toContain('10 extra calls bought')
expect(html).toContain('+10')
- // Comped: Resume and Suspend, no Comp again.
- expect(html).toContain('Resume…')
- expect(html).toContain('Suspend…')
- expect(html).not.toContain('Comp…')
- // Nothing paid is left to refund, and nobody else to give the bill to: both say why.
+ // Comped: Resume and Suspend, no Comp again (the actions sit in the page header: a button, or in its ⋯ menu).
+ const actions = billActions(i18n().t, bill, () => {})
+ const labels = actions.map(a => a.label)
+ expect(labels).toContain('Resume…')
+ expect(labels).toContain('Suspend…')
+ expect(labels).not.toContain('Comp…')
+ expect(actions.filter(a => !a.menu).map(a => a.id)).toEqual(['credit', 'refund', 'resume'])
+ // Nothing paid is left to refund, and nobody else to give the bill to: both say why (the Refund button's on the page).
+ expect(actions.find(a => a.id === 'refund')?.disabledReason).toBe('No payment has anything left to refund.')
+ expect(actions.find(a => a.id === 'owner')?.disabledReason).toBe('No other member to give it to.')
expect(html).toContain('No payment has anything left to refund.')
- expect(html).toContain('No other member to give it to.')
// Radar's risk of the trial's card check is shown, not only stored.
expect(html).toContain('Radar risk')
expect(html).toContain('Elevated')
@@ -177,16 +182,17 @@ test('open sign-up says so, and its limits are editable with plain labels', () =
expect(html).toContain('Hold for review at Radar risk')
})
-test('the bills list filters by status with counted chips and colour badges', () => {
+test('the bills list filters by status with chips (no counts) and colour badges', () => {
data['admin.billing.bills'] = [{ ...bill, status: 'trialing' }]
const html = renderList('bills')
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="k-chip-n">1</span>')
- expect(html).not.toContain('Past due<span')
+ // Only statuses that have bills get a chip, without a count (like every chip row).
+ expect(html).toContain('>Trial</button>')
+ expect(html).not.toContain('k-chip-n')
+ expect(html).not.toContain('>Past due</button>')
// Nothing canceled: no "All bills" chip, it would show the same.
- expect(html).not.toContain('All bills<span')
+ expect(html).not.toContain('>All bills</button>')
})
test('the bills list hides canceled bills by default; the Canceled and All bills chips show them', () => {
@@ -200,9 +206,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="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('>Current</button>')
+ expect(html).toContain('>Canceled</button>')
+ expect(html).toContain('>All bills</button>')
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 3dc80f99..5a76af11 100644
--- a/apps/web/src/admin/Billing.tsx
+++ b/apps/web/src/admin/Billing.tsx
@@ -26,11 +26,10 @@ import { SIGNUP_RULE_RANGES, type SignupCountRule } from '@linedesk/db/types'
import { type MessageKey, msg } from '@linedesk/i18n'
import { T, useT } from '@linedesk/i18n/react'
import { type FormEvent, Fragment, type ReactNode, useContext, useEffect, useMemo, useState } from 'react'
-import { createPortal } from 'react-dom'
import { refreshQuery, setQueryData, useQuery } from '../cachedQuery.ts'
import { fmt } from '../i18n/format.ts'
import { AppLink, appLink, LinkButton } from '../ui/AppLink.tsx'
-import { Checkbox, Select, type SelectOption, Switch } from '../ui/controls.tsx'
+import { Checkbox, Select, Switch } from '../ui/controls.tsx'
import { LineGroup, LinkLine } from '../ui/FeatureLine.tsx'
import {
Card,
@@ -47,8 +46,8 @@ import {
import { Badge, Button, cx, Note } from '../ui/kit.tsx'
import { Loading, Skeleton, SkeletonRows, SkeletonText } from '../ui/LoadStates.tsx'
import { SettingRow, SkeletonSettingRow } from '../ui/SettingRow.tsx'
-import { AdminList, type Column, type ListKeys } from './AdminList.tsx'
-import { ActionBar, type AdminAction } from './actions.tsx'
+import { AdminList, type Column, ListCard, type ListKeys, ListTable } from './AdminList.tsx'
+import { type AdminAction, DetailActions, RowActions, useActionRunner } from './actions.tsx'
import type { AdminData } from './api.ts'
import { runAdmin } from './api.ts'
import { BillingSwitch } from './BillingSwitch.tsx'
@@ -215,13 +214,13 @@ type Props = {
keysRef: { current: ListKeys | null }
/** The admin data (null until it is read): the billing switch reads Stripe's keys from it. */
data: AdminData | null
- /** The page header's actions slot: Stripe events puts its filter there. */
+ /** The page header's actions slot: a bill puts its actions there. */
headActions?: HTMLElement | null
}
export function Billing({ id, onOpen, notify, keysRef, data, headActions }: Props) {
const tab = billingTab(id)
- if (!tab) return <BillDetail id={id!} notify={notify} />
+ if (!tab) return <BillDetail id={id!} notify={notify} slot={headActions ?? null} />
switch (tab) {
case 'overview':
return <BillingHome />
@@ -230,7 +229,7 @@ export function Billing({ id, onOpen, notify, keysRef, data, headActions }: Prop
case 'review':
return <ReviewCard onOpen={onOpen} notify={notify} />
case 'events':
- return <EventsCard notify={notify} headActions={headActions ?? null} />
+ return <EventsCard notify={notify} />
case 'rules':
return <RulesCard notify={notify} />
case 'stripe':
@@ -422,158 +421,146 @@ function BillsList({ onOpen, keysRef }: { onOpen: (id: string) => void; keysRef:
(value === 'all' ? filterBills(bills, 'canceled').length > 0 : filterBills(bills, value).length > 0),
)
return (
- <AdminList
- rows={shown}
- tools={
+ <>
+ {/* Above the card like every list's chips, without counts; only when there is something to pick between. */}
+ {chips.length > 1 && (
<FilterChips label={t('admin.bills.filter.label')}>
{chips.map(value => (
- <FilterChip
- key={value}
- pressed={filter === value}
- count={filterBills(bills, value).length}
- onClick={() => setFilter(value)}
- >
+ <FilterChip key={value} pressed={filter === value} onClick={() => setFilter(value)}>
{filterLabel(t, value)}
</FilterChip>
))}
</FilterChips>
- }
- rowId={b => b.id}
- columns={columns}
- initialSort={{ key: 'created', dir: 'desc' }}
- searchText={b =>
- `${b.owner.email ?? ''} ${b.owner.name ?? ''} ${b.workspaces.map(w => w.name).join(' ')} ${b.id}`
- }
- searchLabel={t('admin.bills.search')}
- label={t('admin.bills.what')}
- onOpen={b => onOpen(b.id)}
- keysRef={keysRef}
- empty={
- bills.length === 0 ? (
- <>
- {t('admin.bills.empty')} <T k="admin.bills.emptyHint" values={{ link: appLink('#admin/access') }} />
- </>
- ) : (
- <>
- {t('admin.bills.filter.empty')}{' '}
- <LinkButton onClick={() => setFilter('all')}>{t('admin.bills.filter.showAll')}</LinkButton>
- </>
- )
- }
- />
+ )}
+ <AdminList
+ rows={shown}
+ rowId={b => b.id}
+ columns={columns}
+ initialSort={{ key: 'created', dir: 'desc' }}
+ searchText={b =>
+ `${b.owner.email ?? ''} ${b.owner.name ?? ''} ${b.workspaces.map(w => w.name).join(' ')} ${b.id}`
+ }
+ searchLabel={t('admin.bills.search')}
+ label={t('admin.bills.what')}
+ onOpen={b => onOpen(b.id)}
+ keysRef={keysRef}
+ empty={
+ bills.length === 0 ? (
+ <>
+ {t('admin.bills.empty')} <T k="admin.bills.emptyHint" values={{ link: appLink('#admin/access') }} />
+ </>
+ ) : (
+ <>
+ {t('admin.bills.filter.empty')}{' '}
+ <LinkButton onClick={() => setFilter('all')}>{t('admin.bills.filter.showAll')}</LinkButton>
+ </>
+ )
+ }
+ />
+ </>
)
}
// ---- Review ----
+const reviewColumns = (t: Translate): Column<AdminReviewRow>[] => [
+ {
+ key: 'owner',
+ label: t('admin.bills.column.owner'),
+ render: row => (
+ <span className="adm-who">
+ <span className="adm-strong">{ownerText(t, row.owner)}</span>
+ <span className="adm-sub">{t('admin.bills.workspaceCount', { count: row.workspaces })}</span>
+ </span>
+ ),
+ },
+ {
+ key: 'status',
+ label: t('admin.bills.column.status'),
+ render: row =>
+ row.heldForReviewAt ? (
+ <Badge tone="danger">{t('admin.bills.badge.held')}</Badge>
+ ) : (
+ <StatusBadge status={row.status} />
+ ),
+ },
+ {
+ key: 'risk',
+ label: t('admin.bills.review.column.risk'),
+ render: row => <RiskBadge level={row.cardRiskLevel} />,
+ },
+ {
+ key: 'since',
+ label: t('admin.bills.review.column.since'),
+ render: row => <Ago iso={row.heldForReviewAt ?? row.createdAt} />,
+ },
+]
+
+/** Approve or deny a held bill: the row's quick actions, each asking why in the reason dialog. */
+function reviewActions(t: Translate, row: AdminReviewRow): AdminAction[] {
+ if (!row.heldForReviewAt) return []
+ const decide = (decision: 'approve' | 'deny'): AdminAction => ({
+ id: decision,
+ label: t(decision === 'approve' ? 'admin.bills.review.approve' : 'admin.bills.review.deny'),
+ icon: decision === 'approve' ? 'check' : 'ban',
+ tip: t(decision === 'approve' ? 'admin.bills.review.approveText' : 'admin.bills.review.denyText'),
+ danger: decision === 'deny',
+ run: async () => {},
+ dialog: (close, notify) => (
+ <ReasonDialog
+ title={t(decision === 'approve' ? 'admin.bills.review.approveTitle' : 'admin.bills.review.denyTitle', {
+ owner: ownerText(t, row.owner),
+ })}
+ description={t(decision === 'approve' ? 'admin.bills.review.approveText' : 'admin.bills.review.denyText')}
+ submit={t(decision === 'approve' ? 'admin.bills.review.approve' : 'admin.bills.review.deny')}
+ danger={decision === 'deny'}
+ run={async reason => {
+ await runAdmin('billing.reviewHold', { billingAccountId: row.billId, decision, reason })
+ await refreshBill(row.billId)
+ return t(decision === 'approve' ? 'admin.bills.review.approved' : 'admin.bills.review.denied')
+ }}
+ notify={notify}
+ onClose={close}
+ />
+ ),
+ })
+ return [decide('approve'), decide('deny')]
+}
+
+/** Billing › Review: the held bills and the new trials, a list like the bills (a row opens its bill). */
function ReviewCard({ onOpen, notify }: { onOpen: (id: string) => void; notify: Notify }) {
const t = useT()
const query = useQuery(REVIEW, loadReview)
- const [deciding, setDeciding] = useState<{ row: AdminReviewRow; decision: 'approve' | 'deny' } | null>(null)
- const rows = query.data ? [...query.data.held, ...query.data.newTrials] : []
+ const runner = useActionRunner(notify)
+ const columns = useMemo(() => reviewColumns(t), [t])
+ const rows = query.data ? [...query.data.held, ...query.data.newTrials] : null
return (
- <Card className="adm-detail">
+ <ListCard>
<Loading
what={t('admin.bills.review.title')}
- loading={!query.data}
+ loading={!rows}
error={query.error}
onRetry={() => void query.reload()}
- skeleton={<SkeletonRows rows={2} columns={4} />}
+ skeleton={<SkeletonRows rows={2} columns={4} className="adm-sk-rows" />}
>
- {rows.length ? (
- <div className="adm-scroll">
- <table className="adm-table adm-stack">
- <thead>
- <tr>
- <th scope="col">{t('admin.bills.column.owner')}</th>
- <th scope="col">{t('admin.bills.column.status')}</th>
- <th scope="col">{t('admin.bills.review.column.risk')}</th>
- <th scope="col">{t('admin.bills.review.column.since')}</th>
- <th scope="col">
- <span className="sr-only">{t('admin.bills.column.actions')}</span>
- </th>
- </tr>
- </thead>
- <tbody>
- {rows.map(row => (
- <tr key={row.billId}>
- <th scope="row" data-label={t('admin.bills.column.owner')}>
- <AppLink to={`#admin/billing/${encodeURIComponent(row.billId)}`}>
- {ownerText(t, row.owner)}
- </AppLink>
- <span className="adm-sub">{t('admin.bills.workspaceCount', { count: row.workspaces })}</span>
- </th>
- <td data-label={t('admin.bills.column.status')}>
- {row.heldForReviewAt ? (
- <Badge tone="danger">{t('admin.bills.badge.held')}</Badge>
- ) : (
- <StatusBadge status={row.status} />
- )}
- </td>
- <td data-label={t('admin.bills.review.column.risk')}>
- <RiskBadge level={row.cardRiskLevel} />
- </td>
- <td data-label={t('admin.bills.review.column.since')}>
- <Ago iso={row.heldForReviewAt ?? row.createdAt} />
- </td>
- <td>
- {row.heldForReviewAt ? (
- <span className="adm-actbar">
- <Button size="sm" onClick={() => setDeciding({ row, decision: 'approve' })}>
- {t('admin.bills.review.approve')}
- </Button>
- <Button
- size="sm"
- variant="danger-outline"
- onClick={() => setDeciding({ row, decision: 'deny' })}
- >
- {t('admin.bills.review.deny')}
- </Button>
- </span>
- ) : (
- <Button size="sm" variant="ghost" onClick={() => onOpen(row.billId)}>
- {t('admin.bills.open')}
- </Button>
- )}
- </td>
- </tr>
- ))}
- </tbody>
- </table>
- </div>
- ) : (
- <ListEmpty>
- {t('admin.bills.review.empty')} {t('admin.bills.review.emptyHint')}
- </ListEmpty>
+ {rows && (
+ <ListTable
+ rows={rows}
+ rowId={row => row.billId}
+ columns={columns}
+ label={t('admin.bills.review.title')}
+ onOpen={row => onOpen(row.billId)}
+ rowActions={
+ rows.some(row => row.heldForReviewAt)
+ ? row => <RowActions actions={reviewActions(t, row)} onPick={runner.pick} />
+ : undefined
+ }
+ empty={`${t('admin.bills.review.empty')} ${t('admin.bills.review.emptyHint')}`}
+ />
)}
</Loading>
- {deciding && (
- <ReasonDialog
- title={t(
- deciding.decision === 'approve' ? 'admin.bills.review.approveTitle' : 'admin.bills.review.denyTitle',
- {
- owner: ownerText(t, deciding.row.owner),
- },
- )}
- description={t(
- deciding.decision === 'approve' ? 'admin.bills.review.approveText' : 'admin.bills.review.denyText',
- )}
- submit={t(deciding.decision === 'approve' ? 'admin.bills.review.approve' : 'admin.bills.review.deny')}
- danger={deciding.decision === 'deny'}
- run={async reason => {
- await runAdmin('billing.reviewHold', {
- billingAccountId: deciding.row.billId,
- decision: deciding.decision,
- reason,
- })
- await refreshBill(deciding.row.billId)
- return t(deciding.decision === 'approve' ? 'admin.bills.review.approved' : 'admin.bills.review.denied')
- }}
- notify={notify}
- onClose={() => setDeciding(null)}
- />
- )}
- </Card>
+ {runner.dialog}
+ </ListCard>
)
}
@@ -598,19 +585,57 @@ const FILTERS: Record<BillingEventFilter, MessageKey> = {
unhandled: msg('admin.bills.events.filter.unhandled'),
}
-/** Stripe's events: Billing › Stripe events (`#admin/billing/events`; in the Audit log from LIN-747 to LIN-833). */
-function EventsCard({ notify, headActions }: { notify: Notify; headActions: HTMLElement | null }) {
+const eventColumns = (t: Translate): Column<AdminStripeEvent>[] => [
+ {
+ key: 'event',
+ label: t('admin.bills.events.column.event'),
+ render: e => (
+ <span className="adm-who">
+ <span className="adm-mono">{e.type}</span>
+ <span className="adm-sub adm-mono">
+ {e.id}
+ {!e.livemode && ` · ${t('admin.bills.events.test')}`}
+ </span>
+ {e.billId && (
+ <span className="adm-sub">
+ <AppLink to={`#admin/billing/${encodeURIComponent(e.billId)}`}>{t('admin.bills.events.openBill')}</AppLink>
+ </span>
+ )}
+ {e.lastError && e.state !== 'processed' && <span className="adm-sub">{e.lastError}</span>}
+ </span>
+ ),
+ },
+ {
+ key: 'state',
+ label: t('admin.bills.events.column.state'),
+ render: e => <Badge tone={EVENT_TONE[e.state]}>{t(EVENT_STATE[e.state])}</Badge>,
+ },
+ {
+ key: 'received',
+ label: t('admin.bills.events.column.received'),
+ render: e => <Ago iso={e.receivedAt} />,
+ },
+ {
+ key: 'attempts',
+ label: t('admin.bills.events.column.attempts'),
+ numeric: true,
+ render: e => fmt().number(e.attempts),
+ },
+]
+
+/**
+ * Stripe's events: Billing › Stripe events (`#admin/billing/events`; in the Audit log from LIN-747 to LIN-833). A list
+ * like the bills: the states as chips above it (once there are events), Process again as a row's quick action.
+ */
+function EventsCard({ notify }: { notify: Notify }) {
const t = useT()
const [filter, setFilter] = useHashFilter(eventFilterOfHash, eventsHref)
const query = useQuery(eventsKey(filter), loadEvents(filter))
const [older, setOlder] = useState<EventsPage | null>(null)
- const [reprocessing, setReprocessing] = useState<AdminStripeEvent | null>(null)
- const events = [...(query.data?.events ?? []), ...(older?.events ?? [])]
+ const runner = useActionRunner(notify)
+ const columns = useMemo(() => eventColumns(t), [t])
+ const events = query.data ? [...query.data.events, ...(older?.events ?? [])] : null
const next = older ? older.next : (query.data?.next ?? null)
- const options: SelectOption<BillingEventFilter>[] = (Object.keys(FILTERS) as BillingEventFilter[]).map(value => ({
- value,
- label: t(FILTERS[value]),
- }))
async function more() {
if (!next) return
@@ -622,127 +647,95 @@ function EventsCard({ notify, headActions }: { notify: Notify; headActions: HTML
}
}
// Like every billing write, processing an event again asks why (the reason is kept in the audit log).
- async function reprocess(event: AdminStripeEvent, reason: string) {
- await runAdmin('billing.reprocessEvent', { eventId: event.id, reason })
- setOlder(null)
- await Promise.all([refreshQuery(eventsKey(filter)), refreshQuery(SUMMARY)])
- return t('admin.bills.events.queued', { type: event.type })
- }
-
- const filterSelect = (
- <Select
- value={filter}
- options={options}
- onChange={value => {
- setOlder(null)
- setFilter(value)
- }}
- label={t('admin.bills.events.filter.label')}
- size="sm"
- align="end"
- />
- )
+ const reprocess = (event: AdminStripeEvent): AdminAction[] =>
+ event.state === 'processed'
+ ? []
+ : [
+ {
+ id: 'reprocess',
+ label: t('admin.bills.events.reprocess'),
+ icon: 'restart',
+ tip: t('admin.bills.events.reprocessTip'),
+ run: async () => {},
+ dialog: close => (
+ <ReasonDialog
+ title={t('admin.bills.events.reprocessTitle', { type: event.type })}
+ description={t('admin.bills.events.reprocessText')}
+ submit={t('admin.bills.events.reprocess')}
+ run={async reason => {
+ await runAdmin('billing.reprocessEvent', { eventId: event.id, reason })
+ setOlder(null)
+ await Promise.all([refreshQuery(eventsKey(filter)), refreshQuery(SUMMARY)])
+ return t('admin.bills.events.queued', { type: event.type })
+ }}
+ notify={notify}
+ onClose={close}
+ />
+ ),
+ },
+ ]
+ // Nothing to filter before Stripe sent anything: the chips wait for the first event.
+ const chips = filter !== 'all' || (events?.length ?? 0) > 0
return (
<>
- {/* The filter sits next to the page title (its card has no title of its own); in a card while the header is not there. */}
- {headActions && createPortal(filterSelect, headActions)}
- <Card actions={headActions ? undefined : filterSelect} className="adm-detail">
+ {chips && (
+ <FilterChips label={t('admin.bills.events.filter.label')}>
+ {(Object.keys(FILTERS) as BillingEventFilter[]).map(value => (
+ <FilterChip
+ key={value}
+ pressed={filter === value}
+ onClick={() => {
+ setOlder(null)
+ setFilter(value)
+ }}
+ >
+ {t(FILTERS[value])}
+ </FilterChip>
+ ))}
+ </FilterChips>
+ )}
+ <ListCard>
<Loading
what={t('admin.bills.events.title')}
- loading={!query.data}
+ loading={!events}
error={query.error}
onRetry={() => void query.reload()}
- skeleton={<SkeletonRows rows={4} columns={4} />}
+ skeleton={<SkeletonRows rows={4} columns={4} className="adm-sk-rows" />}
>
- {events.length ? (
- <div className="adm-scroll">
- <table className="adm-table adm-stack adm-events">
- <thead>
- <tr>
- <th scope="col">{t('admin.bills.events.column.event')}</th>
- <th scope="col">{t('admin.bills.events.column.state')}</th>
- <th scope="col">{t('admin.bills.events.column.received')}</th>
- <th scope="col" className="adm-num">
- {t('admin.bills.events.column.attempts')}
- </th>
- <th scope="col">
- <span className="sr-only">{t('admin.bills.column.actions')}</span>
- </th>
- </tr>
- </thead>
- <tbody>
- {events.map(e => (
- <tr key={e.id}>
- <th scope="row" data-label={t('admin.bills.events.column.event')}>
- <span className="adm-mono">{e.type}</span>
- <span className="adm-sub adm-mono">
- {e.id}
- {!e.livemode && ` · ${t('admin.bills.events.test')}`}
- </span>
- {e.billId && (
- <span className="adm-sub">
- <AppLink to={`#admin/billing/${encodeURIComponent(e.billId)}`}>
- {t('admin.bills.events.openBill')}
- </AppLink>
- </span>
- )}
- {e.lastError && e.state !== 'processed' && <span className="adm-sub">{e.lastError}</span>}
- </th>
- <td data-label={t('admin.bills.events.column.state')}>
- <Badge tone={EVENT_TONE[e.state]}>{t(EVENT_STATE[e.state])}</Badge>
- </td>
- <td data-label={t('admin.bills.events.column.received')}>
- <Ago iso={e.receivedAt} />
- </td>
- <td className="adm-num" data-label={t('admin.bills.events.column.attempts')}>
- {fmt().number(e.attempts)}
- </td>
- <td>
- {e.state !== 'processed' && (
- <Button
- size="sm"
- icon="restart"
- title={t('admin.bills.events.reprocessTip')}
- onClick={() => setReprocessing(e)}
- >
- {t('admin.bills.events.reprocess')}
- </Button>
- )}
- </td>
- </tr>
- ))}
- </tbody>
- </table>
- </div>
- ) : filter === 'all' ? (
- <ListEmpty>
- <T k="admin.bills.events.emptyHow" values={{ link: appLink('#admin/providers/stripe') }} />
- </ListEmpty>
- ) : (
- <ListEmpty>
- {t('admin.bills.events.empty')}{' '}
- <LinkButton onClick={() => setFilter('all')}>{t('admin.bills.events.showAll')}</LinkButton>
- </ListEmpty>
+ {events && (
+ <ListTable
+ rows={events}
+ rowId={e => e.id}
+ columns={columns}
+ label={t('admin.bills.events.title')}
+ className="adm-events"
+ rowActions={
+ events.some(e => e.state !== 'processed')
+ ? e => <RowActions actions={reprocess(e)} onPick={runner.pick} />
+ : undefined
+ }
+ empty={
+ filter === 'all' ? (
+ <T k="admin.bills.events.emptyHow" values={{ link: appLink('#admin/providers/stripe') }} />
+ ) : (
+ <>
+ {t('admin.bills.events.empty')}{' '}
+ <LinkButton onClick={() => setFilter('all')}>{t('admin.bills.events.showAll')}</LinkButton>
+ </>
+ )
+ }
+ />
)}
{next && (
- <div>
- <Button size="sm" variant="ghost" onClick={() => void more()}>
+ <div className="adm-list-more">
+ <Button size="sm" onClick={() => void more()}>
{t('admin.bills.events.older')}
</Button>
</div>
)}
</Loading>
- {reprocessing && (
- <ReasonDialog
- title={t('admin.bills.events.reprocessTitle', { type: reprocessing.type })}
- description={t('admin.bills.events.reprocessText')}
- submit={t('admin.bills.events.reprocess')}
- run={reason => reprocess(reprocessing, reason)}
- notify={notify}
- onClose={() => setReprocessing(null)}
- />
- )}
- </Card>
+ {runner.dialog}
+ </ListCard>
</>
)
}
@@ -1491,33 +1484,19 @@ function StripeCustomer({
)
}
-function BillDetail({ id, notify }: { id: string; notify: Notify }) {
- const t = useT()
- const query = useQuery(billKey(id), loadBill(id))
- const [open, setOpen] = useState<Open | null>(null)
- const bill = query.data
- // The Stripe customer's name and email, asked of Stripe on its own so the page never waits for it.
- const customer = useQuery(bill?.stripeCustomerId ? customerKey(id) : null, loadCustomer(id))
- if (!bill)
- return (
- <div className="k-card">
- <Loading
- what={t('admin.bills.detail.what')}
- loading
- error={query.error}
- onRetry={() => void query.reload()}
- skeleton={<SkeletonRows rows={6} columns={2} />}
- />
- </div>
- )
+/**
+ * What an admin can do to a bill, only what can run now (Resume a comped or suspended one, never Comp it again), and
+ * why the others can't. Credit and Refund are buttons in the page header, the rest in its ⋯ menu.
+ */
+export function billActions(t: Translate, bill: AdminBillDetail, open: (what: Open) => void): AdminAction[] {
const canceled = bill.status === 'canceled'
- const actions: AdminAction[] = [
+ return [
{
id: 'credit',
label: t('admin.bills.action.credit'),
icon: 'plus',
tip: t('admin.bills.action.creditTip'),
- run: async () => setOpen({ kind: 'credit' }),
+ run: async () => open({ kind: 'credit' }),
},
{
id: 'refund',
@@ -1529,7 +1508,7 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
: !bill.refundable.some(p => p.creditedMicros > p.refundedMicros)
? t('admin.bills.action.nothingToRefund')
: undefined,
- run: async () => setOpen({ kind: 'refund' }),
+ run: async () => open({ kind: 'refund' }),
},
...(bill.status === 'comped' || bill.status === 'suspended'
? [
@@ -1538,7 +1517,7 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
label: t('admin.bills.action.resume'),
icon: 'restart' as const,
tip: t('admin.bills.action.resumeTip'),
- run: async () => setOpen({ kind: 'status', status: 'active' }),
+ run: async () => open({ kind: 'status', status: 'active' }),
},
]
: []),
@@ -1546,10 +1525,11 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
? [
{
id: 'comp',
+ menu: true,
label: t('admin.bills.action.comp'),
icon: 'star' as const,
tip: t('admin.bills.action.compTip'),
- run: async () => setOpen({ kind: 'status', status: 'comped' }),
+ run: async () => open({ kind: 'status', status: 'comped' }),
},
]
: []),
@@ -1557,38 +1537,43 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
? [
{
id: 'suspend',
+ menu: true,
label: t('admin.bills.action.suspend'),
icon: 'ban' as const,
tip: t('admin.bills.action.suspendTip'),
danger: true,
- run: async () => setOpen({ kind: 'status', status: 'suspended' }),
+ run: async () => open({ kind: 'status', status: 'suspended' }),
},
]
: []),
{
id: 'cap',
+ menu: true,
label: t('admin.bills.action.cap'),
icon: 'pencil',
tip: t('admin.bills.action.capTip'),
- run: async () => setOpen({ kind: 'cap' }),
+ run: async () => open({ kind: 'cap' }),
},
{
id: 'concurrency',
+ menu: true,
label: t('admin.bills.action.concurrency'),
icon: 'phone',
tip: t('admin.bills.action.concurrencyTip'),
- run: async () => setOpen({ kind: 'concurrency' }),
+ run: async () => open({ kind: 'concurrency' }),
},
{
id: 'owner',
+ menu: true,
label: t('admin.bills.action.owner'),
icon: 'user',
tip: t('admin.bills.action.ownerTip'),
disabledReason: bill.members.length < 2 ? t('admin.bills.action.noOtherMember') : undefined,
- run: async () => setOpen({ kind: 'owner' }),
+ run: async () => open({ kind: 'owner' }),
},
{
id: 'move',
+ menu: true,
label: t('admin.bills.action.move'),
icon: 'move',
tip: t('admin.bills.action.moveTip'),
@@ -1597,9 +1582,31 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
: !bill.otherBills.some(b => b.status !== 'canceled')
? t('admin.bills.action.noOtherBill')
: undefined,
- run: async () => setOpen({ kind: 'move' }),
+ run: async () => open({ kind: 'move' }),
},
]
+}
+
+function BillDetail({ id, notify, slot }: { id: string; notify: Notify; slot: HTMLElement | null }) {
+ const t = useT()
+ const query = useQuery(billKey(id), loadBill(id))
+ const [open, setOpen] = useState<Open | null>(null)
+ const bill = query.data
+ // The Stripe customer's name and email, asked of Stripe on its own so the page never waits for it.
+ const customer = useQuery(bill?.stripeCustomerId ? customerKey(id) : null, loadCustomer(id))
+ if (!bill)
+ return (
+ <div className="k-card">
+ <Loading
+ what={t('admin.bills.detail.what')}
+ loading
+ error={query.error}
+ onRetry={() => void query.reload()}
+ skeleton={<SkeletonRows rows={6} columns={2} />}
+ />
+ </div>
+ )
+ const actions = billActions(t, bill, setOpen)
const stripe = (path: string) => (bill.dashboardUrl ? `${bill.dashboardUrl}/${path}` : null)
// The extra calls at the same time the owner bought (LIN-450), over the bill's workspaces.
const extraCalls = bill.workspaces.reduce((sum, w) => sum + w.extraCalls, 0)
@@ -1610,11 +1617,12 @@ function BillDetail({ id, notify }: { id: string; notify: Notify }) {
return (
<>
- <ActionBar
+ <DetailActions
actions={actions}
onPick={a => {
void a.run()
}}
+ slot={slot}
/>
<Card title={t('admin.bills.detail.facts')} className="adm-detail">
<dl className="adm-facts">
diff --git a/apps/web/src/admin/CallReviews.tsx b/apps/web/src/admin/CallReviews.tsx
index 42bec967..f9d379ab 100644
--- a/apps/web/src/admin/CallReviews.tsx
+++ b/apps/web/src/admin/CallReviews.tsx
@@ -1,5 +1,5 @@
// Server admin › Call quality › Flagged calls: the calls the evaluation flagged (Missed something, Went wrong) across workspaces,
-// newest first, each with the reviewer's notes on what the assistant did, filtered by workspace. Staff only: what the
+// newest first, each with the reviewer's notes on what the assistant did, filtered by workspace (chips). Staff only: what the
// assistant itself did wrong is ours to fix, so the business never sees it (it sees the open questions in Business info). Read-only.
import { useT } from '@linedesk/i18n/react'
import { useState } from 'react'
@@ -7,11 +7,11 @@ import { useQuery } from '../cachedQuery.ts'
import { ScoreBadge } from '../review/ScoreBadge.tsx'
import { listTime, parseTs } from '../time.ts'
import { AppLink } from '../ui/AppLink.tsx'
-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 { FilterChip, FilterChips } from '../ui/FilterChips.tsx'
import '../settings/knowledge.css'
import '../review/review.css'
@@ -31,25 +31,20 @@ export function CallReviews() {
const workspaces = query.data?.workspaces ?? []
const reviews = query.data?.reviews
return (
- <Card
- title={t('admin.callReviews.title')}
- actions={
- <Select
- size="sm"
- align="end"
- label={t('admin.callReviews.workspace')}
- value={workspace}
- onChange={setWorkspace}
- options={[
- { value: ALL, label: t('admin.callReviews.allWorkspaces') },
- ...workspaces.map(w => ({
- value: w.id,
- label: t('admin.callReviews.workspaceOption', { name: w.name ?? w.id, count: w.flagged }),
- })),
- ]}
- />
- }
- >
+ <Card title={t('admin.callReviews.title')}>
+ {/* The workspaces with flagged calls as chips, once there is more than one to pick between. */}
+ {workspaces.length > 1 && (
+ <FilterChips label={t('admin.callReviews.workspace')}>
+ <FilterChip pressed={workspace === ALL} onClick={() => setWorkspace(ALL)}>
+ {t('admin.callReviews.allWorkspaces')}
+ </FilterChip>
+ {workspaces.map(w => (
+ <FilterChip key={w.id} pressed={workspace === w.id} onClick={() => setWorkspace(w.id)}>
+ {w.name ?? t('admin.audit.deletedWorkspace')}
+ </FilterChip>
+ ))}
+ </FilterChips>
+ )}
<Loading
what={t('admin.callReviews.what')}
loading={!reviews}
diff --git a/apps/web/src/admin/ClientPartner.tsx b/apps/web/src/admin/ClientPartner.tsx
index 123d6cf9..343da0e4 100644
--- a/apps/web/src/admin/ClientPartner.tsx
+++ b/apps/web/src/admin/ClientPartner.tsx
@@ -1,6 +1,6 @@
-// Server admin › Workspaces › Partner… (LIN-530): move a workspace to another white-label partner, add it to one, or
-// take it from its partner (`partner.adminMoveClient`). The shared type-to-confirm dialog with a partner picker: what
-// changes is listed for the picked choice, the workspace's name unlocks the button, the reason goes to the audit log.
+// Server admin › Workspaces › Move… (LIN-530): move a workspace to another white-label partner, add it to one, or
+// take it from its partner (`partner.adminMoveClient`). The shared confirm dialog with a partner picker: what changes
+// is listed for the picked choice, the reason goes to the audit log. No name to type: a move can be moved back.
import { type AdminPartnerList, PARTNER_CODES, UNPAID_PARTNER_CLIENTS } from '@linedesk/actions'
import type { MessageKey } from '@linedesk/i18n'
import { useT } from '@linedesk/i18n/react'
@@ -91,7 +91,6 @@ export function ClientPartnerDialog({
: t('admin.clientPartner.textWithout', { name: w.name }),
action,
busyAction: t('admin.clientPartner.busy'),
- typed: w.name,
variant: 'primary',
reason: {
label: t('admin.bills.reason.label'),
diff --git a/apps/web/src/admin/Onboarding.tsx b/apps/web/src/admin/Onboarding.tsx
index 6a45f0bf..ff1fe9a3 100644
--- a/apps/web/src/admin/Onboarding.tsx
+++ b/apps/web/src/admin/Onboarding.tsx
@@ -9,7 +9,8 @@ import { useT } from '@linedesk/i18n/react'
import { useMemo, useState } from 'react'
import { setQueryData, useQuery } from '../cachedQuery.ts'
import { fmt } from '../i18n/format.ts'
-import { Select, Switch } from '../ui/controls.tsx'
+import { Switch } from '../ui/controls.tsx'
+import { FilterChip, FilterChips } from '../ui/FilterChips.tsx'
import { Card, Input } from '../ui/form.tsx'
import { Button } from '../ui/kit.tsx'
import { Loading, Skeleton, SkeletonRows } from '../ui/LoadStates.tsx'
@@ -221,11 +222,6 @@ const reached = (w: AtRiskWorkspace, t: ReturnType<typeof useT>) =>
const DAYS = ['1', '3', '7', '14'] as const
-/** An empty list: either every workspace old enough had a real call, or none is old enough to judge yet (a new install). */
-function emptyText(t: ReturnType<typeof useT>, oldEnough: number, days: string) {
- return t('admin.onboarding.empty', { count: oldEnough, days: Number(days) })
-}
-
type Translate = ReturnType<typeof useT>
/** The setup emails sent, oldest first. */
@@ -289,7 +285,7 @@ const atRiskColumns = (t: Translate): Column<AtRiskWorkspace>[] => [
]
type AtRiskProps = {
- /** The views of Workspaces; the "added more than" pick sits on the right, where All has New workspace. */
+ /** The views of Workspaces; the "added more than" chips sit on the right. */
views: React.ReactNode
onOpen: (id: string) => void
keysRef: { current: ListKeys | null }
@@ -307,14 +303,18 @@ export function AtRisk({ views, onOpen, keysRef }: AtRiskProps) {
<>
<div className="adm-risk-bar">
{views}
- <Select
- size="sm"
- align="end"
- label={t('admin.onboarding.addedMoreThan')}
- value={days}
- onChange={setDays}
- options={DAYS.map(d => ({ value: d, label: t('admin.onboarding.moreThanDays', { days: Number(d) }) }))}
- />
+ <FilterChips label={t('admin.onboarding.addedMoreThan')}>
+ {DAYS.map(d => (
+ <FilterChip
+ key={d}
+ pressed={days === d}
+ title={t('admin.onboarding.moreThanDays', { days: Number(d) })}
+ onClick={() => setDays(d)}
+ >
+ {t('admin.onboarding.overDays', { days: Number(d) })}
+ </FilterChip>
+ ))}
+ </FilterChips>
</div>
{rows ? (
<AdminList
@@ -328,7 +328,7 @@ export function AtRisk({ views, onOpen, keysRef }: AtRiskProps) {
label={t('admin.onboarding.atRisk')}
onOpen={w => onOpen(w.id)}
keysRef={keysRef}
- empty={emptyText(t, query.data?.oldEnough ?? 0, days)}
+ empty={t('admin.onboarding.atRiskEmpty')}
/>
) : (
<div className="k-card adm-listcard">
diff --git a/apps/web/src/admin/UsersPage.test.tsx b/apps/web/src/admin/UsersPage.test.tsx
index 374114f0..239de8e9 100644
--- a/apps/web/src/admin/UsersPage.test.tsx
+++ b/apps/web/src/admin/UsersPage.test.tsx
@@ -18,7 +18,14 @@ const user: AdminUser = {
}
const detail = (u: AdminUser) =>
renderToStaticMarkup(
- <UserDetail user={u} workspaces={[]} currentUserId="admin" notify={() => {}} reload={async () => {}} />,
+ <UserDetail
+ user={u}
+ workspaces={[]}
+ currentUserId="admin"
+ notify={() => {}}
+ reload={async () => {}}
+ headActions={null}
+ />,
)
test('the terms accepted last: the version and when', () => {
diff --git a/apps/web/src/admin/UsersPage.tsx b/apps/web/src/admin/UsersPage.tsx
index eb0a5cb8..f8b5515e 100644
--- a/apps/web/src/admin/UsersPage.tsx
+++ b/apps/web/src/admin/UsersPage.tsx
@@ -7,7 +7,7 @@ import { i18n } from '../i18n/index.tsx'
import { Card } from '../ui/form.tsx'
import { Avatar, Badge } from '../ui/kit.tsx'
import { AddUser } from './AddUser.tsx'
-import { ActionBar, RowActions, useActionRunner, userActions } from './actions.tsx'
+import { DetailActions, RowActions, useActionRunner, userActions } from './actions.tsx'
import { AdminList, type Column, type ListKeys } from './AdminList.tsx'
import { type AdminUser, type AdminWorkspace, filterUsers, USER_FILTERS, type UserFilter } from './api.ts'
import { UserWorkspaces } from './Memberships.tsx'
@@ -149,15 +149,17 @@ type DetailProps = {
currentUserId: string
notify: Notify
reload: () => Promise<void>
+ /** The page header's slot for its actions (AdminMode). */
+ headActions: HTMLElement | null
}
-export function UserDetail({ user: u, workspaces, currentUserId, notify, reload }: DetailProps) {
+export function UserDetail({ user: u, workspaces, currentUserId, notify, reload, headActions }: DetailProps) {
const runner = useActionRunner(notify)
const t = useT()
const actions = userActions(u, currentUserId, reload)
return (
<>
- <ActionBar actions={actions} onPick={runner.pick} />
+ <DetailActions actions={actions} onPick={runner.pick} slot={headActions} />
<Card title={t('admin.users.details')} className="adm-detail">
<dl className="adm-facts">
<Fact label={t('admin.users.fact.email')}>{u.email}</Fact>
diff --git a/apps/web/src/admin/WorkspacesPage.tsx b/apps/web/src/admin/WorkspacesPage.tsx
index 2c155fba..68b33244 100644
--- a/apps/web/src/admin/WorkspacesPage.tsx
+++ b/apps/web/src/admin/WorkspacesPage.tsx
@@ -5,9 +5,9 @@ import { type MessageKey, msg } from '@linedesk/i18n'
import { type FormEvent, useEffect, useMemo, useState } from 'react'
import { createPortal } from 'react-dom'
import { fmt } from '../i18n/format.ts'
-import { Card, FormField, Input } from '../ui/form.tsx'
+import { Card, FormField, Input, onSaveKey, SaveBar } from '../ui/form.tsx'
import { Badge, Button, Note } from '../ui/kit.tsx'
-import { ActionBar, RowActions, signInAsOwnerAction, useActionRunner, workspaceActions } from './actions.tsx'
+import { DetailActions, RowActions, signInAsOwnerAction, useActionRunner, workspaceActions } from './actions.tsx'
import { AdminList, type Column, type ListKeys } from './AdminList.tsx'
import { type AdminUser, type AdminWorkspace, runAdmin } from './api.ts'
import { WorkspaceMembersCard } from './Memberships.tsx'
@@ -195,6 +195,8 @@ type DetailProps = {
viewerWorkspaces: ReadonlySet<string>
/** The signed-in admin: signing in as an owner who is you is refused. */
currentUserId: string
+ /** The page header's slot for its actions (AdminMode). */
+ headActions: HTMLElement | null
}
export function WorkspaceDetail({
@@ -205,18 +207,20 @@ export function WorkspaceDetail({
onDeleted,
viewerWorkspaces,
currentUserId,
+ headActions,
}: DetailProps) {
const runner = useActionRunner(notify)
const t = useT()
const signInAsOwner = signInAsOwnerAction(w, users, currentUserId)
return (
<>
- <ActionBar
+ <DetailActions
actions={[
...(signInAsOwner ? [signInAsOwner] : []),
...workspaceActions(w, reload, { onDeleted, viewerIsMember: viewerWorkspaces.has(w.id) }),
]}
onPick={runner.pick}
+ slot={headActions}
/>
<Card title={t('admin.workspaces.details')} className="adm-detail">
<dl className="adm-facts">
@@ -292,7 +296,7 @@ function SpendingCapCard({
description={t('admin.workspaces.cap.description')}
className="adm-detail"
>
- <form onSubmit={save} className="adm-cap-form">
+ <form onSubmit={save} onKeyDown={e => onSaveKey(e, text.trim() !== saved && !saving)} className="adm-cap-form">
<FormField
id="adm-spending-cap"
label={t('admin.workspaces.cap.label')}
@@ -308,9 +312,14 @@ function SpendingCapCard({
onChange={e => setText(e.target.value)}
/>
</FormField>
- <Button type="submit" variant="primary" disabled={saving || text.trim() === saved}>
- {t('common.action.save')}
- </Button>
+ <SaveBar
+ dirty={text.trim() !== saved}
+ saving={saving}
+ onCancel={() => {
+ setText(saved)
+ setProblem(null)
+ }}
+ />
</form>
{reached && (
<Note tone="danger" className="adm-cap-note">
diff --git a/apps/web/src/admin/actions.tsx b/apps/web/src/admin/actions.tsx
index 6b4e03cc..cd7e01c9 100644
--- a/apps/web/src/admin/actions.tsx
+++ b/apps/web/src/admin/actions.tsx
@@ -1,8 +1,10 @@
-// What an admin can do to a user or a workspace, in one place: the detail page shows the actions as
-// a row of buttons, the list as quick icon buttons on each row (and a ⋯ menu on phones and touch screens).
-// Actions that change access ask once in a dialog; the rest run at once.
+// What an admin can do to a user or a workspace, in one place: the detail page shows the actions in its header
+// (buttons, the rest in a ⋯ menu), the list as quick icon buttons on each row (and a ⋯ menu on phones and touch
+// screens). Actions that change access or can't be undone ask once in a dialog; the rest run at once, with Undo where
+// they can be taken back (Disable workspace).
import { useT } from '@linedesk/i18n/react'
import { type ReactNode, useState } from 'react'
+import { createPortal } from 'react-dom'
import { brandName } from '../brand.ts'
import { fmt } from '../i18n/format.ts'
import { i18n } from '../i18n/index.tsx'
@@ -41,6 +43,10 @@ export type AdminAction = {
subject?: string
/** Destroys data (Delete workspace): its button is red, as in Workspace settings › Danger zone. */
danger?: boolean
+ /** On a detail page: in the ⋯ menu instead of a button of its own (the less frequent actions, and Delete). */
+ menu?: boolean
+ /** Takes it back (the toast's Undo and Z): an action that acts at once instead of asking (Disable). */
+ undo?: () => Promise<unknown>
/** Why it cannot run now: the detail page shows the button disabled with this next to it. */
disabledReason?: string
/** A dialog of its own instead of the confirmation (it runs the action itself; `run` is not called). */
@@ -155,6 +161,7 @@ export function userActions(u: AdminUser, currentUserId: string, reload: () => P
if (!u.instance_admin && !u.disabled_at)
actions.push({
id: 'grant',
+ menu: true,
label: t('admin.actions.user.grant.label'),
icon: 'shield',
tip: t('admin.actions.user.grant.tip'),
@@ -185,6 +192,7 @@ export function userActions(u: AdminUser, currentUserId: string, reload: () => P
if (u.instance_admin && !isSelf && !u.instance_admin_by_env)
actions.push({
id: 'revoke',
+ menu: true,
label: t('admin.actions.user.revoke.label'),
icon: 'shield',
tip: t('admin.actions.user.revoke.tip'),
@@ -199,6 +207,7 @@ export function userActions(u: AdminUser, currentUserId: string, reload: () => P
if (u.instance_admin && !isSelf && !u.disabled_at && u.passkeys?.length === 0)
actions.push({
id: 'enrolment-code',
+ menu: true,
label: t('admin.actions.user.enrolmentCode.label'),
icon: 'shield',
tip: t('admin.actions.user.enrolmentCode.tip'),
@@ -214,6 +223,7 @@ export function userActions(u: AdminUser, currentUserId: string, reload: () => P
if (!isSelf && !u.disabled_at)
actions.push({
id: 'reset-passkeys',
+ menu: true,
label: t('admin.actions.user.resetPasskeys.label'),
icon: 'restart',
tip: t('admin.actions.user.resetPasskeys.tip'),
@@ -240,6 +250,7 @@ export function userActions(u: AdminUser, currentUserId: string, reload: () => P
else if (!isSelf)
actions.push({
id: 'disable',
+ menu: true,
label: t('admin.actions.user.disable.label'),
icon: 'ban',
tip: t('admin.actions.user.disable.tip'),
@@ -358,6 +369,7 @@ export function workspaceActions(
label: t('admin.actions.workspace.delete.label'),
icon: 'trash',
danger: true,
+ menu: true,
tip: t('admin.actions.workspace.delete.tip'),
confirm: {
...deleteWorkspaceText(w, viewerIsMember),
@@ -390,12 +402,10 @@ export function workspaceActions(
label: t('admin.actions.workspace.disable.label'),
icon: 'ban',
tip: t('admin.actions.workspace.disable.tip'),
- confirm: {
- text: t('admin.actions.workspace.disable.text', { name: w.name }),
- action: t('admin.actions.workspace.disable.action'),
- typed: w.name,
- },
+ menu: true,
+ // It can be taken back at once (Enable), so it acts without asking and offers Undo (rule 5).
run: set(true),
+ undo: set(false),
done: t('admin.actions.workspace.disable.done', { name: w.name }),
},
]
@@ -409,7 +419,7 @@ export function workspaceActions(
run: async () => {},
dialog: (close, notify) => <ClientPartnerDialog workspace={w} onClose={close} notify={notify} reload={reload} />,
}
- return [...toggle, partner, remove]
+ return [partner, ...toggle, remove]
}
const doneText = (action: AdminAction, made: unknown) =>
@@ -455,7 +465,7 @@ export function useActionRunner(notify: Notify) {
if (action.confirm || action.dialog) return setPending(action)
try {
const made = await action.run()
- if (action.done) notify(doneText(action, made))
+ if (action.done) notify(doneText(action, made), action.undo)
} catch (err) {
notify(errorText(err))
}
@@ -471,32 +481,63 @@ export function useActionRunner(notify: Notify) {
return { pick: (action: AdminAction) => void pick(action), dialog }
}
-/** The detail page's actions: a row of buttons under the title. */
-export function ActionBar({ actions, onPick }: { actions: AdminAction[]; onPick: (action: AdminAction) => void }) {
+/**
+ * A detail page's actions (a workspace, a user, a bill), in the page header's slot at the right of its title: the
+ * everyday ones as buttons, the rest (`menu`) in one ⋯ menu, a red item for what destroys data. Why a button is off
+ * shows as its tooltip and as a quiet line on the page (`slot` null: that line only, until the header is there).
+ */
+export function DetailActions({
+ actions,
+ onPick,
+ slot,
+}: {
+ actions: AdminAction[]
+ onPick: (action: AdminAction) => void
+ slot: HTMLElement | null
+}) {
+ const t = useT()
if (!actions.length) return null
- const blocked = actions.filter(a => a.disabledReason)
+ const buttons = actions.filter(a => !a.menu)
+ const menu: MenuItem[] = actions
+ .filter(a => a.menu)
+ .map(a => ({
+ id: a.id,
+ label: a.label,
+ lead: <Icon name={a.icon} size={15} />,
+ danger: a.danger,
+ disabled: !!a.disabledReason,
+ title: a.disabledReason ?? a.tip,
+ onSelect: () => onPick(a),
+ }))
+ const blocked = buttons.filter(a => a.disabledReason)
return (
- <div className="adm-actbar">
- {actions.map(a => (
- <Button
- key={a.id}
- size="sm"
- icon={a.icon}
- variant={a.danger ? 'danger-outline' : undefined}
- title={a.disabledReason ?? a.tip}
- disabled={!!a.disabledReason}
- aria-describedby={a.disabledReason ? `adm-act-why-${a.id}` : undefined}
- onClick={() => onPick(a)}
- >
- {a.label}
- </Button>
- ))}
+ <>
+ {slot &&
+ createPortal(
+ <>
+ {buttons.map(a => (
+ <Button
+ key={a.id}
+ size="sm"
+ icon={a.icon}
+ title={a.disabledReason ?? a.tip}
+ disabled={!!a.disabledReason}
+ aria-describedby={a.disabledReason ? `adm-act-why-${a.id}` : undefined}
+ onClick={() => onPick(a)}
+ >
+ {a.label}
+ </Button>
+ ))}
+ {menu.length > 0 && <MenuButton items={menu} title={t('admin.actions.menu')} variant="secondary" />}
+ </>,
+ slot,
+ )}
{blocked.map(a => (
- <span key={a.id} id={`adm-act-why-${a.id}`} className="adm-actbar-why">
+ <p key={a.id} id={`adm-act-why-${a.id}`} className="help adm-actbar-why">
{a.disabledReason}
- </span>
+ </p>
))}
- </div>
+ </>
)
}
diff --git a/apps/web/src/admin/admin.css b/apps/web/src/admin/admin.css
index 38a80f43..5f6f5669 100644
--- a/apps/web/src/admin/admin.css
+++ b/apps/web/src/admin/admin.css
@@ -17,15 +17,36 @@
border-top: 1px solid var(--line);
white-space: nowrap;
}
+/* The headings in the type of every list's (ColumnHeads), no line above the first row. */
.adm-table thead th {
border-top: 0;
padding-top: 0;
- font-size: 12px;
+ font-size: 11px;
font-weight: 500;
color: var(--ink-muted);
}
+.adm-table tbody tr:first-child > * {
+ border-top: 0;
+}
.adm-table tbody th {
- font-weight: 500;
+ font-weight: 600;
+}
+/* The rows of a list: 44px, the words on the middle line (a number report reads like the lists around it). */
+@media (min-width: 560px) {
+ .adm-table tbody th,
+ .adm-table tbody td,
+ .adm-table tfoot th,
+ .adm-table tfoot td {
+ height: 44px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ vertical-align: middle;
+ }
+ .adm-table thead th {
+ height: 28px;
+ padding-bottom: 0;
+ vertical-align: middle;
+ }
}
.adm-table tbody th .k-badge {
margin-left: 6px;
@@ -164,6 +185,15 @@
.adm-head-actions:empty {
display: none;
}
+/* On a phone a detail page's actions go under its title, wrapping, so none sits off the edge. */
+@media (max-width: 719px) {
+ .adm-head-row {
+ flex-wrap: wrap;
+ }
+ .adm-head-actions {
+ flex-wrap: wrap;
+ }
+}
.adm-head h2 {
margin: 0;
font-size: 16px;
@@ -432,32 +462,21 @@
text-align: right;
}
}
-/* The spending cap: one amount field and Save on a row. */
+/* The spending cap: one amount field; the Save bar under it while it is changed. */
.adm-cap-form {
- display: flex;
- align-items: flex-end;
- gap: 10px;
- max-width: 420px;
+ display: grid;
+ gap: 12px;
}
.adm-cap-form > :first-child {
- flex: 1;
+ max-width: 420px;
}
.adm-cap-note {
margin-top: 10px;
}
-/* Actions: a row of buttons under a detail's title; quick icon buttons at the end of a list row
- (on hover, focus or the cursor), a ⋯ menu instead on touch screens. */
-.adm-actbar {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: 8px;
-}
-/* Why a button of the row is disabled (Sign in as owner: the owner is a server admin, disabled, or you). */
+/* Why a detail page's action is off (Sign in as owner: the owner is a server admin, disabled, or you): a quiet line
+ on the page, the buttons are in its header (DetailActions). */
.adm-actbar-why {
- flex-basis: 100%;
- font-size: 12.5px;
- color: var(--ink-muted);
+ margin: 0;
}
/*
* Row actions get a column of their own at the end of the row, so they never cover a cell's text ("Never", a time).
@@ -747,10 +766,14 @@
text-overflow: ellipsis;
white-space: nowrap;
}
- /* Phones stack the rows, so the headings are hidden, as on every list (ColumnHeads). */
+ /* Phones stack the rows, so the headings are hidden, as on every list (ColumnHeads), and with them the line under
+ them (the first row's). */
.adm-list > .ib-cols.adm-row-head {
display: none;
}
+ .adm-list > .adm-row.adm-row-head + .adm-row {
+ background-image: 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),
@@ -1078,24 +1101,22 @@
margin-left: auto;
}
-/* Audit log: filters in one wrapping row above the table, "Show older" below it. */
-.adm-audit-filters {
+/* A list's filters under its search (Audit log: workspace, from, to), and "Show older" under its rows. */
+.adm-list-tools {
display: flex;
flex-wrap: wrap;
gap: 8px;
- margin-bottom: 14px;
+ margin: 0 8px 8px;
}
-.adm-audit-who {
- flex: 1 1 200px;
+.adm-list-more {
+ display: flex;
+ justify-content: center;
+ padding-top: 10px;
}
.adm-audit-filters .k-date {
- flex: 1 1 140px;
- max-width: 180px;
-}
-/* Its kinds as chips above the card (LIN-833); More holds the less used ones in a small menu. */
-.adm-audit-kinds {
- margin-bottom: 12px;
+ flex: 0 1 160px;
}
+/* The Audit log's kinds as chips above the card (LIN-833); More holds the less used ones in a small menu. */
.adm-audit-more-kinds {
display: inline-flex;
}
@@ -1110,31 +1131,70 @@
text-overflow: ellipsis;
white-space: nowrap;
}
-/* On a phone the chips stay one row that scrolls sideways; the person and workspace each take a line, the dates share
- one. */
+/* When, Who, What (wraps: names can be long), Workspace (cut with …, the full name in its tooltip). */
+.adm-audit-list > .adm-row.adm-row {
+ grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr) minmax(0, 1.8fr) minmax(0, 1fr);
+ align-items: start;
+ padding-top: 10px;
+ padding-bottom: 10px;
+}
+.adm-audit-list > .adm-row-head.adm-row-head {
+ padding-top: 0;
+ padding-bottom: 0;
+ align-items: center;
+}
+.adm-audit-list .adm-audit-what {
+ white-space: normal;
+ overflow-wrap: anywhere;
+}
+/* On a phone the chips wrap like every chip row (none hides off the edge); the workspace takes a line, the dates
+ share one. A row says what happened first, then when and who on one quiet line under it. */
@media (max-width: 559px) {
- .k-chips.adm-audit-kinds {
- flex-wrap: nowrap;
- overflow-x: auto;
- scrollbar-width: none;
- }
- .adm-audit-kinds > * {
- flex: none;
- }
- .adm-audit-filters > .adm-audit-who,
.adm-audit-filters > .k-select {
flex: 1 1 100%;
}
.adm-audit-filters .k-date {
flex: 1 1 0;
min-width: 0;
- max-width: none;
}
}
-.adm-audit-more {
- display: flex;
- justify-content: center;
- padding-top: 12px;
+/* A phone's row: what happened on its own line, then "10:58 AM · Mike Brennan · Brightwater" in grey, without the
+ column names the other lists put there (the selectors outweigh the shared stacking rules above). */
+@media (max-width: 719px) {
+ .adm-list.adm-audit-list
+ > .adm-row.adm-row:not(.adm-row-head)
+ > .adm-cell.adm-cell[data-label]:not(.adm-cell-acts)::before {
+ content: none;
+ }
+ .adm-list.adm-audit-list
+ > .adm-row.adm-row:not(.adm-row-head)
+ > .adm-cell.adm-cell[data-label]:is(:nth-child(2), :nth-child(4))::before {
+ content: "\00a0·\00a0";
+ }
+ .adm-audit-list > .adm-row:not(.adm-row-head) > .adm-cell:nth-child(3) {
+ order: -1;
+ flex: 0 0 100%;
+ font-size: 13px;
+ color: var(--ink);
+ }
+ .adm-audit-list > .adm-row:not(.adm-row-head) > .adm-cell:first-child {
+ flex: none;
+ font-size: 12px;
+ color: var(--ink-muted);
+ }
+ .adm-audit-list > .adm-row:not(.adm-row-head) > .adm-cell:not(:nth-child(3)) .adm-who {
+ display: inline;
+ }
+ .adm-audit-list > .adm-row:not(.adm-row-head) > .adm-cell:not(:nth-child(3)) .adm-sub {
+ display: none;
+ }
+ .adm-audit-list > .adm-row:not(.adm-row-head) > .adm-cell:has(> .adm-none) {
+ display: none;
+ }
+ .adm-list.adm-audit-list > .adm-row:not(.adm-row-head) > .adm-cell:not(:nth-child(3)) .adm-strong {
+ display: inline;
+ font-weight: 400;
+ }
}
/* Redirect URIs of an OAuth app, each with a copy button (ProviderDialog). */
@@ -1894,8 +1954,7 @@
gap: 14px;
min-width: 0;
}
-.adm-form > .k-btn,
-.adm-form > .adm-actbar {
+.adm-form > .k-btn {
justify-self: start;
}
@@ -2096,26 +2155,6 @@
margin: 0;
padding: 0 12px;
}
-@media (min-width: 560px) {
- .adm-usage th,
- .adm-usage td {
- height: 44px;
- padding: 4px 12px 4px 0;
- vertical-align: middle;
- }
- .adm-usage thead th {
- height: 32px;
- padding-top: 0;
- padding-bottom: 0;
- font-size: 11px;
- }
- .adm-usage tbody th {
- font-weight: 600;
- }
- .adm-usage tbody tr:first-child > * {
- border-top: 0;
- }
-}
/* Workspaces › At risk: the views on the left, "added more than" on the right; room for the step a workspace stopped at. */
.adm-risk-bar {
display: flex;
@@ -2178,23 +2217,6 @@
margin-top: 0;
}
-/* Audit log: what happened wraps (workspace and owner names can be long); the workspace stays one line and is cut
- with … (a deleted workspace shows its long id), the full name in its tooltip. So the row stays inside the card.
- On a phone the table stacks and every cell wraps already (above). */
-@media (min-width: 560px) {
- .adm-audit-table .adm-audit-what {
- white-space: normal;
- overflow-wrap: anywhere;
- min-width: 160px;
- }
- .adm-audit-table .adm-audit-workspace {
- display: block;
- max-width: 140px;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-}
-
/* Sign-up limits under their line on Sign-up & access: each group a heading in the one form. */
.adm-rules-sub {
display: grid;
diff --git a/packages/i18n/locales/de/admin.json b/packages/i18n/locales/de/admin.json
index abb561f1..b11764a6 100644
--- a/packages/i18n/locales/de/admin.json
+++ b/packages/i18n/locales/de/admin.json
@@ -55,10 +55,8 @@
"actions.workspace.deleted.leftAtCarrier": "beim Telefonanbieter verblieben",
"actions.workspace.deleted.number": "{number}: {note}",
"actions.workspace.deleted.planCanceled": "Sein Tarif ist damit beendet, es wird nichts mehr berechnet.",
- "actions.workspace.disable.action": "Workspace deaktivieren",
"actions.workspace.disable.done": "{name} ist deaktiviert. Seine Anrufe werden nicht mehr angenommen.",
"actions.workspace.disable.label": "Deaktivieren…",
- "actions.workspace.disable.text": "Anrufe an {name} werden nicht mehr angenommen, und die Mitglieder können nur noch lesen.",
"actions.workspace.disable.tip": "Anrufe an seine Nummern werden nicht mehr angenommen; Mitglieder können sich weiter anmelden und lesen.",
"actions.workspace.enable.done": "{name} ist aktiviert. Seine Anrufe werden wieder angenommen.",
"actions.workspace.enable.label": "Aktivieren",
@@ -302,7 +300,6 @@
"audit.passkeysReset": "Passkeys eines Nutzers zurückgesetzt",
"audit.passwordChanged": "Passwort geändert",
"audit.passwordSet": "Passwort festgelegt",
- "audit.person": "Person",
"audit.personPlaceholder": "Person (E-Mail oder Name)",
"audit.personalKeyDropped": "{named, select, yes {Persönlicher Schlüssel „{name}“ widerrufen, als die Adresse bestätigt wurde} other {Ein persönlicher Schlüssel widerrufen, als die Adresse bestätigt wurde}}",
"audit.providerClearKeys": "{known, select, yes {Schlüssel von {provider} entfernt} other {Schlüssel eines Anbieters entfernt}}",
@@ -537,7 +534,6 @@
"bills.move.workspace": "Workspace",
"bills.noOwner": "Kein Inhaber",
"bills.noWorkspaces": "Keine Workspaces in dieser Abrechnung",
- "bills.open": "Öffnen",
"bills.owner.current": "Aktueller Inhaber",
"bills.owner.done": "Die Abrechnung gehört jetzt {owner}",
"bills.owner.label": "Neuer Inhaber",
@@ -886,7 +882,6 @@
"callReviews.untitled": "Anruf",
"callReviews.what": "Die markierten Anrufe",
"callReviews.workspace": "Workspace",
- "callReviews.workspaceOption": "{name} ({count})",
"clientPartner.action.add": "Zu Partner hinzufügen",
"clientPartner.action.move": "Workspace verschieben",
"clientPartner.action.remove": "Partner entfernen",
@@ -1053,7 +1048,6 @@
"onboarding.email.week": "Woche",
"onboarding.emailNotConnectedOff": "Verbinde zuerst E-Mail unter Anbieter: Bis dahin erreicht keine Einrichtungs-E-Mail irgendwen.",
"onboarding.emailNotConnectedOn": "E-Mail ist unter Anbieter nicht verbunden: Bis dahin geht keine raus.",
- "onboarding.empty": "{count, plural, =0 {{days, plural, one {Keine Workspaces im Onboarding: Noch keiner wurde vor mehr als # Tag hinzugefügt.} other {Keine Workspaces im Onboarding: Noch keiner wurde vor mehr als # Tagen hinzugefügt.}}} one {{days, plural, one {Keine Workspaces im Onboarding. Der eine, der vor mehr als # Tag hinzugefügt wurde, hatte schon einen echten Anruf.} other {Keine Workspaces im Onboarding. Der eine, der vor mehr als # Tagen hinzugefügt wurde, hatte schon einen echten Anruf.}}} other {{days, plural, one {Keine Workspaces im Onboarding. Alle {count, number}, die vor mehr als # Tag hinzugefügt wurden, hatten schon einen echten Anruf.} other {Keine Workspaces im Onboarding. Alle {count, number}, die vor mehr als # Tagen hinzugefügt wurden, hatten schon einen echten Anruf.}}}}",
"onboarding.founderAddress": "Absenderadresse",
"onboarding.founderAddressHelp": "Sie muss auf einer Domain liegen, für die dein E-Mail-Anbieter sendet.",
"onboarding.founderEmail": "Persönliche E-Mail von einem Gründer",
diff --git a/packages/i18n/locales/en/admin.json b/packages/i18n/locales/en/admin.json
index ac971ef1..67773c1a 100644
--- a/packages/i18n/locales/en/admin.json
+++ b/packages/i18n/locales/en/admin.json
@@ -55,10 +55,8 @@
"actions.workspace.deleted.leftAtCarrier": "left at the carrier",
"actions.workspace.deleted.number": "{number}: {note}",
"actions.workspace.deleted.planCanceled": "Its plan ended with it, and nothing more is charged.",
- "actions.workspace.disable.action": "Disable workspace",
"actions.workspace.disable.done": "{name} is disabled. Its calls are no longer answered.",
- "actions.workspace.disable.label": "Disable…",
- "actions.workspace.disable.text": "Calls to {name} will no longer be answered and its members can only read.",
+ "actions.workspace.disable.label": "Disable",
"actions.workspace.disable.tip": "Its numbers stop being answered; members can still sign in and read.",
"actions.workspace.enable.done": "{name} is enabled. Its calls are answered again.",
"actions.workspace.enable.label": "Enable",
@@ -210,6 +208,7 @@
"audit.contact.update": "Changed a contact",
"audit.deletedAccount": "Deleted account",
"audit.deletedPurged": "Erased {calls, plural, one {# deleted call} other {# deleted calls}} and {contacts, plural, one {# deleted contact} other {# deleted contacts}} 30 days after they were deleted",
+ "audit.deletedWorkspace": "Deleted workspace",
"audit.emailChanged": "{known, select, yes {Changed the email address to {email}} other {Changed the email address}}",
"audit.emailRoutingChanged": "Changed who gets call emails ({changes})",
"audit.emailRoutingEdited": "Changed who gets call emails",
@@ -305,7 +304,6 @@
"audit.passkeysReset": "Reset a user's passkeys",
"audit.passwordChanged": "Changed the password",
"audit.passwordSet": "Set a password",
- "audit.person": "Person",
"audit.personPlaceholder": "Person (email or name)",
"audit.personalKeyDropped": "{named, select, yes {Personal key “{name}” revoked when the address was proven} other {A personal key revoked when the address was proven}}",
"audit.providerClearKeys": "{known, select, yes {Removed keys of {provider}} other {Removed keys of a provider}}",
@@ -550,7 +548,6 @@
"bills.move.workspace": "Workspace",
"bills.noOwner": "No owner",
"bills.noWorkspaces": "No workspaces on this bill",
- "bills.open": "Open",
"bills.owner.current": "Owns it now",
"bills.owner.done": "The bill now belongs to {owner}",
"bills.owner.label": "New owner",
@@ -899,7 +896,6 @@
"callReviews.untitled": "Call",
"callReviews.what": "The flagged calls",
"callReviews.workspace": "Workspace",
- "callReviews.workspaceOption": "{name} ({count})",
"clientPartner.action.add": "Add to partner",
"clientPartner.action.move": "Move workspace",
"clientPartner.action.remove": "Remove partner",
@@ -916,7 +912,7 @@
"clientPartner.loading": "the partners",
"clientPartner.noOwner": "This workspace has no owner yet, so nobody could open it without a partner. Move it to another partner, or invite its owner first.",
"clientPartner.none": "No partner",
- "clientPartner.open": "Partner…",
+ "clientPartner.open": "Move…",
"clientPartner.textWith": "{name} is with {partner}.",
"clientPartner.textWithout": "{name} has no partner.",
"clientPartner.tipWith": "With {partner}. Move it to another partner or take it from them.",
@@ -1057,6 +1053,7 @@
"needsYou.title": "Needs you",
"onboarding.addedMoreThan": "Added more than",
"onboarding.atRisk": "At risk",
+ "onboarding.atRiskEmpty": "No workspaces at risk.",
"onboarding.column.added": "Added",
"onboarding.column.stoppedAfter": "Stopped after",
"onboarding.column.workspace": "Workspace",
@@ -1068,7 +1065,6 @@
"onboarding.email.week": "Week",
"onboarding.emailNotConnectedOff": "Connect email under Providers first: until then no setup email can reach anyone.",
"onboarding.emailNotConnectedOn": "Email is not connected under Providers: none go out until it is.",
- "onboarding.empty": "{count, plural, =0 {{days, plural, one {No workspaces in onboarding: none was added more than # day ago yet.} other {No workspaces in onboarding: none was added more than # days ago yet.}}} one {{days, plural, one {No workspaces in onboarding. The one added more than # day ago has had a real call.} other {No workspaces in onboarding. The one added more than # days ago has had a real call.}}} other {{days, plural, one {No workspaces in onboarding. All {count, number} added more than # day ago have had a real call.} other {No workspaces in onboarding. All {count, number} added more than # days ago have had a real call.}}}}",
"onboarding.founderAddress": "From address",
"onboarding.founderAddressHelp": "It must be on a domain your email provider sends for.",
"onboarding.founderEmail": "Personal email from a founder",
@@ -1088,6 +1084,7 @@
"onboarding.moreThanDays": "{days, plural, one {More than # day ago} other {More than # days ago}}",
"onboarding.noEmails": "None",
"onboarding.noOwner": "No owner",
+ "onboarding.overDays": "{days, plural, one {Over # day} other {Over # days}}",
"onboarding.sendFounderEmail": "Send the personal email",
"onboarding.sendSetupEmails": "Send setup emails",
"onboarding.setupEmails": "Setup emails",
diff --git a/packages/i18n/locales/es/admin.json b/packages/i18n/locales/es/admin.json
index 5ee4d288..6432c066 100644
--- a/packages/i18n/locales/es/admin.json
+++ b/packages/i18n/locales/es/admin.json
@@ -55,10 +55,8 @@
"actions.workspace.deleted.leftAtCarrier": "sigue en el operador",
"actions.workspace.deleted.number": "{number}: {note}",
"actions.workspace.deleted.planCanceled": "Su plan terminó con él y ya no se cobra nada más.",
- "actions.workspace.disable.action": "Desactivar espacio de trabajo",
"actions.workspace.disable.done": "{name} está desactivado. Sus llamadas ya no se contestan.",
"actions.workspace.disable.label": "Desactivar…",
- "actions.workspace.disable.text": "Las llamadas a {name} ya no se contestarán y sus miembros solo podrán leer.",
"actions.workspace.disable.tip": "Sus números dejan de contestarse; los miembros pueden seguir iniciando sesión y leyendo.",
"actions.workspace.enable.done": "{name} está activado. Sus llamadas se vuelven a contestar.",
"actions.workspace.enable.label": "Activar",
@@ -302,7 +300,6 @@
"audit.passkeysReset": "Restableció las llaves de acceso de un usuario",
"audit.passwordChanged": "Cambió la contraseña",
"audit.passwordSet": "Estableció una contraseña",
- "audit.person": "Persona",
"audit.personPlaceholder": "Persona (correo o nombre)",
"audit.personalKeyDropped": "{named, select, yes {Clave personal “{name}” revocada al verificarse la dirección} other {Una clave personal revocada al verificarse la dirección}}",
"audit.providerClearKeys": "{known, select, yes {Quitó las claves de {provider}} other {Quitó las claves de un proveedor}}",
@@ -537,7 +534,6 @@
"bills.move.workspace": "Espacio de trabajo",
"bills.noOwner": "Sin propietario",
"bills.noWorkspaces": "No hay espacios de trabajo en esta factura",
- "bills.open": "Abrir",
"bills.owner.current": "Es el propietario actual",
"bills.owner.done": "La factura ahora pertenece a {owner}",
"bills.owner.label": "Nuevo propietario",
@@ -886,7 +882,6 @@
"callReviews.untitled": "Llamada",
"callReviews.what": "Las llamadas marcadas",
"callReviews.workspace": "Espacio de trabajo",
- "callReviews.workspaceOption": "{name} ({count})",
"clientPartner.action.add": "Agregar a un partner",
"clientPartner.action.move": "Mover espacio de trabajo",
"clientPartner.action.remove": "Quitar partner",
@@ -1053,7 +1048,6 @@
"onboarding.email.week": "Semana",
"onboarding.emailNotConnectedOff": "Conecta primero el correo en Proveedores: hasta entonces, ningún correo de configuración le llega a nadie.",
"onboarding.emailNotConnectedOn": "El correo no está conectado en Proveedores: no sale ninguno hasta que lo esté.",
- "onboarding.empty": "{count, plural, =0 {{days, plural, one {No hay espacios de trabajo en incorporación: todavía no se agregó ninguno hace más de # día.} many {No hay espacios de trabajo en incorporación: todavía no se agregó ninguno hace más de # días.} other {No hay espacios de trabajo en incorporación: todavía no se agregó ninguno hace más de # días.}}} one {{days, plural, one {No hay espacios de trabajo en incorporación. El que se agregó hace más de # día ya tuvo una llamada real.} many {No hay espacios de trabajo en incorporación. El que se agregó hace más de # días ya tuvo una llamada real.} other {No hay espacios de trabajo en incorporación. El que se agregó hace más de # días ya tuvo una llamada real.}}} many {{days, plural, one {No hay espacios de trabajo en incorporación. Los {count, number} que se agregaron hace más de # día ya tuvieron una llamada real.} many {No hay espacios de trabajo en incorporación. Los {count, number} que se agregaron hace más de # días ya tuvieron una llamada real.} other {No hay espacios de trabajo en incorporación. Los {count, number} que se agregaron hace más de # días ya tuvieron una llamada real.}}} other {{days, plural, one {No hay espacios de trabajo en incorporación. Los {count, number} que se agregaron hace más de # día ya tuvieron una llamada real.} many {No hay espacios de trabajo en incorporación. Los {count, number} que se agregaron hace más de # días ya tuvieron una llamada real.} other {No hay espacios de trabajo en incorporación. Los {count, number} que se agregaron hace más de # días ya tuvieron una llamada real.}}}}",
"onboarding.founderAddress": "Dirección del remitente",
"onboarding.founderAddressHelp": "Debe estar en un dominio desde el que envía tu proveedor de correo.",
"onboarding.founderEmail": "Correo personal de un fundador",
diff --git a/packages/i18n/locales/fr/admin.json b/packages/i18n/locales/fr/admin.json
index 6b3ad086..1701aef8 100644
--- a/packages/i18n/locales/fr/admin.json
+++ b/packages/i18n/locales/fr/admin.json
@@ -55,10 +55,8 @@
"actions.workspace.deleted.leftAtCarrier": "laissé chez l'opérateur",
"actions.workspace.deleted.number": "{number} : {note}",
"actions.workspace.deleted.planCanceled": "Son forfait a pris fin avec lui, et plus rien n'est facturé.",
- "actions.workspace.disable.action": "Désactiver l'espace de travail",
"actions.workspace.disable.done": "{name} est désactivé. Ses appels ne reçoivent plus de réponse.",
"actions.workspace.disable.label": "Désactiver…",
- "actions.workspace.disable.text": "Les appels vers {name} ne recevront plus de réponse et ses membres pourront seulement consulter.",
"actions.workspace.disable.tip": "Ses numéros ne reçoivent plus de réponse ; les membres peuvent toujours se connecter et consulter.",
"actions.workspace.enable.done": "{name} est activé. Ses appels reçoivent de nouveau une réponse.",
"actions.workspace.enable.label": "Activer",
@@ -302,7 +300,6 @@
"audit.passkeysReset": "Clés d'accès d'un utilisateur réinitialisées",
"audit.passwordChanged": "Mot de passe modifié",
"audit.passwordSet": "Mot de passe défini",
- "audit.person": "Personne",
"audit.personPlaceholder": "Personne (e-mail ou nom)",
"audit.personalKeyDropped": "{named, select, yes {Clé personnelle « {name} » révoquée lors de la vérification de l'adresse} other {Une clé personnelle révoquée lors de la vérification de l'adresse}}",
"audit.providerClearKeys": "{known, select, yes {Clés de {provider} supprimées} other {Clés d'un fournisseur supprimées}}",
@@ -537,7 +534,6 @@
"bills.move.workspace": "Espace de travail",
"bills.noOwner": "Aucun propriétaire",
"bills.noWorkspaces": "Aucun espace de travail sur cette facture",
- "bills.open": "Ouvrir",
"bills.owner.current": "Propriétaire actuel",
"bills.owner.done": "La facture appartient désormais à {owner}",
"bills.owner.label": "Nouveau propriétaire",
@@ -886,7 +882,6 @@
"callReviews.untitled": "Appel",
"callReviews.what": "Les appels signalés",
"callReviews.workspace": "Espace de travail",
- "callReviews.workspaceOption": "{name} ({count})",
"clientPartner.action.add": "Ajouter à un partenaire",
"clientPartner.action.move": "Déplacer l'espace de travail",
"clientPartner.action.remove": "Retirer le partenaire",
@@ -1053,7 +1048,6 @@
"onboarding.email.week": "Semaine",
"onboarding.emailNotConnectedOff": "Connectez d'abord l'e-mail dans Fournisseurs : d'ici là, aucun e-mail de configuration ne peut arriver.",
"onboarding.emailNotConnectedOn": "L'e-mail n'est pas connecté dans Fournisseurs : aucun ne part tant qu'il ne l'est pas.",
- "onboarding.empty": "{count, plural, =0 {{days, plural, one {Aucun espace de travail en prise en main : aucun n'a encore été ajouté il y a plus de # jour.} many {Aucun espace de travail en prise en main : aucun n'a encore été ajouté il y a plus de # jours.} other {Aucun espace de travail en prise en main : aucun n'a encore été ajouté il y a plus de # jours.}}} one {{days, plural, one {Aucun espace de travail en prise en main. Celui ajouté il y a plus de # jour a déjà eu un vrai appel.} many {Aucun espace de travail en prise en main. Celui ajouté il y a plus de # jours a déjà eu un vrai appel.} other {Aucun espace de travail en prise en main. Celui ajouté il y a plus de # jours a déjà eu un vrai appel.}}} many {{days, plural, one {Aucun espace de travail en prise en main. Les {count, number} ajoutés il y a plus de # jour ont tous eu un vrai appel.} many {Aucun espace de travail en prise en main. Les {count, number} ajoutés il y a plus de # jours ont tous eu un vrai appel.} other {Aucun espace de travail en prise en main. Les {count, number} ajoutés il y a plus de # jours ont tous eu un vrai appel.}}} other {{days, plural, one {Aucun espace de travail en prise en main. Les {count, number} ajoutés il y a plus de # jour ont tous eu un vrai appel.} many {Aucun espace de travail en prise en main. Les {count, number} ajoutés il y a plus de # jours ont tous eu un vrai appel.} other {Aucun espace de travail en prise en main. Les {count, number} ajoutés il y a plus de # jours ont tous eu un vrai appel.}}}}",
"onboarding.founderAddress": "Adresse d'expédition",
"onboarding.founderAddressHelp": "Elle doit être sur un domaine pour lequel votre fournisseur d'e-mail envoie.",
"onboarding.founderEmail": "E-mail personnel d'un fondateur",
diff --git a/packages/i18n/locales/ja/admin.json b/packages/i18n/locales/ja/admin.json
index f99dbc56..60905faf 100644
--- a/packages/i18n/locales/ja/admin.json
+++ b/packages/i18n/locales/ja/admin.json
@@ -55,10 +55,8 @@
"actions.workspace.deleted.leftAtCarrier": "通信事業者に残っています",
"actions.workspace.deleted.number": "{number}:{note}",
"actions.workspace.deleted.planCanceled": "プランも一緒に終了し、今後の請求はありません。",
- "actions.workspace.disable.action": "ワークスペースを無効化",
"actions.workspace.disable.done": "{name}を無効化しました。通話には応答しなくなります。",
"actions.workspace.disable.label": "無効化…",
- "actions.workspace.disable.text": "{name}への通話に応答しなくなり、メンバーは閲覧のみできます。",
"actions.workspace.disable.tip": "番号への通話に応答しなくなります。メンバーは引き続きサインインして閲覧できます。",
"actions.workspace.enable.done": "{name}を有効化しました。通話に再び応答します。",
"actions.workspace.enable.label": "有効化",
@@ -302,7 +300,6 @@
"audit.passkeysReset": "ユーザーのパスキーをリセットしました",
"audit.passwordChanged": "パスワードを変更しました",
"audit.passwordSet": "パスワードを設定しました",
- "audit.person": "ユーザー",
"audit.personPlaceholder": "ユーザー(メールまたは名前)",
"audit.personalKeyDropped": "{named, select, yes {アドレスの確認時に個人用キー「{name}」を無効化しました} other {アドレスの確認時に個人用キーを無効化しました}}",
"audit.providerClearKeys": "{known, select, yes {{provider}のキーを削除しました} other {プロバイダーのキーを削除しました}}",
@@ -537,7 +534,6 @@
"bills.move.workspace": "ワークスペース",
"bills.noOwner": "オーナーなし",
"bills.noWorkspaces": "この請求にはワークスペースがありません",
- "bills.open": "開く",
"bills.owner.current": "現在のオーナー",
"bills.owner.done": "この請求は{owner}のものになりました",
"bills.owner.label": "新しいオーナー",
@@ -886,7 +882,6 @@
"callReviews.untitled": "通話",
"callReviews.what": "フラグ付きの通話",
"callReviews.workspace": "ワークスペース",
- "callReviews.workspaceOption": "{name}({count})",
"clientPartner.action.add": "パートナーに追加",
"clientPartner.action.move": "ワークスペースを移動",
"clientPartner.action.remove": "パートナーを外す",
@@ -1053,7 +1048,6 @@
"onboarding.email.week": "1週間",
"onboarding.emailNotConnectedOff": "先に「プロバイダー」でメールを接続してください。それまでセットアップメールは誰にも届きません。",
"onboarding.emailNotConnectedOn": "「プロバイダー」でメールが接続されていません。接続されるまで送信されません。",
- "onboarding.empty": "{count, plural, =0 {{days, plural, other {オンボーディング中のワークスペースはありません。追加から#日以上経ったワークスペースはまだありません。}}} other {{days, plural, other {オンボーディング中のワークスペースはありません。追加から#日以上経った{count, number}件はすべて実際の通話がありました。}}}}",
"onboarding.founderAddress": "送信元アドレス",
"onboarding.founderAddressHelp": "メールプロバイダーが送信できるドメインのアドレスにしてください。",
"onboarding.founderEmail": "創業者からの個人メール",
diff --git a/packages/i18n/locales/pt-BR/admin.json b/packages/i18n/locales/pt-BR/admin.json
index 96a59019..2d898f93 100644
--- a/packages/i18n/locales/pt-BR/admin.json
+++ b/packages/i18n/locales/pt-BR/admin.json
@@ -55,10 +55,8 @@
"actions.workspace.deleted.leftAtCarrier": "ficou na operadora",
"actions.workspace.deleted.number": "{number}: {note}",
"actions.workspace.deleted.planCanceled": "O plano terminou junto, e nada mais é cobrado.",
- "actions.workspace.disable.action": "Desativar espaço de trabalho",
"actions.workspace.disable.done": "{name} foi desativado. As chamadas dele não são mais atendidas.",
"actions.workspace.disable.label": "Desativar…",
- "actions.workspace.disable.text": "As chamadas para {name} não serão mais atendidas e os membros só poderão ler.",
"actions.workspace.disable.tip": "Os números dele deixam de ser atendidos; os membros ainda podem entrar e ler.",
"actions.workspace.enable.done": "{name} foi ativado. As chamadas dele voltam a ser atendidas.",
"actions.workspace.enable.label": "Ativar",
@@ -302,7 +300,6 @@
"audit.passkeysReset": "Redefiniu as chaves de acesso de um usuário",
"audit.passwordChanged": "Alterou a senha",
"audit.passwordSet": "Definiu uma senha",
- "audit.person": "Pessoa",
"audit.personPlaceholder": "Pessoa (e-mail ou nome)",
"audit.personalKeyDropped": "{named, select, yes {Chave pessoal “{name}” revogada quando o endereço foi comprovado} other {Uma chave pessoal revogada quando o endereço foi comprovado}}",
"audit.providerClearKeys": "{known, select, yes {Removeu as chaves de {provider}} other {Removeu as chaves de um provedor}}",
@@ -537,7 +534,6 @@
"bills.move.workspace": "Espaço de trabalho",
"bills.noOwner": "Sem proprietário",
"bills.noWorkspaces": "Nenhum espaço de trabalho nesta fatura",
- "bills.open": "Abrir",
"bills.owner.current": "Proprietário atual",
"bills.owner.done": "A fatura agora pertence a {owner}",
"bills.owner.label": "Novo proprietário",
@@ -886,7 +882,6 @@
"callReviews.untitled": "Chamada",
"callReviews.what": "As chamadas sinalizadas",
"callReviews.workspace": "Espaço de trabalho",
- "callReviews.workspaceOption": "{name} ({count})",
"clientPartner.action.add": "Adicionar a um parceiro",
"clientPartner.action.move": "Mover espaço de trabalho",
"clientPartner.action.remove": "Remover parceiro",
@@ -1053,7 +1048,6 @@
"onboarding.email.week": "Semana",
"onboarding.emailNotConnectedOff": "Conecte o e-mail em Provedores primeiro: até lá, nenhum e-mail de configuração chega a ninguém.",
"onboarding.emailNotConnectedOn": "O e-mail não está conectado em Provedores: nenhum é enviado até que esteja.",
- "onboarding.empty": "{count, plural, =0 {{days, plural, one {Nenhum espaço de trabalho em onboarding: nenhum foi adicionado há mais de # dia ainda.} many {Nenhum espaço de trabalho em onboarding: nenhum foi adicionado há mais de # dias ainda.} other {Nenhum espaço de trabalho em onboarding: nenhum foi adicionado há mais de # dias ainda.}}} one {{days, plural, one {Nenhum espaço de trabalho em onboarding. O que foi adicionado há mais de # dia já teve uma chamada real.} many {Nenhum espaço de trabalho em onboarding. O que foi adicionado há mais de # dias já teve uma chamada real.} other {Nenhum espaço de trabalho em onboarding. O que foi adicionado há mais de # dias já teve uma chamada real.}}} many {{days, plural, one {Nenhum espaço de trabalho em onboarding. Todos os {count, number} adicionados há mais de # dia já tiveram uma chamada real.} many {Nenhum espaço de trabalho em onboarding. Todos os {count, number} adicionados há mais de # dias já tiveram uma chamada real.} other {Nenhum espaço de trabalho em onboarding. Todos os {count, number} adicionados há mais de # dias já tiveram uma chamada real.}}} other {{days, plural, one {Nenhum espaço de trabalho em onboarding. Todos os {count, number} adicionados há mais de # dia já tiveram uma chamada real.} many {Nenhum espaço de trabalho em onboarding. Todos os {count, number} adicionados há mais de # dias já tiveram uma chamada real.} other {Nenhum espaço de trabalho em onboarding. Todos os {count, number} adicionados há mais de # dias já tiveram uma chamada real.}}}}",
"onboarding.founderAddress": "Endereço do remetente",
"onboarding.founderAddressHelp": "Precisa estar em um domínio pelo qual o seu provedor de e-mail envia.",
"onboarding.founderEmail": "E-mail pessoal de um fundador",