Skip to Content
BBRICKSv0.7.4
PR PortalFraud review

FraudStatusPill

A case's status as a pill: New (sky), Held (amber), Cleared (green), Revoked (red).

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

Examples

Fraud review

A queue of cases (each with its signals as pills), the selected case's evidence and history, and the decision bar: clear, hold or revoke, each asking for a reason where needed. The signals and their wording are inferred: the PR mock has no fraud screen.

Code
import { useState } from 'react';
import { Card, FraudCaseDetail, FraudCaseRow, FraudDecisionBar, type FraudCase } from '@ergasti/bricks';
import { fraudCases } from './pr';

function Review() {
  const [open, setOpen] = useState<FraudCase>(fraudCases[0]);
  const [done, setDone] = useState(0);
  return (
    <div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))' }}>
      <Card>
        <ul className="kit-pr-queue" aria-label="Fraud review queue">{fraudCases.map((c) => <FraudCaseRow key={c.id} item={c} selected={c.id === open.id} onOpen={setOpen} />)}</ul>
      </Card>
      <Card>
        <FraudCaseDetail
          item={open}
          evidence={open.id === 1 ? {
            orders: [{ id: 1, ref: '#10482', buyer: 'O. K••• · +20 10•• ••• 471', commission: '620.00', placed: '12 Nov · 21:04', flag: 'Same phone as the creator' }],
            matches: [{ id: 'ip', what: 'ip', value: '41.33.•••.12', shared: ['Laila Mostafa', 'Ziad Hany'] }],
            timing: [{ id: 't', text: '3 orders within 12 minutes of the code going live' }],
          } : undefined}
          history={open.id === 1 ? [{ id: 2, tone: 'butter', title: 'Commission held automatically', at: '8 Nov · 10:02' }, { id: 1, tone: 'rasp', title: 'Case opened', at: '8 Nov · 10:01' }] : []}
          onOpenOrder={() => {}}
          actions={<FraudDecisionBar creatorName={open.creator.name} status={open.status} reasons={{ revoke: [{ value: 'confirmed', label: 'Confirmed self-purchase' }, { value: 'ring', label: 'Part of a shared-buyer ring' }] }} onDecide={() => setDone((n) => n + 1)} doneKey={done} />}
        />
      </Card>
    </div>
  );
}

Pills and the table preset

Signal and status pills, and fraudColumns for a DataTable of cases.

Code
import { DataTable, FraudSignalPill, FraudStatusPill, fraudColumns } from '@ergasti/bricks';
import { fraudCases } from './pr';

function Table() {
  return (
    <div style={{ display: 'grid', gap: 14 }}>
      <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', alignItems: 'center' }}>
        <FraudSignalPill kind="self_referral" severity="high" /><FraudSignalPill kind="fraud_ring" severity="medium" /><FraudSignalPill kind="order_burst" severity="low" />
        <FraudStatusPill status="open" /><FraudStatusPill status="held" /><FraudStatusPill status="cleared" /><FraudStatusPill status="revoked" />
      </div>
      <DataTable label="Fraud cases" columns={fraudColumns('en', { onOpen: () => {} })} rows={fraudCases} rowKey={(r) => r.id} />
    </div>
  );
}

Detail loading and failed

The case's row is known, so FraudCaseDetail draws its header at once; loading holds the evidence and history as skeletons, and error with onRetry replaces them with the reason and Try again. onOpenCreator makes the creator's name a button.

Code
import { useState } from 'react';
import { Card, FraudCaseDetail } from '@ergasti/bricks';
import { fraudCases } from './pr';

function DetailStates() {
  const [failed, setFailed] = useState(false);
  return (
    <div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))' }}>
      <Card><FraudCaseDetail item={fraudCases[1]} loading onOpenCreator={() => {}} /></Card>
      <Card>
        <FraudCaseDetail item={fraudCases[2]} error={failed ? 'Still failing: the evidence service is down.' : 'The evidence could not be loaded.'} onRetry={() => setFailed(true)} onOpenCreator={() => {}} />
      </Card>
    </div>
  );
}

Decision saving, then failing

Press Revoke and confirm: the app sets pending to the decision while it saves (its dialog stays open, every button locked), then passes the server's error, shown inside the open dialog. On success the app bumps doneKey to close it.

Code
import { useState, type ReactNode } from 'react';
import { Button, FraudDecisionBar } from '@ergasti/bricks';

