ChallengeSummary
The challenge builder's review (the PR mock's sticky #sum card, grown into the last step): name and brand, dates and type, who can join (public or the brand's affiliates, narrowed by group, tier and niche), the reward / commission / bonus lines, gifts with their stock, the budget to hold against the wallet with its bar and what is left, the launch checks, and the actions. Each section links back to its builder step. Nothing is computed but "Left after hold" (available − hold, both server strings). v3: layout="flat" is the mock's plain sticky card; payer="trndr" a TRNDR-wide challenge (nothing held from a wallet); paused and a wallet short of the budget warn and stop the launch.
import { ChallengeSummary } from '@ergasti/bricks';Examples
Builder summary
The last step of the challenge builder: what it is, who can join, the rewards, the gifts it needs, the budget it holds and warnings that link back to the step to fix. mode is launch or approve.
Code
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function Summary() {
return (
<div style={{ maxWidth: 440 }}>
<ChallengeSummary
name="Winter top 10" brand={brands.glow} status="upcoming" dates="1 Dec → 31 Dec" goal="Top 10 by delivered sales"
eligibility={{ audience: 'public', groups: [], tiers: ['established', 'elite'], niches: ['Beauty', 'Skincare'] }}
rewards={[{ key: 'per', label: 'Per winner', amount: '1000.00', figure: 'challenge_commission', hint: 'each' }, { key: 'gift', label: 'Gift', value: 'Glow serum set' }]}
gifts={[{ id: 1, name: 'Glow serum set', left: 4, needed: 10 }]}
budget={{ hold: '10000.00', available: '43390.00' }}
warnings={[{ id: 'gift', text: 'Only 4 gift sets left for 10 winners.', step: 'reward' }, { id: 'dates', text: 'Starts in 14 days: creators can join once it starts.' }]}
steps={{ basics: '1', goal: '2', join: '3', reward: '4' }} onEditStep={() => {}} onPrimary={() => {}} onSaveDraft={() => {}}
/>
</div>
);
}The parts
A summary is sections made of lines; use them for your own review screens.
Code
import { Card, SummaryLine, SummarySection } from '@ergasti/bricks';
function Parts() {
return (
<div style={{ maxWidth: 440 }}>
<Card>
<SummarySection title="Reward" onEdit={() => {}} editLabel="Edit the reward step">
<SummaryLine label="Per winner" amount="1000.00" figure="challenge_commission" hint="each" />
<SummaryLine label="Gift" value="Glow serum set" />
<SummaryLine label="Budget on hold" value="EGP 10,000.00" tone="bad" />
</SummarySection>
</Card>
</div>
);
}Approve a brand's request
mode="approve" is a brand's request under review: the primary reads "Approve and launch" and onReject adds Reject (the app opens its ReasonDialog). Approving sets pending, which locks both buttons while the app saves.
Code
import { useState } from 'react';
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function Approve() {
const [pending, setPending] = useState(false);
return (
<div style={{ maxWidth: 440 }}>
<ChallengeSummary
mode="approve" pending={pending}
name="Weekend sprint" brand={brands.mira} status="needs_review" dates="6 Dec → 8 Dec" goal="20 orders · max 30"
eligibility={{ audience: 'brand', groups: ['Top sellers'] }}
rewards={[{ key: 'bonus', label: 'Bonus at 20 orders', amount: '500.00', figure: 'challenge_commission' }]}
budget={{ hold: '5000.00', available: '5200.00' }}
onPrimary={() => { setPending(true); window.setTimeout(() => setPending(false), 1500); }} onReject={() => {}}
/>
</div>
);
}Cannot launch yet
A bad warning disables the primary action on its own, and so does a wallet that cannot hold the budget (it adds "Not enough in the wallet…" itself); canSubmit={false} does the same for a check the app makes, and canSubmit overrides all of them.
Code
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function Blocked() {
return (
<div style={{ maxWidth: 440 }}>
<ChallengeSummary
canSubmit={false}
name="Sell 30 in December" brand={brands.nile} dates="1 Dec → 31 Dec" goal="30 orders"
eligibility={{ audience: 'public' }}
rewards={[{ key: 'per', label: 'Per creator', amount: '750.00', figure: 'challenge_commission' }]}
budget={{ hold: '22500.00', available: '9100.00' }}
warnings={[{ id: 'budget', tone: 'bad', text: 'The wallet cannot cover the hold: top up EGP 13,400 first.' }]}
onPrimary={() => {}} onSaveDraft={() => {}}
/>
</div>
);
}Flat summary
The v3 builder's sticky card (layout="flat"): plain lines, the budget, red lines for what blocks the launch; payer="trndr" for a TRNDR-wide challenge.
Code
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function Flat() {
return (
<div style={{ display: 'grid', gap: 16, maxWidth: 420 }}>
<ChallengeSummary layout="flat" name="" brand={brands.glow} status="upcoming" dates="1 Dec → 31 Dec" goal="20 orders · max 10" eligibility={{ audience: 'public' }}
rewards={[{ key: 'r', label: 'Reward', value: 'Serum gift set' }]} budget={{ hold: '6500.00', available: '43390.00' }} money={{ decimals: 'auto' }}
warnings={[{ id: 'n', text: 'Add a name in step 1.', tone: 'bad' }]} onPrimary={() => {}} onSaveDraft={() => {}} />
<ChallengeSummary layout="flat" payer="trndr" name="Black Friday 50" brand={brands.glow} status="upcoming" dates="24 Nov → 30 Nov" goal="50 orders · max 20" eligibility={{ audience: 'public' }}
rewards={[{ key: 'r', label: 'Reward', value: 'EGP 1,000 each' }]} budget={{ hold: '20000.00' }} money={{ decimals: 'auto' }} onPrimary={() => {}} />
</div>
);
}Flat, as in the mock
flatDensity="mock" gives the flat card the v3 builder's spacing: 16px under the heading, 12px warning lines with room above and below, and a 46px launch button. A reward line with inlineHint keeps its hint in the same bold run ("EGP 1,000 each") instead of a muted line under the amount. Both default to 0.4.0's look.
Code
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function FlatMock() {
return (
<div style={{ maxWidth: 420 }}>
<ChallengeSummary layout="flat" flatDensity="mock" name="" brand={brands.glow} status="upcoming" dates="1 Dec → 31 Dec" goal="Top 10 by sales" eligibility={{ audience: 'public' }}
rewards={[{ key: 'per', label: 'Reward', amount: '1000.00', figure: 'challenge_commission', hint: 'each', inlineHint: true }]} budget={{ hold: '10000.00', available: '43390.00' }} money={{ decimals: 'auto' }}
warnings={[{ id: 'n', text: 'Add a name in step 1.', tone: 'bad' }]} onPrimary={() => {}} onSaveDraft={() => {}} />
</div>
);
}Paused, or short of money
paused says the brand's program is paused and stops the launch. A wallet that cannot hold the budget warns and stops it too; onAskTopUp adds "Ask {brand} to top up" under that warning, so PR can ask from the summary. Both work in either layout.
Code
import { useState } from 'react';
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function PausedAndShortWallet() {
const [asked, setAsked] = useState(false);
return (
<div style={{ display: 'grid', gap: 16, maxWidth: 420 }}>
<ChallengeSummary layout="flat" paused name="Ramadan glow" brand={brands.glow} status="upcoming" dates="1 Mar → 30 Mar" goal="20 orders · max 10" eligibility={{ audience: 'public' }}
rewards={[{ key: 'r', label: 'Reward', value: 'Serum gift set' }]} budget={{ hold: '6500.00', available: '43390.00' }} money={{ decimals: 'auto' }} onPrimary={() => {}} onSaveDraft={() => {}} />
<ChallengeSummary layout="flat" name="Sell 30 in December" brand={brands.nile} status="upcoming" dates="1 Dec → 31 Dec" goal="30 orders" eligibility={{ audience: 'public' }}
rewards={[{ key: 'per', label: 'Per creator', amount: '750.00', figure: 'challenge_commission' }]} budget={{ hold: '22500.00', available: '9100.00' }} money={{ decimals: 'auto' }}
onAskTopUp={() => setAsked(true)} onPrimary={() => {}} onSaveDraft={() => {}} />
{asked && <small>Top-up request sent to Nile Threads.</small>}
</div>
);
}Lines without a section title
A SummarySection with no title draws its lines alone, as a flat key-value list: use it under your own heading.
Code
import { Card, SummaryLine, SummarySection } from '@ergasti/bricks';
function UntitledSection() {
return (
<div style={{ maxWidth: 440 }}>
<Card>
<SummarySection>
<SummaryLine label="Brand" value="Glow Lab" />
<SummaryLine label="Dates" value="1 Dec → 31 Dec" />
<SummaryLine label="Per winner" amount="1000.00" figure="challenge_commission" hint="each" />
</SummarySection>
</Card>
</div>
);
}A launch that failed
error with onRetry: a red alert with Try again above the actions (true: "Couldn’t launch the challenge.").
Code (not run)
import { ChallengeSummary } from '@ergasti/bricks';
import { brands } from './pr';
function LaunchFailed() {
return (
<div style={{ maxWidth: 440 }}>
<ChallengeSummary layout="flat" flatDensity="mock" name="Winter top 10" brand={brands.glow} status="upcoming" dates="1 Dec → 31 Dec" goal="Top 10 by sales" eligibility={{ audience: 'public' }}
rewards={[{ key: 'per', label: 'Reward', amount: '1000.00', figure: 'challenge_commission', hint: 'each', inlineHint: true }]} budget={{ hold: '10000.00', available: '43390.00' }}
onPrimary={() => {}} onSaveDraft={() => {}} error onRetry={() => {}} money={{ decimals: 'auto' }} />
</div>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prChallengeSummary, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
summary | Summary | الملخص |
edit | Edit | عدّل |
editStep | Edit {s} | عدّل {s} |
basics | Basics | الأساسيات |
brand | Brand | البراند |
name | Name | الاسم |
dates | Dates | التواريخ |
goal | Type | النوع |
join | Who can join | مين يقدر يشترك |
reward | Reward | الجايزة |
gifts | Gifts | الهدايا |
budget | Budget | الميزانية |
public | Public: any approved creator | عام: أي صانع محتوى متقبل |
affiliates | {b} affiliates only | المشتركين في {b} بس |
groups | Groups | المجموعات |
tiers | Tiers | المستويات |
niches | Niches | المجالات |
anyone | Anyone | أي حد |
stock | {n} left | فاضل {n} |
noStock | No gifts left | مفيش هدايا فاضلة |
short | {left} left, {need} needed | فاضل {left} ومحتاجين {need} |
hold | Budget to hold | الميزانية اللي هتتحجز |
has | {b} has | اللي عند {b} |
after | Left after hold | الباقي بعد الحجز |
used | {p}% of the wallet | {p}% من المحفظة |
checks | Before you launch | قبل ما تطلق التحدي |
allGood | Everything checks out. | كله تمام. |
blocking | must be fixed | لازم يتصلّح |
unnamed | — | — |
sep | , | ، |
launch | Launch challenge | اطلق التحدي |
approve | Approve and launch | وافق واطلق |
draft | Save as draft | احفظ كمسودة |
reject | Reject request | ارفض الطلب |
working | Working… | لحظة… |
publicShort | Public | عام |
affiliatesShort | Brand affiliates | المشتركين في البراند |
paidBy | Paid by | بيدفع |
trndr | TRNDR | TRNDR |
trndrBudget | TRNDR budget | ميزانية TRNDR |
noHold | Nothing is held from brand wallets. | مفيش حاجة بتتحجز من محافظ البراندات. |
shortWallet | Not enough in the wallet. We only launch when the full budget can be held. | الفلوس اللي في المحفظة مش كفاية. مبنطلقش التحدي غير لما الميزانية كلها تتحجز. |
askTopUp | Ask {b} to top up | اطلب من {b} يشحن |
paused | {b}’s program is paused. | برنامج {b} متوقف. |
error | Couldn’t launch the challenge. | مقدرناش نطلق التحدي. |
retry | Try again | جرّب تاني |
Design guidance
How the BRICKS design system uses ChallengeSummary. Written in docs/content/components/ChallengeSummary.md; the props above are read from the code, which wins where the two disagree.
The challenge builder's review card: name and brand, dates and type, who can join, the reward lines, gifts with their stock, the budget to hold against the brand's wallet, the launch checks and the Launch / Approve actions; use it beside every builder step (layout="flat") and as the builder's last step.
It is the PR mock's sticky #sum card grown into a full review. Each section links back to its builder step ("Edit"). Nothing is computed except "Left after hold" (available − hold, both server strings). Launch is disabled when a warning is blocking, the program is paused, the wallet cannot hold the budget, or a gift has no confirmed stock (or fewer units than winners).
Anatomy
Sections layout (default):
- Head: "Summary" (
h2) and aPrStatusPill. - Basics (Brand with its square, Name, Dates), Type, Who can join (public or the brand's affiliates; groups, tiers, niches), Reward (lines and gifts): each a
SummarySectionwith an "Edit" link. - Budget: Budget to hold, "{brand} has", a bar (lime, raspberry when short) and "Left after hold" (red when negative).
- Notices: paused program (warn) or short wallet (bad, with "Ask {brand} to top up").
- Before you launch: "Everything checks out." or warning lines (links to their step; blocking ones say "must be fixed" to screen readers).
- Actions: raspberry "Launch challenge" / "Approve and launch", ghost "Save as draft", ghost "Reject request" (approve mode).
Flat layout: one plain list (Brand, Name, Dates, Type, Who can join, rewards, gifts), a rule, the budget and bar, warnings as coloured lines, then the actions.
Variants
| Prop | Value | Effect |
|---|---|---|
layout | 'sections' (default) / 'flat' | Full review with Edit links / the mock's sticky card. |
flatDensity | 'default' / 'mock' | Flat spacing: 6px under heading, 12.5px warnings, 48px button / the mock's 16px, 12px, 46px. |
mode | 'launch' (default) / 'approve' | "Launch challenge" / "Approve and launch" + "Reject request". |
payer | 'brand' (default) / 'trndr' | Brand wallet hold / "Paid by TRNDR", TRNDR budget, "Nothing is held from brand wallets." |
paused | true | Warning "{brand}'s program is paused." and no launch. |
States
| State | How |
|---|---|
| Ready | No blocking problem: primary enabled. |
| Warnings | warnings (tone: 'warn' or 'bad'; step makes it a link). |
| Cannot submit | Any bad warning, paused, short wallet, short gifts; or canSubmit={false}. |
| Short wallet | budget.available < budget.hold: bad note, raspberry bar, negative "Left after hold"; onAskTopUp adds the button. |
| Pending | pending: "Working…", actions disabled, aria-busy. |
| No wallet known | budget.available omitted: no bar or "Left after hold". |
Types
StackBrand (brand): { id, name, color? }. SummaryGift (gifts): { id, name, left, needed? }. SummaryWarning (warnings): { id, text, tone?: 'warn' | 'bad', step? }.
Usage
import { ChallengeSummary } from '@ergasti/bricks';
const glow = { id: 'glow', name: 'Glow Lab', color: '#C2185B' };
export function BuilderReview({ onEdit, onLaunch, onDraft }: { onEdit: (step: string) => void; onLaunch: () => void; onDraft: () => void }) {
return (
<ChallengeSummary
name="Winter top 10"
brand={glow}
status="upcoming"
dates="1 Dec → 31 Dec"
goal="Top 10 by sales"
eligibility={{ audience: 'public', tiers: ['established', 'elite'], niches: ['Beauty', 'Skincare'] }}
rewards={[{ key: 'per', label: 'Per winner', amount: '1000.00', figure: 'challenge_commission', hint: 'each' }]}
gifts={[{ id: 1, name: 'Glow serum set', left: 4, needed: 10 }]}
budget={{ hold: '10000.00', available: '43390.00' }}
warnings={[{ id: 'gift', text: 'Only 4 gift sets left for 10 winners.', step: 'reward' }]}
steps={{ basics: 'Basics', goal: 'Type', join: 'Who can join', reward: 'Reward' }}
onEditStep={onEdit}
onPrimary={onLaunch}
onSaveDraft={onDraft}
/>
);
}import { ChallengeSummary } from '@ergasti/bricks';
// The sticky card beside each builder step, a TRNDR-wide challenge
export function StickySummary({ onLaunch }: { onLaunch: () => void }) {
return (
<ChallengeSummary
layout="flat"
flatDensity="mock"
payer="trndr"
name="Double commission week"
brand={{ id: 'all', name: 'All brands' }}
dates="1 Dec → 7 Dec"
goal="Every delivered sale"
eligibility={{ audience: 'public' }}
rewards={[{ key: 'x2', label: 'Commission', value: '×2' }]}
budget={{ hold: '25000.00' }}
onPrimary={onLaunch}
/>
);
}Where it appears
- PR Portal › Challenge builder › the sticky summary beside each step (flat) and the review. Screens: PR · Challenge builder, PR · Challenge builder · Reward.
- PR Portal › a brand's request, approve mode. Screen: PR · Brand request.
Guidelines
Do
- Pass server figures; let the card compute only "Left after hold".
- Give every fixable warning a
step, so it links back. - Use
badonly for problems that must block launch.
Don't
- Don't enable Launch by
canSubmitwhen the wallet is short; the platform will refuse it. - Don't add more actions than launch, draft and reject.
RTL and Arabic
- Labels right, values left; dates and names use
dir="auto". "الملخص", "اطلق التحدي", "وافق واطلق", "احفظ كمسودة".
Tokens
--track, --chart-lime, --rasp, --bad, --ink-3; card, pill and button tokens.
Accessibility
- A labelled
<section>; each part is a labelled section with anh3; lines are<dl>rows. - The budget bar is
role="img"named "21% of the wallet"; notices arerole="status". - Blocking warnings add "(must be fixed)" for screen readers; Edit links are named "Edit Basics", etc.
Found in the source
- Roles in the markup:
status,img,group. - ARIA attributes set:
aria-labelledby,aria-label,aria-busy.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
SummarySection,SummaryLine: its parts, for other summary cards.ChallengeGiftPicker,BrandRequestCard,ReasonDialog.
See also: Button · Money · MoneyNote · useBricks · useLanguage · BrandAvatar · PrIcon · PrStatusPill · Card · BuilderStepCard · ChallengeAudienceFields
Source
src/pr/challenges/ChallengeSummary.tsx (line 216) on GitHub.