Skip to Content
BBRICKSv0.7.4
PR PortalApprovals

ApprovalRow

The PR mock's join request row (.jrow, Home's "Join requests"): photo, "{creator} wants to join {brand}" over the source, the waiting age with its reminder line, then round Reject (✕) and Approve (✓) buttons whose names say who and where. A list item; put rows in an <ul className="kit-pr-queue">.

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

Examples

The "needs you" queue

Join requests as rows (creator, brand, where the request came from, how long it has waited) with Approve and Reject, under a queue header with a count and "See all". Tiles above summarise each queue and filter it.

Code
import { useState } from 'react';
import { ApprovalRow, BrandLead, Card, IconSquare, PrCountPill, PrStatusPill, QueueHeader, QueueTile, TaskRow } from '@ergasti/bricks';
import { brands, joinRequests } from './pr';

function Queue() {
  const [tile, setTile] = useState(0);
  return (
    <div style={{ display: 'grid', gap: 16 }}>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: 12 }}>
        {([['rasp', 'approvals', 'Approvals waiting', 9], ['butter', 'wallet', 'Money alerts', 2], ['sky', 'star', 'Challenges to act on', 2]] as const).map(([tone, icon, label, count], i) => (
          <QueueTile key={label} tone={tone} icon={icon} label={label} count={count} active={tile === i} onClick={() => setTile(tile === i ? -1 : i)} />
        ))}
      </div>
      <Card>
        <QueueHeader title="Join requests" count={5} onSeeAll={() => {}} />
        <ul className="kit-pr-queue">
          {joinRequests.slice(0, 3).map((j) => <ApprovalRow key={j.id} creator={j.creator} brand={j.brand} source={j.source === 'public_challenge' ? 'Public challenge' : 'Creator request'} days={j.days} onApprove={() => {}} onReject={() => {}} onOpen={() => {}} />)}
        </ul>
        <QueueHeader title="To review" count={2} />
        <ul className="kit-pr-queue">
          <TaskRow lead={<BrandLead brand={brands.kemet} />} title="Kemet Home is below zero" meta="− EGP 8,400 · day 4 of 7" tag={<PrCountPill status="pauses_in" count={3} />} onOpen={() => {}} />
          <TaskRow lead={<IconSquare name="star" tone="sky" />} title="Nile Threads requested a challenge" meta="Sell 30 in December · EGP 15,000" tag={<PrStatusPill status="new_request" />} onOpen={() => {}} />
          <TaskRow lead={<IconSquare name="user" tone="lime" />} title="5 new creators to vet" meta="Pending until you approve them" tag={<PrCountPill status="waiting_count" count={5} />} onOpen={() => {}} />
        </ul>
      </Card>
    </div>
  );
}

Actions and waiting time

ApprovalActions is the Approve / Reject pair on its own (busy disables it while a request runs); WaitingCell shows how long something has waited and turns urgent after the reminder thresholds.

Code
import { ApprovalActions, WaitingCell } from '@ergasti/bricks';

function Parts() {
  return (
    <div style={{ display: 'grid', gap: 14 }}>
      <ApprovalActions onApprove={() => {}} onReject={() => {}} />
      <ApprovalActions onApprove={() => {}} onReject={() => {}} busy size="sm" />
      <div style={{ display: 'flex', gap: 24 }}>
        <WaitingCell days={1} variant="cell" />
        <WaitingCell days={3} variant="cell" />
        <WaitingCell days={9} variant="cell" />
      </div>
    </div>
  );
}

Task rows: no lead, or an action

lead is optional (the title starts the row). action puts a control of the row's own where the chevron was (the Tiers screen's "Recent automatic moves" with "Change"); the row is then not one button, and with onOpen too the title becomes the open button, so no button sits inside another.

Code
import { Avatar, Button, Card, PrStatusPill, TaskRow } from '@ergasti/bricks';

function TaskRows() {
  return (
    <Card>
      <ul className="kit-pr-queue">
        <TaskRow title="Double commission week" meta="Every delivered sale · ×2 commission" tag={<PrStatusPill status="trndr_wide" />} onOpen={() => {}} />
        <TaskRow lead={<Avatar name="Sara Ali" seed={1} />} title="Sara Ali" meta="Rising → Established · 2 days ago" action={<Button size="sm">Change</Button>} />
        <TaskRow lead={<Avatar name="Hana Rami" seed={2} />} title="Hana Rami" meta="Established → Influential · 3 days ago" onOpen={() => {}} action={<Button size="sm">Change</Button>} />
      </ul>
    </Card>
  );
}

Task rows in Arabic

The chevron mirrors and the pills read in Arabic.

Pinned to Arabic
Code
import { BrandLead, Card, IconSquare, PrCountPill, TaskRow } from '@ergasti/bricks';
import { brands } from './pr';

