Skip to Content
BBRICKSv0.7.4
PR PortalFraud review

FraudCaseDetail

One fraud case, for a drawer or a page (inferred from the PR admin's fraud screens: no mock): the creator and the brand, the commission it holds with its "?", the status and age; the signals with their severity in words; the evidence (orders with buyer and commission, IP / device / phone / email / address matches with the other creators they were seen on, timing); the history timeline; then the decision bar passed in actions.

import { FraudCaseDetail } 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

Labels

Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prFraudCaseDetail, or with the component's own prop where it has one. A {name} is a value the component fills in.

prFraudCaseDetail
KeyEnglishArabic
regionFraud case: {n}حالة احتيال: {n}
creatorCreatorصانع المحتوى
brandBrandالبراند
amountCommission heldالعمولة المتوقفة
orders{n} orders{n} طلب
openedOpened {d}اتفتحت {d}
signalsWarning signsعلامات التحذير
severitySeverityالخطورة
evidenceEvidenceالأدلة
ordersTOrdersالطلبات
matchesTMatchesالتطابقات
timingTTimingالتوقيت
historyHistoryاللي حصل
orderOrderالطلب
buyerBuyerالمشتري
placedPlacedاتعمل
flaggedFlaggedمتعلّم عليه
what.ipSame IP addressنفس عنوان الـ IP
what.deviceSame deviceنفس الجهاز
what.phoneSame phoneنفس الموبايل
what.emailSame emailنفس الإيميل
what.addressSame addressنفس العنوان
sharedAlso on: {names}موجود كمان عند: {names}
onlyCreatorMatches the creatorمطابق لصانع المحتوى
noEvidenceNo evidence attached yet.لسه مفيش أدلة.
noHistoryNothing has happened on this case yet.لسه محصلش حاجة في الحالة دي.
errorCouldn’t load this case.مقدرناش نحمّل الحالة دي.
retryTry againجرّب تاني
loadingLoading the caseبنحمّل الحالة
sep, ،

Design guidance

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

One fraud case in full: creator and brand, commission held, status and age, warning signs by severity, evidence (orders, identity matches, timing), history and the decision bar; use it in the drawer or side panel the fraud queue opens.

FraudCaseDetail lays out everything PR needs to decide a case. It is inferred from the PR admin's fraud screens (the v3 mock draws none). Evidence and history load separately from the case's own row, so the block has its own loading and error states for them while the header stays readable. Buyer data arrives masked by the app, and order references never include coupon or gift codes (bearer money).

Anatomy

  1. Article: <article aria-label="Fraud case: {name}">, sections 18px apart, each with a top rule.
  2. Header: a description list with "Creator" (CreatorCell, a button with onOpenCreator) and "Brand" (BrandCell); at the end "Commission held" (money note) and the amount (26px / 800 display), then FraudStatusPill, "3 orders", "Opened 9 days ago" (red when aging).
  3. Warning signs: one row per signal: a 72px severity word (HIGH red, MEDIUM butter, LOW grey) and the FraudSignalPill with its detail line.
  4. Evidence (aria-busy while loading):
    • Orders: receipt icon, the order ref (a button with onOpenOrder), placed time, masked buyer, the flag in red, and the order's commission.
    • Matches: icon per kind (IP globe, device/phone, email, address), "Same IP address 41.33.•••.12", "Also on: Laila Mostafa, Ziad Hany" or "Matches the creator".
    • Timing: clock icon and the note.
  5. History: a kit Timeline (newest first) or "Nothing has happened on this case yet."
  6. Actions (optional): the FraudDecisionBar, in a footer.

Variants

No visual variant props; the content follows the data.

States

StateTriggerShows
Full caseevidence, historyAll sections
LoadingloadingEvidence: 3 skeleton rows (role="status", "Loading the case"); History hidden
Errorerror (node, or true for "Couldn't load this case.")Raspberry alert in Evidence with "Try again" (with onRetry)
No evidenceno orders, matches or timing"No evidence attached yet."
No historyhistory empty"Nothing has happened on this case yet."
Agingitem.aging"Opened …" in red
Decidedstatus cleared / revokedThe decision bar renders nothing

Types

FraudOrderEvidence: id, ref ("#10482"), buyer? (masked), commission? (2-dp), placed?, flag?. FraudMatchEvidence: id, what ('ip' | 'device' | 'phone' | 'email' | 'address'), value (masked), shared? (other creators). Timing: { id, text }[].

FraudEvidence (evidence): { orders?, matches?, timing? }.

Usage

import { FraudCaseDetail, FraudDecisionBar } from '@ergasti/bricks';

<FraudCaseDetail
  item={{
    id: 1, creator: { id: 7, name: 'Omar Khaled', tier: 'established' }, brand: { id: 'glow', name: 'Glow Lab', color: '#C7325C' },
    signals: [
      { kind: 'identity_match', severity: 'high', detail: '3 orders, same phone as the creator' },
      { kind: 'self_referral', severity: 'high' },
      { kind: 'order_burst', severity: 'low' },
    ],
    amount: '1840.50', orders: 3, status: 'held', opened: '9 days ago', aging: true,
  }}
  evidence={{
    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'] }],
  }}
  history={[{ id: 2, tone: 'butter', title: 'Commission held', at: '8 Nov · 10:02' }, { id: 1, tone: 'rasp', title: 'Case opened', at: '8 Nov · 10:01' }]}
  onOpenOrder={(o) => openOrder(o.ref)}
  actions={<FraudDecisionBar creatorName="Omar Khaled" status="held" onDecide={decide} doneKey={done} />}
/>
// In a drawer from the queue, with loading and retry for the evidence
<Drawer open={open != null} onClose={() => setOpen(null)} title="Fraud case">
  <FraudCaseDetail item={open} evidence={ev.data} history={ev.history} loading={ev.loading} error={ev.error} onRetry={ev.reload}
    actions={<FraudDecisionBar creatorName={open.creator.name} status={open.status} onDecide={decide} pending={pending} error={saveError} doneKey={done} />} />
</Drawer>

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. (docs example DetailStates)

import { useState, type ReactNode } from 'react';
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 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>
  );
}

