Skip to Content
BBRICKSv0.7.4
PR PortalAudit log

AuditAreaPill

An audit area in its tone, from the provider's statusTables.prAudit; an unknown area shows as itself, muted.

import { AuditAreaPill } from '@ergasti/bricks';

Examples

Audit log

Who did what and when, with a tone dot and the area it touched; compact is the short form for a side card.

Code
import { AuditLogList, Card } from '@ergasti/bricks';
import { auditEntries } from './pr';

function Log() {
  return (
    <div style={{ display: 'grid', gap: 16 }}>
      <Card><AuditLogList label="Recent activity" entries={auditEntries} /></Card>
      <Card><AuditLogList label="Recent activity" entries={auditEntries.slice(0, 2)} compact /></Card>
    </div>
  );
}

One entry and the area pill

Code
import { AuditAreaPill, AuditLogEntry } from '@ergasti/bricks';
import { auditEntries } from './pr';

function Single() {
  return (
    <div style={{ display: 'grid', gap: 12 }}>
      <AuditLogEntry entry={auditEntries[0]} />
      <div style={{ display: 'flex', gap: 8 }}>{(['approvals', 'programs', 'owners'] as const).map((area) => <AuditAreaPill key={area} area={area} />)}</div>
    </div>
  );
}

No activity yet

The list draws only its entries; with none, show PrEmpty in its place. compact on a single AuditLogEntry is the short side-card form.

Code
import { AuditLogEntry, AuditLogList, Card, PrEmpty } from '@ergasti/bricks';
import { auditEntries } from './pr';

function Empty() {
  const entries: typeof auditEntries = [];
  return (
    <div style={{ display: 'grid', gap: 16 }}>
      <Card>{entries.length ? <AuditLogList label="Recent activity" entries={entries} /> : <PrEmpty title="No activity yet" text="Approvals, edits and payouts show up here as they happen." icon="log" tone="sky" />}</Card>
      <Card><AuditLogEntry entry={auditEntries[1]} compact /></Card>
    </div>
  );
}

Without the dot

dot={false} drops the coloured dot so the text starts at the card's edge; with compact the rows take plain 6px padding and the time sits right under the text (the PR brand page's "Recent activity" side card). Keep the dot (default true) on the full Activity log, where the colour helps scan outcomes. Default on the left, no dot on the right.

Code
import { AuditLogList, Card } from '@ergasti/bricks';
import { auditEntries } from './pr';

function NoDot() {
  return (
    <div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))' }}>
      <Card><AuditLogList label="Recent activity, with dots" entries={auditEntries.slice(0, 3)} compact /></Card>
      <Card><AuditLogList label="Recent activity" entries={auditEntries.slice(0, 3)} compact dot={false} /></Card>
    </div>
  );
}

One entry without the dot

AuditLogEntry takes dot too, for a single line in a card of its own.

Code
import { AuditLogEntry, Card } from '@ergasti/bricks';
import { auditEntries } from './pr';

function SingleNoDot() {
  return (
    <Card>
      <ul className="kit-pr-log" aria-label="Last change">
        <AuditLogEntry entry={auditEntries[1]} compact dot={false} />
      </ul>
    </Card>
  );
}

Props

Prop

Type

Design guidance

How the BRICKS design system uses AuditAreaPill. Written in docs/content/components/AuditAreaPill.md; the props above are read from the code, which wins where the two disagree.

A pill naming the area an audit log entry belongs to ("Approvals", "Programs", "Owners"), in that area's tone; use it in the Activity log's Area column and inside AuditLogEntry.

It reads the provider's statusTables.prAudit (the TRNDR preset's TRNDR_AUDIT_AREAS); an app can add areas there. An area the table does not know is shown as itself in a muted pill, so a newer server never breaks the log.

Anatomy

  1. Pill (kit Pill) in the area's tone with the area's words in the current language.

Variants

areaToneEnglish / Arabic
approvalsokApprovals / الموافقات
programsbadPrograms / البرامج
challengeswarnChallenges / التحديات
tierslilacTiers / المستويات
messageslilacMessages / الرسايل
ownersskyOwners / المسؤولين
payoutsokPayouts / المدفوعات
walletsskyWallets
settingsmuteSettings
rolesmuteRoles
unknown keymuteThe key itself (story Unknown)

States

Static.

Usage

<AuditAreaPill area="approvals" />
import { AuditAreaPill, type AuditEntry, type DataColumn } from '@ergasti/bricks';

// The Activity log table's Area column (auditColumns builds it for you)
const areaColumn: DataColumn<AuditEntry> = {
  key: 'area', label: 'Area', render: (e) => e.area ? <AuditAreaPill area={e.area} /> : null,
};
// Add an app area through the provider
<BricksProvider preset={trndrPreset} statusTables={{ prAudit: { ...TRNDR_AUDIT_AREAS, imports: { tone: 'mute', en: 'Imports', ar: 'الاستيراد' } } }}>…</BricksProvider>

Where it appears

Guidelines

Do

  • Use the preset's keys; add new areas through statusTables.prAudit.

Don't

  • Don't pass translated words as area; pass the key.

RTL and Arabic

  • Arabic words from the table; the pill mirrors with its row.

Tokens

Pill tone tokens (ok, bad, warn, lilac, sky, mute).

Accessibility

  • A Pill: a plain <span> with the area's word, no role and not focusable. It reads as its word ("Approvals"), so the tone colour is never the only signal.
  • In the Activity log table the column header "Area" gives it context; inside AuditLogEntry it is read in the meta line after the sentence and before the actor.
  • An unknown key is shown, and read, as the raw key ("imports"). Add the area with en / ar words to statusTables.prAudit so screen readers get real words in both languages.
  • Tone pairs are the kit's tint + ink pairs (for example ok text on its tint); keep app-added areas on those tones rather than custom colours.

Found in the source

  • ARIA attributes set: aria-hidden, aria-label.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Avatar · Pill · useBricks · useLanguage · Card · PrEmpty

Source

src/pr/AuditLog.tsx (line 30) on GitHub.

On this page