function TaskRowsArabic() {
  return (
    <Card>
      <ul className="kit-pr-queue" dir="rtl">
        <TaskRow lead={<BrandLead brand={brands.kemet} />} title="Kemet Home تحت الصفر" meta="يوم 4 من 7" tag={<PrCountPill status="pauses_in" count={3} language="ar" />} onOpen={() => {}} />
        <TaskRow lead={<IconSquare name="user" tone="lime" />} title="5 صنّاع محتوى جداد محتاجين مراجعة" meta="مستنيين موافقتك" tag={<PrCountPill status="waiting_count" count={5} language="ar" />} onOpen={() => {}} />
      </ul>
    </Card>
  );
}

Busy rows and named actions

While a request for a row runs, pass busy: the row dims, says it is busy to screen readers and its Approve / Reject are disabled. ApprovalActions shows short "Approve" / "Reject" text; approveLabel / rejectLabel give each button an accessible name that says which row it acts on (a table of many rows).

Code
import { ApprovalActions, ApprovalRow, Card } from '@ergasti/bricks';
import { joinRequests } from './pr';

function BusyAndNamed() {
  const [j] = joinRequests;
  return (
    <div style={{ display: 'grid', gap: 14 }}>
      <Card>
        <ul className="kit-pr-queue">
          <ApprovalRow creator={j.creator} brand={j.brand} source="Creator request" days={j.days} onApprove={() => {}} onReject={() => {}} onOpen={() => {}} busy />
        </ul>
      </Card>
      <ApprovalActions onApprove={() => {}} onReject={() => {}} approveLabel={`Approve ${j.creator.name} into ${j.brand.name}`} rejectLabel={`Reject ${j.creator.name} from ${j.brand.name}`} size="md" />
    </div>
  );
}

Full-width actions

