Tables and lists
Every list in the two v3 mocks, the component that draws it, and the rules for building a new one.
Every list in the two v3 mocks, the component that draws it, and the rules for building a new one. Both mocks use one list engine (tbl()): a toolbar (search, status chips, filter selects, "Sort by" + ⇅, Export CSV), a bordered table with sortable headers and rows that open on click, then a pager ("Showing 11–20 of 304" and ‹ 1 … 4 5 6 … 31 ›) or a count ("7 items"). BRICKS draws the same engine with ListToolbar + DataTable + Pager, and keeps the list's state with useListState.
Sources: reference/trndr-brand-dashboard-gui-v3.html (P.* screens, tbl()), reference/trndr-pr-portal-gui-v3.html, the column presets in src/pr/presets.tsx, src/pr/creatorColumns.tsx and src/pr/*/…Columns.tsx, and the screen compositions in src/gallery/screens. Live examples: the Loading, error and empty states cards, and each dashboard screen (Creators, Coupons, PR · Approvals, PR · Brands, PR · Creators, …).
What every list shares
| Part | Mock | BRICKS |
|---|---|---|
| Toolbar | .toolbar: search pill (260px), dashed .chipf chips, selects (min 140–150px), Sort by select + ⇅ flip, Export CSV pushed to the end, an optional extra (the PR scope switch or bulk bar) | ListToolbar (search, chips, selects, date, filters, sort, reset, actions, extra, extraPlacement, collapseFiltersBelow) |
| Table | .tblw (1px line, radius 18, white) › table.tbl (13.5px): #FAFAFC uppercase 11px head, 12px 14px cells, th.s sortable with ↕ / ↑ / ↓, .num end-aligned tabular, .mid centred, tr.click with a #FBF6F8 hover and a trailing › | DataTable (columns, sort/onSort, onRowClick, chevron, density, headDensity) |
| Sort | header click: same column flips, another column starts at its own order (asc columns start A–Z, the rest high → low); the Sort by select and the header stay in sync; page back to 1 | DataColumn.sortKey + sortFirst; ListToolbar.sort options [key, label, dir]; one { key, dir } in useListState |
| Empty | "Nothing matches these filters. Clear filters" | DataTable's default empty, onClearFilters adds the link; empty replaces it |
| Pager | more than one page: "Showing a–b of n" + 7-item window; one page: "n items" | Pager in DataTable.footer (perPage for the a–b range) |
| Row open | onclick on the row (drawer or page) | onRowClick (+ isRowClickable), Enter and Space too |
| Phone | (the mocks have no phone layout) | under 860px each row is a stacked card; cells carry their column label (data-label); primary spans the card |
Brand dashboard lists
Per page, default sort and toolbar come from each tbl() call. "Sortable" lists the Sort by options (sl), in order; ✓ in a column table means the header sorts. Every default sort is high → low unless marked A–Z.
Creators › My creators (tbl('mine'), Creators)
KPI strip above the card: Active (filter), Paused (filter), Groups (→ Groups tab), Seats left (→ Raise limit modal). Toolbar: search "Search name, @handle or coupon"; chips All · Active · Paused · Removed; selects All tiers · Any followers (10K+ / 50K+ / 100K+) · All platforms · All groups; Sort by (default Sales); Export CSV. 10 per page. Row → creator drawer (MyCreatorPanel). Removed rows dimmed (isDim).
| Column | Content | Align | Sort |
|---|---|---|---|
| Creator | CreatorCell (avatar, name, @handle) | start | ✓ Name (A–Z) |
| Tier | TierChip | start | ✓ Tier |
| Score | ScoreRing; header is a term: "TRNDR score from 0 to 100, based on sales, content and reliability" (tip) | start | ✓ |
| Followers | FollowersCell (total + platform glyphs) | center | ✓ |
| Orders | count | end | ✓ |
| Sales | <b><Money compact /></b>, figure: 'creator_sales' | end | ✓ (default) |
| Joined | date, tone: 'muted' | start | ✓ Newest |
| Status | StatusPill (active / paused / removed) | start | — |
Creators › Groups
Not a table: a card grid (.cards, auto-fill min 300px) of GroupCard (tone band, name, "n creators", AvatarStack up to 5 + "+n", commission pill: approved %, "Asked: …" or "Standard 15%", group sales) and a NewCard "+ New group / Pick the creators by hand". Info Banner above. Click → GroupPanel drawer.
Creators › Join requests (tbl('req'))
Info Banner ("The TRNDR team reviews every join request…"), then a card. Search "Search name"; selects All tiers · Any followers; sort Newest; Export CSV. 10 per page. Row → creator drawer. No bulk actions: the brand does not decide.
| Column | Content | Align | Sort |
|---|---|---|---|
| Creator | person | start | ✓ Name (A–Z) |
| Followers | FollowersCell | center | ✓ |
| Tier | TierChip | start | ✓ |
| Score | ScoreRing, term header | start | ✓ |
| Requested | date, muted | start | ✓ Newest (default) |
| Status | StatusPill status="with_trndr" ("With TRNDR") | start | — |
Creators › Invitations (tbl('inv'))
Two cards above (lime "Invite link" with CopyLinkField; raspberry "Invite TRNDR creators" → Find creators). Search "Search name"; chips All · Waiting for reply · Accepted · Declined; sort Newest; Export CSV. Row → creator drawer.
| Column | Content | Align | Sort |
|---|---|---|---|
| Creator | person | start | ✓ Name (A–Z) |
| Followers | FollowersCell | center | ✓ |
| How | muted text (link / invite) | start | — |
| Sent | date, muted | start | ✓ Newest (default) |
| Status | StatusPill (waiting_reply, accepted, declined) | start | — |
Find creators (tbl('find'), Find creators)
Cards, not rows: DataTable mode="cards" with renderCard → FindCreatorCard (photo, name, tier + niche, score ring, highlight line, Sold · 90 days / Orders / Engagement, followers, Invite). Seats Banner above ("79 seats left. Each invite holds a seat until the creator replies."). Search "Search by name or niche"; selects All platforms · Any followers · All niches · All tiers; Sort by Followers (default) · Sales · 90 days · Engagement · Score · Name (A–Z); no Export. 8 per page. Card → creator profile drawer (CreatorProfilePanel).
Coupons (tbl('coupons'), Coupons)
KPI strip: Active coupons (filter), Coupon uses (→ Analytics), Sales via coupons (→ Analytics), Stopped (filter). Lime Banner ("Every approved creator gets a coupon automatically…"). Search "Search coupon or creator"; chips All · Active · Paused · Stopped; sort Uses; Export CSV. Row → creator drawer.
| Column | Content | Align | Sort |
|---|---|---|---|
| Coupon | CouponChip | start | ✓ Coupon (A–Z) |
| Creator | person | start | ✓ Name (A–Z) |
| Discount | "10% off"; header is a term: "What the shopper saves with this coupon" | start | — |
| Uses | count | end | ✓ (default) |
| Sales | Money bold | end | ✓ |
| Status | StatusPill (a removed creator's coupon reads Stopped) | start | — |
| (no header) | Copy button; its click must not open the row | end | — |
Motivation › Gifts › gift orders (tbl('gord'), Motivation)
Above: a five-card KPI strip (In stock, Picked, Shipped → filter, Not delivered yet → filter, Delivered → filter), Gift rules (read-only switches, s5) and Gift stock (GiftStockList, s7). The table card spans 12. Search "Search creator or gift"; chips All · Pending · Shipped · Delivered; sort Picked on. 6 per page. Row → gift order drawer (StepTimeline).
| Column | Content | Align | Sort |
|---|---|---|---|
| Creator | person | start | ✓ Name (A–Z) |
| Gift | product name | start | ✓ Gift (A–Z) |
| Picked on | date, muted | start | ✓ Newest (default) |
| Status | StatusPill (pending / shipped / delivered) | start | — |
Payments › Commissions › orders (tbl('orders'))
A "Commission · EGP …" card with the stacked bar above. Search "Search order, creator or coupon"; chips All · Pending · Approved · Paid; sort Date. Row → order drawer.
| Column | Content | Align | Sort |
|---|---|---|---|
| Order | #1042 bold | start | ✓ Order no. |
| Date | muted | start | ✓ Newest (default) |
| Creator | person with the coupon code as its sub line | start | ✓ Creator (A–Z) |
| Order value | Money | end | ✓ |
| Commission | Money bold; header term "15% of the order value after discount, shipping excluded" | end | ✓ |
| Status | StatusPill | start | — |
Payments › Payouts › Past payouts (tbl('payouts'))
Above: November payout card (s7, Pips for the window and creators paid) and two short tiles (s5). No search or chips: Sort by + Export only. 5 per page. Row → payout batch drawer (PayoutBatchDetail).
| Column | Content | Align | Sort |
|---|---|---|---|
| Paid on | date, bold | start | ✓ Newest (default) |
| Creators | count | end | ✓ |
| Amount | Money bold | end | ✓ |
| Method | muted "Bank transfer · ref TRF-88412" | start | — |
| Proof | ProofButton "View proof" (stops the row click) | start | — |
| Status | StatusPill status="paid" | start | — |
Payments › Wallet › Where your money went
Not a table: WalletLedger, an accordion grouped by challenge (Accordion, first group open, signed totals green/red), a Segmented By challenge / All entries and Export CSV in the card head, "Balance now" last. Entries can carry a proof (ProofLink).
Analytics (tbl('best'), tbl('prod'), Analytics)
Two tables without a toolbar (noTools), 5 per page each, both with a pager. Best creators (s7, "Ranked by sales · click a column to re-sort"):
| Column | Content | Align | Sort |
|---|---|---|---|
| # | RankMedal (1–3 gold, silver, bronze); inline beside the creator on phones | start | — |
| Creator | person + tier | start | ✓ Name |
| Orders | count | end | ✓ |
| Sales | Money bold | end | ✓ (default) |
| vs #1 | ShareBar | start | — |
Best-selling products (s5): Product (ProductCell: thumb, name, "n sold · SKU"; sorts A–Z) and Sales (Money + a Delta ▲/▼ %, default sort). Sales by challenge is HBars (rows that open the challenge; Always-on is selectable: false).
Activity log (P.log)
Not a table: ActivityLog, a timeline (dot tone, sentence, when, an optional grey detail box, the whole event opens its target). Toolbar: chips All · Creators · Coupons · Challenges · Payments · Wallet, a date input, Export CSV. The screen composition draws it with the slot Toolbar (FilterChips in filters, Export in actions) because the timeline is not a paged DataTable; when the log is server-paged with useListState, use ListToolbar, whose date field is the mock's date input. Empty: "Nothing here yet.".
Home and drawers
- Home › Top creators this month:
RankList(4 rows: medal,CreatorCellwith tier · orders, compact sales); row → creator drawer. - Home › To-do list:
TodoItembuttons, not a list of records. - Drawer lists (
.rows .rowi):RowItems— Top creators in this challenge, Picked by, Paid to ("and n more · Export CSV for the full list"), Top creators for this product, a group's Creators, Followers by platform (FollowerBars).
PR Portal lists
Set the PR look with data-bricks-theme="pr" on a wrapper (the PR presets read statusTables.pr for their pills).
Approvals › Join requests (tbl('join'), PR · Approvals)
PillTabs Join requests · New creators (counts). Search "Search creator or brand"; chips All sources · Creator request · Brand invite · Public challenge; sort Waiting longest; no Export; extra: the My brands / All brands switch, replaced by the bulk bar while rows are selected. 5 per page. Bulk: PrBulkBar "n selected" + Reject (BulkAction kind="danger") + Approve n (kind="approve"). Each row has Reject / Approve; a reject opens ReasonDialog (reasons: Not a fit for this brand · Audience doesn't match · Already promoting a competitor · Other); a bulk reject asks once ("Same reason for all"). Every outcome toasts with Undo. Empty: PrEmpty party icon "No join requests". Footnote: "Requests never expire…". Preset: joinRequestColumns(language, { onApprove, onReject, onOpen, busy }).
| Column | Content | Align | Sort |
|---|---|---|---|
| (checkbox) | DataTable.selection | — | — |
| Creator | avatar + name (a link button that opens PrCreatorDrawer) + TierChip | start | ✓ Creator (A–Z) |
| Followers | FollowersCell | center | ✓ |
| Wants to join | BrandCell | start | ✓ Brand (A–Z) |
| Source | PrStatusPill (creator_request, brand_invite, public_challenge) | start | — |
| Waiting | WaitingCell variant="cell" (red once the second reminder is due, after 1 week; the reminder line under it) | start | ✓ Waiting longest (default) |
| Actions (visually hidden header) | ApprovalActions Reject / Approve, named "Reject Sara Ali" / "Approve Sara Ali" | end | — |
Approvals › New creators (tbl('newc'))
Info Banner ("New creators stay Pending…"). Search "Search by name"; sort Followers; no Export. No row click. Empty: "Everyone is vetted". Columns: Creator (Name A–Z; "Customer asking to become a creator" sub line), Followers (✓, center), Signed up (✓ Newest), Reject / Approve.
Brands (tbl('brands'), PR · Brands)
Subtitle follows the scope ("The 3 brands you own…"). Search "Search brands or PR owner"; chips All · Wallet alerts · Has join requests; extra scope switch; sort Sales · 30 days; Export CSV. 5 per page. Row → brand page. Preset: brandColumns(language, copy, money).
| Column | Content | Align | Sort |
|---|---|---|---|
| Brand | BrandCell + commission sub line ("10% of sale") | start | ✓ Name (A–Z) |
| PR owner | avatar + name, "(you)" | start | ✓ PR owner (A–Z) |
| Program | PrStatusPill active / paused | start | — |
| Wallet | WalletHealthPill + "EGP … available"; figure: 'wallet_available' | start | ✓ Wallet available |
| Sales · 30 days | Money bold, figure: 'sales' | end | ✓ (default) |
| Creators | count | end | ✓ |
| Waiting | join requests count or "—" | end | ✓ Join requests |
Brand page
No full table: stat tiles (Tile size="stat"), MiniList for Challenges (requests first, "Needs review"), Top creators (MiniList variant="soft" with cells: tier, sales, orders), PR owner, Wallet (BrandWalletCard), Recent activity (AuditLogList compact).
Affiliate programs › Campaigns (tbl('programs'), PR · Affiliate programs)
PillTabs (Campaigns / Challenges), the customer affiliates switch. Search "Search brands"; selects All statuses · Active · Paused, Any commission · % of sale · EGP per item; extra scope switch; sort Sales · 30 days. Row → program editor. Preset: campaignColumns(language, copy, money, { wrap }).
| Column | Content | Align | Sort |
|---|---|---|---|
| Brand | BrandCell (primary) | start | ✓ Name (A–Z) |
| Active campaign | name + "from → to" | start | ✓ Campaign (A–Z) |
| Status | PrStatusPill | start | — |
| Requests | "n waiting" pill or "—" | start | ✓ Waiting requests |
| Commission | "10% of sale" bold | start | — |
| Creators | count | end | ✓ |
| Sales · 30 days | Money, figure: 'sales' | end | ✓ (default) |
| Orders | count | end | ✓ |
| Last change | muted | start | — |
Affiliate programs › Challenges (tbl('chall'))
KPI strip: Live now (filter), Creators joined (→ sort), Budget held (→ sort), Ending this week (toggle + Banner "Showing live challenges that end in the next 7 days. Show all live"). PillTabs Live · Upcoming · Settling · Ended · Brand requests (counts) + scope switch. Default view is cards with a Cards / Table Segmented (ListToolbar.filters): PrChallengeCard in a 3-up grid (2-up under 1240px). Search "Search challenges"; selects All types · Leaderboard · Target, Anyone can join · Public · Brand affiliates; sort Budget held. 6 per page. Click → challenge page. Empty: "Nothing ends this week" / "Nothing here". Table view columns: Challenge (icon + name, type · audience; ✓ A–Z), Brand (+ dates; ✓ A–Z), Goal (chip), Reward (chip), Time left (days, raspberry at ≤ 3, or the status pill; ✓ Ending soonest A–Z, center), Joined (✓ center), Budget held (Money, ✓ end, default). The library's challengeColumns preset has its own set (Challenge, Brand, Status, Dates, Creators, Sales, Commission, Waiting); drop or add columns to match the screen.
Challenges › Brand requests (tbl('reqs'))
Search "Search requests"; sort Budget; no Export. 6 per page. Row → request page. Empty: "No requests waiting". Preset: challengeRequestColumns.
| Column | Content | Align | Sort |
|---|---|---|---|
| Request | BrandCell + idea, "brand · reward" | start | ✓ Idea (A–Z) |
| What the brand wrote | muted, wraps (max 320px) | start | — |
| Dates | clock chip | center | — |
| Budget | Money, figure: 'wallet_held' | end | ✓ (default) |
| Sent | muted | center | — |
| Status | PrStatusPill status="needs_review" | center | — |
Challenge page › Leaderboard
Not a table: Leaderboard (rows of #, creator, delivered sales with a bar against #1, orders, reached at, a remove ✕; a "Winners above this line" cut after the winners; ties ranked by who reached it first). Target challenges show a PrEmpty-style progress note instead.
Gift stock (tbl('gsr'), PR · Gift stock)
Stat tiles: Expected, To count, Problems reported, Confirmed. Search "Search reference, brand or challenge"; chips All · Expected · Arrived · Problem reported · Confirmed with difference · Confirmed; extra scope switch; no Export; no default sort. 8 per page. Row → shipment page. Below: Warehouse details form. Preset: giftShipmentColumns (or giftClaimColumns).
| Column | Content | Align | Sort |
|---|---|---|---|
| Reference | bold id + "Sent 12 Nov" | start | — |
| Brand | BrandCell | start | ✓ Brand (A–Z) |
| For | challenge name | start | — |
| Units claimed | count | end | ✓ Most units |
| Units confirmed | count or "—" | end | — |
| Status | GiftStatusPills (state + "Problem reported") | start | — |
The shipment page's "What {brand} says it sent vs what arrived" table (Product, Brand says, then Good / Damaged / Missing once counted) is GiftShipmentCard (with GiftShipmentCounts for the counts; the 0.6.0 GiftClaimCheck is deprecated).
Gift analytics › By brand (PR · Gift analytics)
A plain table: no toolbar, no pager, sorted by stock used. "Click a brand to see its gift stock" replaces the chevron (chevron={false}). Preset: giftBrandColumns. Columns: Brand (primary), Stock used (UsageBar used/total), Sent (end), Delivered (end, % under it), Received vs claimed (end), state pill (visually hidden header: Out of gifts / Running low / OK). Beside it: Needs attention (RowItems-style rows) and Shipments from brands (status counts).
Creators (tbl('creators'), PR · Creators)
Short KPI strip (KpiGrid size="short"): Active, Pending, Elite, Rejected, each a filter. density="tight" (the mock's .tbl.tight). Search "Search by name"; chips All · Active · Pending · Rejected; selects All tiers, Creators and customers · Creators · Customers; sort All-time sales. 8 per page. Row → PrCreatorDrawer. Presets: prCreatorColumns or creatorColumns.
| Column | Content | Align | Sort |
|---|---|---|---|
| Creator | avatar + name, "Customer · " / handle, "Since Jun 2026" (primary) | start | ✓ Name (A–Z) |
| Status | PrStatusPill (rejected: "Can reapply 1 Dec" as its description) | center | — |
| Tier | TierChip or "—" (read "No tier") | center | — |
| Score | bold number or "—"; tip "TRNDR score from 0 to 100. Tiers follow it, up and down." | center | ✓ |
| Followers | FollowersCell | center | ✓ |
| Brands | BrandStack | center | ✓ Number of brands |
| Orders | count or "—" | center | ✓ |
| All-time sales | Money, figure: 'creator_sales' | end | ✓ (default) |
Tiers (PR · Tiers)
TierLadder (one rung per tier), then two TierMoveLists side by side (s6/s6): Recent automatic moves (avatar, "Rising → Established · 2 days ago", Change → TierChangeDialog, a required reason) and Manual changes by PR. The score modal's Part / Points / What it measures table is ScoreExplainer ("How the TRNDR score works"); the drawer's score card is ScoreBreakdown.
Messages (tbl('msgs'))
KPI strip of three (KpiGrid columns={3}), the lilac "Message creators" card (Card tone="lilac"). Search "Search messages"; selects All audiences · All TRNDR creators · A brand · A tier · Picked creators, Any sender · TRNDR · each brand; sort Sent. 5 per page. Row → message drawer. Preset: messageColumns.
| Column | Content | Align | Sort |
|---|---|---|---|
| Message | bold subject + muted body (30%) | start | — |
| From | SenderCell (TRNDR or the brand) | start | — |
| To | AudienceLabel | start | — |
| Creators | count | end | ✓ Most creators |
| Opened | OpenRate (bar + %) | start | ✓ Most opened |
| Sent | muted date + "by Mona" | start | ✓ Newest (default) |
Activity log (tbl('log'))
Search "Search actions, brands or creators"; chips All · Approvals · Programs · Challenges · Tiers · Messages · Owners; select Anyone · each PR person; sort When; Export CSV. 5 per page. No row click. Preset: auditColumns.
| Column | Content | Align | Sort |
|---|---|---|---|
| What happened | tone dot + sentence (+ muted detail, "Reason: …") (50%) | start | — |
| Area | AuditAreaPill | start | ✓ Area (A–Z) |
| By | small avatar + name | start | ✓ Person (A–Z) |
| When | muted, no wrap | start | ✓ Newest (default) |
PR Home
Needs you: a ranked work list (TaskRow rows with a tag pill, filtered by the three QueueTiles), My brands and Live challenges as MiniLists (live ones with a progress bar).
Which list component
| You are showing | Use | Why |
|---|---|---|
| Records the viewer filters, sorts, pages or opens (creators, coupons, orders, brands, messages, the audit log) | DataTable | The one list engine: sortable headers (aria-sort), row open with a chevron, selection, skeleton rows, the empty and error states, the footer pager, stacked cards under 860px, a cards mode |
| A grid of rich cards from the same list (Find creators, PR challenges) | DataTable mode="cards" + renderCard | Same toolbar, empty, loading and pager as the table |
| A plain list that never sorts (the 0.1.x lists) | RowList | The v3 look on ARIA table roles over a CSS grid, with main / link / chip / num cells (MainCell, CopyLink from kit/Table). Its sorting is deprecated: a sortable list is a DataTable |
| A ranking (Top creators this month, Top creators for this product) | RankList | An ordered list with RankMedal and an optional ShareBar against #1 |
| A short list inside a card (PR My brands, Live challenges, a brand's Challenges and Top creators) | MiniList + MiniRow | Ruled or soft rows, lead / title / sub / trailing / cells, an empty line |
| People or products in a drawer (Paid to, Picked by) | RowItems | Soft .rowi rows, one button each, a heading with a money "?" |
| Money movements grouped by challenge | WalletLedger | Accordion groups with signed totals and proofs |
| Events over time | ActivityLog (Brand), AuditLogList (PR, compact) or DataTable + auditColumns (PR full log) | A timeline reads better than columns when there is one sentence per row |
| Challenge standings | Leaderboard | Ranks, the winners cut, ties, remove |
| Tier moves | TierMoveList | A move per row with its Change action |
There is no Table component: kit/Table exports the MainCell and CopyLink cells that RowList uses.
Column definitions (DataColumn<T>)
| Field | Type | What it does |
|---|---|---|
key | string | Required. Unique per column; the React key and the cell's data-label key |
label | ReactNode | Required. The header. A string also labels the cell on phones |
cardLabel | string | The phone label when label is not a string (a visually hidden "Actions" header) |
sortKey | string | Makes the header a sort button; the server's (and useListState's) sort name |
sortFirst | 'asc' | 'desc' | The first click's order. Default high → low; names start A–Z ('asc') |
align | 'start' | 'end' | 'center' | end for figures (tabular digits), center for rings, followers, counts in the PR Creators table |
render | (row: T) => ReactNode | Required. The cell |
width | string | A CSS width ('24%', '120px'); presets size the person column (24–26%) and the log sentence (50%) |
figure | MoneyFigureKey | A money column: the header gets the figure's "?" note beside the sort button, never inside it |
tip | ReactNode | A non-money header drawn as a dotted Term with this tip; a sortable one keeps a separate "Sort by Score" arrow button |
tone | 'default' | 'muted' | muted: 12px grey cells (dates, a secondary figure) |
primary | boolean | On phones the cell spans the card and drops its label. Default: the first column |
inline | boolean | With a primary column: keeps its width and shares the primary row on phones (a rank medal before the creator) |
DataTable props worth knowing beside columns: label (the table's accessible name, required), rowKey (a database id, so a re-sort keeps focus), sort / onSort ({ key, dir }), onRowClick + isRowClickable + chevron, selection ({ selected, onChange, rowLabel }), isDim, loading + loadingRows (5), error + onRetry, empty / onClearFilters, footer, density ('tight': 9px cells, the PR Creators table) and headDensity ('compact': the 45px head even with the checkbox column), mode + renderCard.
Rules for columns:
- Order them as the mock: identity first (person, brand, coupon, reference), then state (tier, status), then figures, then dates, then the actions column.
- One sortable column per figure the viewer ranks by; never make a pill, a sentence or an action column sortable.
- Money:
<Money value="184300.00" />from the server's 2-dp string,figureon the column for its "?",align: 'end'. Compact (EGP 184.3K) in dense lists, full in ledgers and payouts. - Missing values are "—", with words for screen readers where they mean something ("No tier", "No score yet", "None").
- A button inside a clickable row stops the row's click (Copy, View proof, Approve).
- Name an actions column with a visually hidden header and a
cardLabel, and name each button with its row ("Approve Sara Ali").
PR column presets
Each preset is a plain function returning DataColumn<Row>[] in the mock's order, with EN/AR labels and sort keys named after the row fields. The screen keeps sort, filters and pages (useListState) and may drop or add columns (.filter, .map((c) => ({ ...c, width: undefined }))). Pass the words from the provider with usePrColumnsCopy(language) (a labels.prColumns override) or a partial copy; money sets how money cells show (slot presets.figures).
| Preset | Row type | Columns | Used by |
|---|---|---|---|
joinRequestColumns(language, { onApprove, onReject, onOpen?, busy? }, copy?) | JoinRequestRow | Creator, Followers, Wants to join, Source, Waiting, Actions | Approvals › Join requests |
brandColumns(language, copy?, money?) | BrandRow | Brand, PR owner, Program, Wallet, Sales · 30 days, Creators, Waiting | Brands |
payoutColumns(language, { onReceipt }, copy?, money?) | PayoutRow | Creator, Amount (paid), Paid to (masked), Status, Receipt (View / Upload), Date | Payouts (left for later in the mock: "Next sprint") |
topUpColumns(language, { onConfirm? }, copy?, money?) | TopUpRow | Brand, Top-up (wallet_topped_up), Method (Card (Paymob) / Bank transfer), Status, Date, Confirm (bank, pending) | Wallet top-ups (later) |
messageColumns(language, copy?) | MessageRow | Message, From, To, Creators, Opened, Sent | Messages |
auditColumns(language, copy?) | AuditEntry | What happened, Area, By, When | Activity log |
creatorColumns(language, money?, options?) (pr/creators) | PrCreatorRow (PrNullableSalesCreatorRow with nullableSales: true) | Creator, Status, Tier, Score, Followers, Brands, Orders, All-time sales, with primary on Creator and the Score tip; customers and pending creators read "No tier" / "No score yet". Options (0.7.0): onOpen, reapply, nullableSales | Creators |
newCreatorColumns(language, { onApprove, onReject, onOpen?, busy?, copy? }) | PrNewCreatorRow | Creator, Followers, Signed up, Reject / Approve | Approvals › New creators |
prCreatorColumns(language, { onOpen? }, copy?, money?) (deprecated since 0.7.0: creatorColumns with options) | PrCreatorListRow | the same eight | Creators |
campaignColumns(language, copy?, money?, { wrap? }) | CampaignRow | Brand, Active campaign, Status, Requests, Commission, Creators, Sales · 30 days, Orders, Last change | Affiliate programs |
challengeColumns(language, { onOpen? }, money?) | ChallengeRow | Challenge, Brand, Status, Dates, Creators, Sales, Commission, Waiting | Challenges (v2 list) |
challengeTableColumns(language, options?, money?) | PrChallengeRow (the same rows as PrChallengeCard, via toPrChallengeCard) | Challenge, Brand and dates, Goal, Reward, Time left, Joined, Budget held | Challenges (table view, 0.7.0) |
challengeRequestColumns(language, { onOpen? }, copy?, money?) | ChallengeRequestRow | Request, What the brand wrote, Dates, Budget, Sent, Status | Brand requests |
giftShipmentColumns(language, copy?) (giftClaimColumns / GiftClaimRow are deprecated since 0.7.0) | GiftShipmentRow | Reference, Brand, For, Units claimed, Units confirmed, Status | Gift stock |
giftBrandColumns(language, copy?) (giftAnalyticsColumns / GiftBrandStockRow are deprecated since 0.7.0) | GiftBrandRow | Brand, Stock used, Sent, Delivered, Received vs claimed, state | Gift analytics |
fraudColumns(language, { onOpen? }, money?) | FraudCase | Creator, Brand, Signals, Amount (on_hold), Orders, Status, Opened | Fraud cases |
The Brand dashboard has no presets: its screens define columns inline (see CreatorsListScreen.tsx, CouponsScreen.tsx) from CreatorCell, TierChip, ScoreRing, FollowersCell, CouponChip, Money, StatusPill, ProofButton, RankMedal, ShareBar and ProductCell.
Example 1: PR Approvals › Join requests (selection, bulk bar, reasons, undo)
import {
BulkAction, DataTable, ListToolbar, Pager, PrBulkBar, PrEmpty, ReasonDialog, Segmented, ToastRegion,
joinRequestColumns, listFetcher, useAction, useHttpClient, useListState, usePrColumnsCopy,
type JoinRequestRow, type ToastMessage,
} from '@ergasti/bricks';
const REASONS = ['Not a fit for this brand', "Audience doesn't match", 'Already promoting a competitor', 'Other'].map((r) => ({ value: r, label: r }));
export function JoinRequests({ language }: { language: 'en' | 'ar' }) {
const client = useHttpClient();
const [scope, setScope] = useState<'my' | 'all'>('my');
const fetcher = useMemo(() => listFetcher<JoinRequestRow>(client, '/join-requests', { chipParam: 'source', params: { scope } }), [client, scope]);
const list = useListState<JoinRequestRow>({ namespace: 'join', defaults: { chip: 'all', sort: 'waiting', dir: 'desc' }, fetcher });
const [selected, setSelected] = useState<Set<string | number>>(new Set());
const [rejecting, setRejecting] = useState<JoinRequestRow[] | null>(null);
const [toast, setToast] = useState<ToastMessage | null>(null);
const decide = useAction((input: { ids: (string | number)[]; decision: 'approve' | 'reject'; reason?: string; note?: string }, http) =>
http.post('/join-requests/decide', input), { onDone: () => { setSelected(new Set()); list.retry(); } });
const copy = usePrColumnsCopy(language);
const { q, chip, sort, dir } = list.query;
const approve = async (rows: JoinRequestRow[]) => {
const result = await decide.run({ ids: rows.map((r) => r.id), decision: 'approve' });
if (result.ok) setToast({ message: rows.length === 1 ? `${rows[0].creator.name} approved into ${rows[0].brand.name}` : `${rows.length} creators approved`, actionLabel: 'Undo', onAction: () => { /* POST the undo */ } });
};
const columns = joinRequestColumns(language, { onApprove: (r) => approve([r]), onReject: (r) => setRejecting([r]), onOpen: (r) => openCreator(r.creator), busy: () => decide.pending }, copy);
const rowsSelected = list.rows.filter((r) => selected.has(r.id));
const scopeSwitch = <Segmented size="sm" label="Brands" value={scope} onChange={(value) => setScope(value)} options={[['my', 'My brands'], ['all', 'All brands']] as const} />;
return (
<>
<ListToolbar language={language}
search={{ value: q, onChange: (value) => list.set({ q: value }), placeholder: 'Search creator or brand' }}
chips={{ label: 'Source', value: chip, onChange: (value) => list.set({ chip: value }), options: [
{ value: 'all', label: 'All sources' }, { value: 'creator_request', label: 'Creator request' }, { value: 'brand_invite', label: 'Brand invite' }, { value: 'public_challenge', label: 'Public challenge' }] }}
sort={{ value: sort, dir, options: [['waiting', 'Waiting longest', 'desc'], ['creator', 'Creator (A–Z)', 'asc'], ['followers', 'Followers', 'desc'], ['brand', 'Brand (A–Z)', 'asc']],
onChange: (key, first) => list.set({ sort: key, dir: first ?? dir }), onFlip: () => list.set({ dir: dir === 'asc' ? 'desc' : 'asc' }) }}
reset={{ active: q !== '' || chip !== 'all', onReset: list.reset }}
extra={selected.size ? (
<PrBulkBar count={selected.size} onClear={() => setSelected(new Set())} language={language}>
<BulkAction kind="danger" onClick={() => setRejecting(rowsSelected)}>Reject</BulkAction>
<BulkAction kind="approve" disabled={decide.pending} onClick={() => approve(rowsSelected)}>{`Approve ${selected.size}`}</BulkAction>
</PrBulkBar>
) : scopeSwitch}
/>
<DataTable label="Join requests" language={language} columns={columns} rows={list.rows} rowKey={(r) => r.id}
sort={{ key: sort, dir }} onSort={(next) => list.set({ sort: next.key, dir: next.dir })} headDensity="compact"
selection={{ selected, onChange: setSelected, rowLabel: (r) => r.creator.name }}
loading={list.loading} error={list.error?.message || null} onRetry={list.retry} onClearFilters={list.reset}
empty={q || chip !== 'all' ? undefined : <PrEmpty card icon="party" tone="lime" title="No join requests" />}
footer={<Pager page={list.page} lastPage={list.lastPage} total={list.total} perPage={5} loading={list.loading} label="Join requests" language={language} onPage={(page) => list.set({ page })} />}
/>
<ReasonDialog open={rejecting !== null} onClose={() => setRejecting(null)} mode="select" reasons={REASONS} tone="rasp"
title={rejecting?.length === 1 ? `Reject ${rejecting[0].creator.name}?` : `Reject ${rejecting?.length ?? 0} requests?`}
sub={rejecting?.length === 1 ? `They won't join ${rejecting[0].brand.name}. They can request again after 2 weeks.` : 'Same reason for all. They can request again after 2 weeks.'}
confirmLabel="Reject" busy={decide.pending} error={decide.error} language={language}
onConfirm={async ({ reason, note }) => {
const rows = rejecting ?? [];
const result = await decide.run({ ids: rows.map((r) => r.id), decision: 'reject', reason, note });
if (result.ok) { setRejecting(null); setToast({ message: rows.length === 1 ? `${rows[0].creator.name} rejected` : `${rows.length} rejected`, actionLabel: 'Undo', onAction: () => {} }); }
}} />
<ToastRegion toast={toast} onDismiss={() => setToast(null)} language={language} />
</>
);
}openCreator opens PrCreatorDrawer. Under the table, the footnote: "Requests never expire. You get a reminder after 2 days and again after 1 week."
Example 2: Brand Coupons (KPI filters, a money column, a row action)
import {
BulkBar, Button, ButtonLink, Card, CouponChip, CreatorCell, DataTable, KpiCard, KpiGrid, ListToolbar, Money, Pager, StatusPill, Term, Banner,
listFetcher, useHttpClient, useListState, type DataColumn,
} from '@ergasti/bricks';
type CouponRow = { id: number; code: string; creator: { id: number; name: string; handle: string | null }; uses: number; sales: string; status: 'active' | 'paused' | 'stopped' };
const columns: DataColumn<CouponRow>[] = [
{ key: 'code', label: 'Coupon', sortKey: 'code', sortFirst: 'asc', render: (c) => <CouponChip code={c.code} /> },
{ key: 'creator', label: 'Creator', primary: true, sortKey: 'name', sortFirst: 'asc',
render: (c) => <CreatorCell id={c.creator.id} name={c.creator.name} identity={{ handle: c.creator.handle, invitedByYou: true, links: null, avatarUrl: null }} /> },
{ key: 'discount', label: <Term tip="What the shopper saves with this coupon">Discount</Term>, cardLabel: 'Discount', render: () => '10% off' },
{ key: 'uses', label: 'Uses', sortKey: 'uses', align: 'end', render: (c) => c.uses },
{ key: 'sales', label: 'Sales', sortKey: 'sales', align: 'end', figure: 'coupon_sales', render: (c) => <b><Money value={c.sales} compact /></b> },
{ key: 'status', label: 'Status', render: (c) => <StatusPill status={c.status} /> },
// The mock's trailing Copy button: a button inside a clickable row stops the row's click.
{ key: 'copy', label: <span className="kit-sr">Copy</span>, cardLabel: 'Copy', align: 'end',
render: (c) => <Button size="sm" aria-label={`Copy ${c.code}`} onClick={(e) => { e.stopPropagation(); copyCoupon(c.code); }}>Copy</Button> },
];
export function Coupons({ kpis }: { kpis: { active: number; uses: number; sales: string; stopped: number } }) {
const client = useHttpClient();
const fetcher = useMemo(() => listFetcher<CouponRow>(client, '/coupons', { chipParam: 'status' }), [client]);
const list = useListState<CouponRow>({ namespace: 'coupons', defaults: { chip: 'all', sort: 'uses', dir: 'desc' }, fetcher });
const [selected, setSelected] = useState<Set<string | number>>(new Set());
const { q, chip, sort, dir } = list.query;
const toggle = (value: 'active' | 'stopped') => list.set({ chip: chip === value ? 'all' : value });
return (
<>
<KpiGrid phoneColumns={2}>
<KpiCard tone="lime" icon="coupons" label="Active coupons" value={kpis.active} sub="Working in your store now" active={chip === 'active'} onClick={() => toggle('active')} />
<KpiCard tone="sky" icon="chart" label="Coupon uses" value={kpis.uses} sub="Orders with a creator coupon" onClick={() => goTo('analytics')} />
<KpiCard tone="butter" icon="wallet" label="Sales via coupons" value={<Money value={kpis.sales} compact />} sub="All time" onClick={() => goTo('analytics')} />
<KpiCard tone="rasp" icon="stop" label="Stopped" value={kpis.stopped} sub="Creator removed · coupon off" active={chip === 'stopped'} onClick={() => toggle('stopped')} />
</KpiGrid>
<Banner tone="lime" icon="info">Every approved creator gets a coupon automatically. To change one, contact the TRNDR team.</Banner>
<Card>
<ListToolbar
search={{ value: q, onChange: (value) => list.set({ q: value }), placeholder: 'Search coupon or creator' }}
chips={{ label: 'Status', value: chip, onChange: (value) => list.set({ chip: value }), options: [
{ value: 'all', label: 'All' }, { value: 'active', label: 'Active' }, { value: 'paused', label: 'Paused' }, { value: 'stopped', label: 'Stopped' }] }}
sort={{ value: sort, dir, options: [['code', 'Coupon (A–Z)', 'asc'], ['name', 'Name (A–Z)', 'asc'], ['uses', 'Uses', 'desc'], ['sales', 'Sales', 'desc']],
onChange: (key, first) => list.set({ sort: key, dir: first ?? dir }), onFlip: () => list.set({ dir: dir === 'asc' ? 'desc' : 'asc' }) }}
reset={{ active: q !== '' || chip !== 'all' || sort !== 'uses', onReset: list.reset }}
actions={<ButtonLink size="sm" href="/coupons.csv" download>Export CSV</ButtonLink>}
/>
{/* The Brand mock defines no bulk actions on Coupons: add a BulkBar only for the screen's own (none today). */}
<BulkBar count={selected.size}><Button size="sm" onClick={() => setSelected(new Set())}>Clear selection</Button></BulkBar>
<DataTable label="Coupons" columns={columns} rows={list.rows} rowKey={(c) => c.id}
sort={{ key: sort, dir }} onSort={(next) => list.set({ sort: next.key, dir: next.dir })}
selection={{ selected, onChange: setSelected, rowLabel: (c) => c.code }}
onRowClick={(c) => openCreator(c.creator.id)}
loading={list.loading} error={list.error?.message || null} onRetry={list.retry} onClearFilters={list.reset}
footer={<Pager page={list.page} lastPage={list.lastPage} total={list.total} perPage={10} loading={list.loading} label="Coupons" onPage={(page) => list.set({ page })} />}
/>
</Card>
</>
);
}copyCoupon writes the code to the clipboard and toasts "Coupon KARI0329 copied" (the mock's words). CouponChip can copy on its own too ("Copy KARI0329" → "Copied"); the mock keeps a separate Copy column, shown here.
Example 3: PR Activity log (a read-only log: no selection, no row click)
import { DataTable, ListToolbar, Pager, auditColumns, listFetcher, useHttpClient, useListState, usePrColumnsCopy, type AuditEntry } from '@ergasti/bricks';
const AREAS = [['all', 'All'], ['approvals', 'Approvals'], ['programs', 'Programs'], ['challenges', 'Challenges'], ['tiers', 'Tiers'], ['messages', 'Messages'], ['owners', 'Owners']] as const;
export function ActivityLogScreen({ language, people }: { language: 'en' | 'ar'; people: ReadonlyArray<{ id: string; name: string }> }) {
const client = useHttpClient();
const fetcher = useMemo(() => listFetcher<AuditEntry>(client, '/audit-log', { chipParam: 'area' }), [client]);
const list = useListState<AuditEntry>({ namespace: 'log', defaults: { chip: 'all', sort: 'when', dir: 'desc', selects: { by: '' } }, fetcher });
const { q, chip, selects, sort, dir } = list.query;
return (
<>
<ListToolbar language={language}
search={{ value: q, onChange: (value) => list.set({ q: value }), placeholder: 'Search actions, brands or creators' }}
chips={{ label: 'Area', value: chip, onChange: (value) => list.set({ chip: value }), options: AREAS.map(([value, label]) => ({ value, label })) }}
selects={[{ id: 'by', label: 'Person', value: selects.by, onChange: (by) => list.set({ selects: { ...selects, by } }), options: [['', 'Anyone'], ...people.map((p) => [p.id, p.name] as const)] }]}
sort={{ value: sort, dir, options: [['when', 'Newest', 'desc'], ['area', 'Area (A–Z)', 'asc'], ['by', 'Person (A–Z)', 'asc']],
onChange: (key, first) => list.set({ sort: key, dir: first ?? dir }), onFlip: () => list.set({ dir: dir === 'asc' ? 'desc' : 'asc' }) }}
reset={{ active: q !== '' || chip !== 'all' || selects.by !== '', onReset: list.reset }}
actions={<ButtonLink size="sm" href="/audit-log.csv" download>Export CSV</ButtonLink>}
/>
<DataTable label="Activity log" language={language} columns={auditColumns(language, usePrColumnsCopy(language))} rows={list.rows} rowKey={(e) => e.id}
sort={{ key: sort, dir }} onSort={(next) => list.set({ sort: next.key, dir: next.dir })}
loading={list.loading} error={list.error?.message || null} onRetry={list.retry} onClearFilters={list.reset}
footer={<Pager page={list.page} lastPage={list.lastPage} total={list.total} perPage={5} loading={list.loading} label="Activity log" language={language} onPage={(page) => list.set({ page })} />}
/>
</>
);
}No bulk bar and no onRowClick: the mock's log is read-only, and a selection with nothing to do is noise.
Example 4: Find creators (cards mode)
const list: ListState<FindCreator> = useListState<FindCreator>({ namespace: 'find', defaults: { sort: 'fol', dir: 'desc' }, fetcher });
<>
<ListToolbar
search={{ value: q, onChange: (value) => list.set({ q: value }), placeholder: 'Search by name or niche' }}
selects={[platformSelect, followerSelect, nicheSelect, tierSelect]}
sort={{ value: sort, dir, options: [['fol', 'Followers', 'desc'], ['sales', 'Sales · 90 days', 'desc'], ['eng', 'Engagement', 'desc'], ['score', 'Score', 'desc'], ['name', 'Name (A–Z)', 'asc']], onChange, onFlip }}
collapseFiltersBelow={600}
/>
<DataTable<FindCreator> label="Creators" mode="cards" columns={[]} rows={list.rows} rowKey={(c) => c.id}
renderCard={(c) => <FindCreatorCard creator={c} onOpen={() => openProfile(c.id)} onInvite={() => invite(c.id)} inviteDisabled={seatsLeft === 0} inviteDisabledReason="No seats left" />}
loading={list.loading} error={list.error?.message || null} onRetry={list.retry} onClearFilters={list.reset}
footer={<Pager page={list.page} lastPage={list.lastPage} total={list.total} perPage={8} loading={list.loading} label="Creators" onPage={(page) => list.set({ page })} />} />
</>;Do and don't
Do
- One
useListStateper list, with its ownnamespace(mine,coupons,join): two lists on one screen keep separate URL state. - Put the toolbar and the table in one
Cardon Brand screens. Most PR lists sit straight on the page (Approvals, Brands, Creators, Activity log); Messages wraps its list in a card. - Keep the mock's per-page counts (10 for Brand lists; 5 for small cards and PR lists; 6 for gift orders and challenges; 8 for Find creators, gift stock and PR Creators).
- Mirror a KPI filter card and its chip: one state, two controls.
- Toast every row action with its outcome and, in the PR portal, Undo.
Don't
- Don't sort or filter only the visible page when the server pages; send everything to the server.
- Don't put a link or a second button around the whole row:
onRowClickalready makes it one target, and inner buttons stop the click. - Don't use
RowListfor a new sortable list: a sortable list is aDataTable. - Toolbars:
ListToolbarabove any data list whose state lives inuseListState. The slot-basedToolbaronly for a filter or chart row that does not drive such a list (Analytics: the periodSegmented, the challenge select and Export CSV; Motivation › Challenges: the hint and "+ Request a challenge").SortSelectis deprecated: never in new code. - Don't hide the pager on one page: it reads "n items".