function DecisionStates() {
  const [pending, setPending] = useState<'clear' | 'hold' | 'revoke' | null>(null);
  const [error, setError] = useState<ReactNode>(null);
  const [done, setDone] = useState(0);
  return (
    <div style={{ display: 'grid', gap: 12, justifyItems: 'start' }}>
      <FraudDecisionBar
        creatorName="Omar Khaled" status="held" pending={pending} error={error} doneKey={done}
        onDecide={({ decision }) => {
          setError(null);
          setPending(decision);
          window.setTimeout(() => { setPending(null); setError('The server refused: this case was changed by Ahmed a moment ago.'); }, 1200);
        }}
      />
      <Button size="sm" variant="ghost" onClick={() => { setError(null); setDone((n) => n + 1); }}>Pretend it saved (close)</Button>
    </div>
  );
}

More signals in the row

maxSignals sets how many signal pills show before "+N more" (default 2).

Code
import { Card, FraudCaseRow } from '@ergasti/bricks';
import { fraudCases } from './pr';

function AllSignals() {
  return <Card><ul className="kit-pr-queue" aria-label="Fraud review queue"><FraudCaseRow item={fraudCases[0]} maxSignals={3} onOpen={() => {}} /></ul></Card>;
}

Props

Prop

Type

Design guidance

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

A pill for a fraud case's status: New, Held, Cleared or Revoked; use it in the fraud queue, table and case header.

FraudStatusPill shows where a fraud case stands in its tone. A new case (open) is sky, a case whose commission is held while PR looks is amber, a cleared one green and a revoked one red. It is part of the inferred fraud review (the v3 mock draws no fraud screen); the words follow the PR admin's fraud pages.

Anatomy

  1. Pill: the kit Pill (kit-chip), 12px / 700, radius 99px.
  2. Word: New, Held, Cleared, Revoked.

Variants

statusToneEnglishArabicMeaning
openskyNewجديدFlagged, nobody has decided
heldwarnHeldمتوقفCommission held while PR looks
clearedokClearedاتقفل سليمFalse alarm, commission released
revokedbadRevokedاتلغىCommission cancelled, codes stopped

States

Static.

Types

Words: provider labels.prFraud (status).

FraudCaseStatus (status): 'open' | 'held' | 'cleared' | 'revoked'.

Usage

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

<FraudStatusPill status="held" />
// The queue table's Status column (fraudColumns draws this for you)
<DataTable label="Fraud review" rows={cases} rowKey={(c) => c.id} columns={fraudColumns('en', { onOpen: setOpen })} onRowClick={setOpen} />
// The case header: status, orders, age
<span style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
  <FraudStatusPill status={item.status} />
  <span className="kit-pr-muted">3 orders</span>
  <span className="kit-pr-muted">Opened 9 days ago</span>
</span>

Pills and the table preset. Signal and status pills, and fraudColumns for a DataTable of cases. (docs example Table)

import { Button, Card, DataTable, FraudCaseDetail, FraudCaseRow, FraudDecisionBar, FraudSignalPill, FraudStatusPill, fraudColumns, type FraudCase } from '@ergasti/bricks';
// fraudCases: the docs' sample rows (docs/examples/_pr.ts)

export function Table() {
  return (
    <div style={{ display: 'grid', gap: 14 }}>
      <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', alignItems: 'center' }}>
        <FraudSignalPill kind="self_referral" severity="high" /><FraudSignalPill kind="fraud_ring" severity="medium" /><FraudSignalPill kind="order_burst" severity="low" />
        <FraudStatusPill status="open" /><FraudStatusPill status="held" /><FraudStatusPill status="cleared" /><FraudStatusPill status="revoked" />
      </div>
      <DataTable label="Fraud cases" columns={fraudColumns('en', { onOpen: () => {} })} rows={fraudCases} rowKey={(r) => r.id} />
    </div>
  );
}

Where it appears

Guidelines

Do

  • Change the status only after the decision is saved (the decision bar's onDecide).
  • Show the age beside a held case so PR sees how long it has waited.

Don't

RTL and Arabic

Mirrors with the text. Arabic words above; Cairo's line height applies through --lh-ar.

Tokens

--sky, --sky-ink, --butter, --butter-ink, --ok-bg, --ok, --rasp-50, --bad.

Accessibility

  • Role: none; a <span> (kit-chip) with plain text, never focusable and outside the tab order.
  • Text alternative: the word itself ("New", "Held", "Cleared", "Revoked"); the tone only repeats it, so colour is never the only cue.
  • Changes: the pill does not announce updates. If a decision changes a status on screen, announce it where the decision is made (the decision bar's dialog closes and the app can show a toast).
  • Contrast (text on fill, 12px / 700): New --sky-ink on --sky 7.0:1; Held --butter-ink on --butter 6.0:1; Cleared --ok on --ok-bg 4.6:1; Revoked --bad on --rasp-50 5.5:1. All pass AA for small text.

Found in the source

  • ARIA attributes set: aria-hidden.

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

See also: Pill · useBricks · useLanguage · Card · FraudCaseRow · FraudCaseDetail · DataTable · Button

Source

src/pr/fraud/FraudSignalPill.tsx (line 114) on GitHub.

On this page