In a drawer footer the pair should fill the width: fullWidth gives Reject and Approve equal halves, 10px apart (the PR mock's creator drawer). The default sizes the buttons to their words and keeps them at the end, for a table cell or a row. Default on top, fullWidth below, both in a 380px drawer-wide box.

Code
import { ApprovalActions } from '@ergasti/bricks';
import { joinRequests } from './pr';

function FullWidth() {
  const [j] = joinRequests;
  return (
    <div style={{ display: 'grid', gap: 14, maxWidth: 380 }}>
      <ApprovalActions onApprove={() => {}} onReject={() => {}} size="md" />
      <ApprovalActions onApprove={() => {}} onReject={() => {}} size="md" fullWidth approveLabel={`Approve ${j.creator.name} into ${j.brand.name}`} rejectLabel={`Reject ${j.creator.name} from ${j.brand.name}`} />
    </div>
  );
}

Full-width actions in Arabic

"ارفض" and "وافق" share the drawer footer; the order mirrors.

Pinned to Arabic
Code
import { ApprovalActions } from '@ergasti/bricks';

function FullWidthArabic() {
  return (
    <div style={{ maxWidth: 380 }}>
      <ApprovalActions onApprove={() => {}} onReject={() => {}} size="md" fullWidth approveLabel="وافق على سارة علي في Glow Lab" rejectLabel="ارفض سارة علي في Glow Lab" />
    </div>
  );
}

Section headers

QueueHeader puts a count after the title when you pass count; leave it out for a section that has no count. seeAllLabel renames "See all" for a link that goes somewhere specific (the brand page's "Stock requests →").

Code
import { Card, QueueHeader } from '@ergasti/bricks';

function Headers() {
  return (
    <Card>
      <QueueHeader title="Join requests" count={5} onSeeAll={() => {}} />
      <QueueHeader title="Gift stock" onSeeAll={() => {}} seeAllLabel="Stock requests →" />
      <QueueHeader title="Recent activity" />
    </Card>
  );
}

A tag on the age

ageTag puts a node after the waiting age's reminder line, in the row and in the table's WaitingCell: the PR mock's open-decision tag ("S1": when a reminder goes out) sits there.

Code
import { ApprovalRow, Card, DecisionTag, WaitingCell } from '@ergasti/bricks';
import { joinRequests } from './pr';

function AgeTag() {
  const [j, k] = joinRequests;
  return (
    <Card>
      <ul className="kit-pr-queue">
        <ApprovalRow creator={j.creator} brand={j.brand} source="Creator request" days={j.days} onApprove={() => {}} onReject={() => {}} ageTag={<DecisionTag id="S1" variant="open" />} />
        <ApprovalRow creator={k.creator} brand={k.brand} source="Creator request" days={k.days} onApprove={() => {}} onReject={() => {}} ageTag={<DecisionTag id="S1" variant="open" />} />
      </ul>
      <WaitingCell days={3} variant="cell" ageTag={<DecisionTag id="S1" variant="open" />} />
    </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 prApprovals, or with the component's own prop where it has one. A {name} is a value the component fills in.

prApprovals
KeyEnglishArabic
todayTodayالنهارده
freshNewجديد
first1st reminder sentاتبعت أول تذكير
second2nd reminder sentاتبعت تاني تذكير
wantswants to joinعايز يشترك في
approveApproveوافق
rejectRejectارفض
viewViewشوف
approveOneApprove {c} into {b}وافق على {c} في {b}
rejectOneReject {c} for {b}ارفض {c} في {b}
overdueWaiting a week or moreمستني أسبوع أو أكتر
seeAllSee allشوف الكل

Design guidance

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

The PR Portal's join-request row: the creator's photo, "{creator} wants to join {brand}" over where the request came from, how long it has waited, then round Reject (✕) and Approve (✓) buttons; use it for the "Join requests" queue on PR Home.

It is the PR mock's .jrow in Home's "Needs you" card. It is a list item: put rows in <ul className="kit-pr-queue"> under a QueueHeader. Every row draws a top hairline that separates it from the header or the row above, so a row with nothing above it shows a stray line under the card edge; always give the list its header. The icon buttons' accessible names say who and where ("Approve Sara Ali into Glow Lab").

Anatomy

  1. Row (<li class="kit-pr-jrow">): grid 40px | 1fr | 128px | 84px, 12px padding, top border --line; on phones the actions wrap under.
  2. Avatar: 40px photo or toned initials (PrPerson.seed).
  3. Text (.kit-pr-jrow-t): "Salma Hosny wants to join Glow Lab" (the name is a link button with onOpen), then the source in muted 13px; both truncate.
  4. Waiting (WaitingCell, row variant): "8 days" over "2nd reminder sent" (red from a week), or "Today" / "New".
  5. Actions (.kit-pr-ibs): 38px round ✕ (outline; red on hover) and ✓ (ink; olive/lime on hover).

Variants

None beyond content. The source text is yours ("Creator request", "Brand invite", "Public challenge").

States

StateHowLook
Default—As above.
Just arriveddays={0}"Today" over "New".
One daydays={1}"1 day" over "New" (the first reminder comes at 2 days).
Remindeddays 2–6"1st reminder sent".
Overduedays ≥ 7Red "8 days" over "2nd reminder sent", tooltip "Waiting a week or more".
BusybusyRow at 50% opacity, aria-busy, both buttons disabled.
Hoverpointer on ✕ / ✓✕ red on raspberry-50; ✓ olive with lime icon.

Types

PrPerson (creator): { name, seed, src? }. StackBrand (brand): { id, name, color? }.

Usage

<Card>
  <QueueHeader title="Join requests" count={5} onSeeAll={() => navigate('/approvals')} />
  <ul className="kit-pr-queue">
    {joinRequests.slice(0, 3).map((j) => (
      <ApprovalRow
        key={j.id}
        creator={j.creator}              // { name: 'Salma Hosny', seed: 3, src }
        brand={j.brand}                  // { id: 'glow', name: 'Glow Lab', color: '#C2185B' }
        source={j.source === 'public_challenge' ? 'Public challenge' : 'Creator request'}
        days={j.days}
        busy={saving === j.id}
        onApprove={() => approve(j.id)}
        onReject={() => openReason(j.id)}
        onOpen={() => openCreator(j.creator)}
      />
    ))}
  </ul>
</Card>

Where it appears

Guidelines

Do

  • Show 3–5 rows on Home and link "See all" to the Approvals table.
  • Ask for a reason on Reject (ReasonDialog) before calling the server.
  • Set busy while the decision saves.

Don't

  • Don't use it in a table: use ApprovalActions in the last column.
  • Don't hide overdue rows; they are the most urgent.

RTL and Arabic

  • Columns mirror; "عايز يشترك في"; ✓ / ✕ icons do not flip.
  • Arabic names "وافق على {creator} في {brand}", "ارفض {creator} في {brand}".

Tokens

--line, --card, --ink, --ink-2, --ink-3, --bad, --rasp-50, --olive, --lime, --color-text-inverted, --focus-ring.

Accessibility

  • <li> in a <ul>; aria-busy while saving.
  • Icon buttons have full names ("Reject Salma Hosny for Glow Lab", "Approve Salma Hosny into Glow Lab") and short tooltips.
  • Overdue is said in words (the reminder line), not only red.

Found in the source

  • ARIA attributes set: aria-label, aria-busy, aria-hidden, aria-pressed.
  • Its tests cover: “a toggle button with the count and label; Enter toggles; Arabic”.

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

See also: Avatar · Button · BrandAvatar · PrIcon · useLanguage · Money · Card · BrandLead · PrCountPill · IconSquare · PrStatusPill

Source

src/pr/Approvals.tsx (line 107) on GitHub.

On this page