ChallengeDetail
The challenge drawer's body: a tinted head (title, dates, status), TRNDR's reason or the waiting note, the figures, gifts and days progress, the top creators (ranked, each opens) and the actions for its status.
import { ChallengeDetail } from '@ergasti/bricks';Examples
Challenge drawer body
The figures, the top creators and the actions for a live challenge. The status word comes from the TRNDR preset.
Code
import { ChallengeDetail } from '@ergasti/bricks';
import { blocksData } from './sample-data';
import { useLanguage } from '@ergasti/bricks';
function Live() {
const language = useLanguage();
const c = blocksData.CHALLENGES[0];
return (
<div style={{ maxWidth: 400 }}>
<ChallengeDetail
title={c.title} status="live" tone="rasp" dates={c.dates} commissionLabel={c.comm[language]} creators={42} sales="184300.00" commissionPaid="27645.00"
gifts={c.gifts} days={c.days} topCreators={blocksData.CHALLENGE_TOP} onOpenCreator={() => {}} onAction={() => {}} onOpenAnalytics={() => {}}
/>
</div>
);
}A rejected request
The reason from TRNDR leads and the action is "Edit and resend". The status word comes from the TRNDR preset.
Code
import { ChallengeDetail } from '@ergasti/bricks';
import { blocksData } from './sample-data';
import { useLanguage } from '@ergasti/bricks';
function Rejected() {
const language = useLanguage();
const c = blocksData.CHALLENGES[3];
return (
<div style={{ maxWidth: 400 }}>
<ChallengeDetail title={c.title} status="rejected" tone="lilac" dates="—" commissionLabel={c.comm[language]} reason={c.reason?.[language]} creators={0} sales="0.00" commissionPaid="0.00" onAction={() => {}} />
</div>
);
}A request waiting for TRNDR
sentOn says when the request went in; with no days and no gifts those rows are left out. challengeLabels overrides the words shared with the challenge card.
Code
import { ChallengeDetail } from '@ergasti/bricks';
import { blocksData } from './sample-data';
import { useLanguage } from '@ergasti/bricks';
function Pending() {
const language = useLanguage();
const c = blocksData.CHALLENGES[0];
return (
<div style={{ maxWidth: 400 }}>
<ChallengeDetail title="Ramadan preview" status="waiting" tone="butter" dates="1 Mar – 30 Mar" commissionLabel={c.comm[language]} sentOn="12 Nov 2026" creators={0} sales="0.00" commissionPaid="0.00" onAction={() => {}} challengeLabels={{ waitingDrawer: (date) => `Sent to TRNDR on ${date}. They usually reply within 2 days.` }} />
</div>
);
}A scheduled challenge's drawer
"Scheduled" in the head, no banner and no status action; "See in analytics" once creators joined.
Code
import { ChallengeDetail } from '@ergasti/bricks';
import { blocksData } from './sample-data';
function Scheduled() {
const c = blocksData.CHALLENGES[0];
return (
<div style={{ maxWidth: 400 }}>
<ChallengeDetail title={c.title} status="scheduled" tone="lime" dates={c.dates} commissionLabel="15% of sale" creators={0} sales="0.00" commissionPaid="0.00" gifts={{ taken: 0, total: 100 }} days={{ current: 0, total: 30 }} />
</div>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the keys challengeDetail, challengeCard, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
commission | Commission | العمولة |
joined | Creators joined | صنّاع المحتوى اللي اشتركوا |
sales | Sales | المبيعات |
paid | Commission paid | العمولة المدفوعة |
progress | Progress | التقدّم |
top | Top creators in this challenge | أحسن صنّاع محتوى في التحدي |
analytics | See in analytics | شوفه في التحليلات |
| Key | English | Arabic |
|---|---|---|
reasonLead | Reason from TRNDR: | السبب من TRNDR: |
waiting | Sent {d}. You'll be told when it's approved or changed. | اتبعت {d}. هنبلّغك لما يتوافق عليه أو يتعدّل. |
waitingDrawer | Sent {d}. The TRNDR team reviews it and sets the dates. | اتبعت {d}. فريق TRNDR هيراجعه ويحدد المواعيد. |
gifts | Gifts taken | الهدايا اللي اتاخدت |
days | Days | الأيام |
creators | Creators | صنّاع المحتوى |
sales | Sales | المبيعات |
commission | Commission | العمولة |
action.live | Request a change | اطلب تعديل |
action.waiting | Edit request | عدّل الطلب |
action.rejected | Edit and resend | عدّل وابعت تاني |
Design guidance
How the BRICKS design system uses ChallengeDetail. Written in docs/content/components/ChallengeDetail.md; the props above are read from the code, which wins where the two disagree.
The challenge drawer's body: a tinted head (title, dates, status), TRNDR's reason or the waiting note, the figures, gifts and days progress, the top creators (ranked, each opens) and the actions for its status; open it from a ChallengeCard.
It is the mock's openChallenge() drawer on Brand › Motivation. Money comes as 2-dp strings and shows compact ("EGP 27.6K"). Progress rows appear only when there are gifts (total > 0) or dates (more than one day); top creators appear only once someone joined. Pass the drawer's title hidden (Drawer hideTitle) so it is not drawn twice.
Anatomy
- Head:
DrawerHeadintone: title; sub "1 Nov → 30 Nov 2026 ·StatusPill". - Banner: rejected → warn "Reason from TRNDR: …"; waiting → info "Sent 12 Nov 2026. The TRNDR team reviews it and sets the dates."
- Figures:
KeyValue: Commission, Creators joined, Sales (challenge_sales), Commission paid (challenge_commission). - Progress: h3 + Gifts taken / Days
ProgressRows. - Top creators: h3 "Top creators in this challenge" with the
creator_sales"?",RankList(medals, each opens the creator). - Actions: rasp state action ("Request a change", "Edit request", "Edit and resend") and "See in analytics".
Variants
status | Banner | Action |
|---|---|---|
live | — | Request a change |
waiting | sent note | Edit request |
rejected | reason | Edit and resend |
ended / closed | — | none (pill "Ended") |
scheduled / paused | — | only with challengeLabels.action |
money.figures / money.topCreators set display (both compact by default).
States
| State | Trigger |
|---|---|
| No gifts / no dates | gifts omitted or total 0; days omitted or total ≤ 1: rows hidden. |
| Nobody joined | creators: 0: no top creators, no analytics button. |
| Openable creators | onOpenCreator. |
Usage
<Drawer open={!!ch} onClose={close} title={ch.title} hideTitle>
<ChallengeDetail title="Winter glow launch" status="live" tone="rasp" dates="1 Nov → 30 Nov 2026" commissionLabel="15% of sale"
creators={42} sales="184300.00" commissionPaid="27645.00"
gifts={{ taken: 68, total: 100 }} days={{ current: 13, total: 30 }}
topCreators={[{ person: { id: 9, name: 'Tarek Fathy' }, sales: '61600.00' }, { person: { id: 2, name: 'Salma Hosny' }, sales: '39360.00' }]}
onOpenCreator={openCreator} onAction={requestChange} onOpenAnalytics={() => navigate('/analytics?challenge=winter')} />
</Drawer>Where it appears
- Brand › Motivation › Challenges › challenge drawer (
openChallenge()) (BrandMotivation).
Guidelines
Do
- Use the same
toneas the card. - Hide the drawer's own title (
hideTitle); the head shows it.
Don't
- Don't send zero-total gifts to force a row; omit
gifts.
RTL and Arabic
- Mirrors; money LTR. Arabic: "أحسن صنّاع محتوى في التحدي", "العمولة المدفوعة", "شوفه في التحليلات".
Tokens
DrawerHead tone pairs; Banner, KeyValue, ProgressRow, RankList tokens.
Accessibility
- Sections have h3s;
RankListis a named list; banners are status messages; money keeps its "?".
Found in the source
- No roles, ARIA attributes or key handling are set in this component's own source; it renders native elements and the components it composes.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
See also: Banner · KeyValue · RankList · Button · MoneyNote · Money · StatusPill · DrawerHead · ProgressRow · useLanguage · useMoneyDisplay · BonusCard
Source
src/blocks/motivation/ChallengeDetail.tsx (line 74) on GitHub.