Where it appears

  • Library-only (no v3 mock screen): Fraud review › the open case, beside the queue or in a drawer.

Guidelines

Do

  • Mask buyer phone, email and IP in the app before passing them.
  • Load the case row first and show it while evidence loads (loading).
  • Order signals strongest first; write the detail as what matched ("3 orders, same phone").

Don't

  • Don't pass coupon or gift codes as evidence: they are bearer money.
  • Don't hide the history: decisions must be auditable.
  • Don't put the decision buttons anywhere but actions.

RTL and Arabic

The header and rows mirror; severity words are not upper-cased in Arabic. Arabic words: "علامات التحذير", "الأدلة", "اللي حصل", "نفس عنوان الـ IP", "موجود كمان عند: …".

Tokens

--line, --ink-3, --font-family-display, --radius-md, --radius-sm, --rasp-50, --rasp-ink, --bad, --butter-ink, --soft, --ink-2.

Accessibility

  • An <article> named "Fraud case: {name}"; each section has an h3 (aria-labelledby), evidence groups h4.
  • Severity is spoken ("Severity: High"), flags are prefixed "Flagged:", orders "Order".
  • Loading is role="status" and aria-busy; errors role="alert".
  • Order refs, IPs and buyer strings are dir="ltr" so they read correctly in Arabic.

Found in the source

  • Roles in the markup: status, alert.
  • ARIA attributes set: aria-label, aria-labelledby, aria-busy, aria-hidden.

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

See also: Button · CreatorCell · Money · MoneyNote · Skeleton · useLanguage · BrandCell · PrIcon · FraudSignalPill · FraudStatusPill · Card

Source

src/pr/fraud/FraudCaseDetail.tsx (line 103) on GitHub.

On this page