CampaignChangeRequests
The campaign page's "Change requests from {brand}" card (the v3 mock's CREQ list, cqDo): the count waiting in the header; per request what changes, the old value struck through → the new one in bold, the date and the brand's quote; Decline / Approve while it waits, the Approved / Declined pill once decided; the footnote on what each does. Each button names its request ("Approve: Discount per coupon").
import { CampaignChangeRequests } from '@ergasti/bricks';Examples
Change requests
Old value struck through, the new one in bold; Decline / Approve until decided, then the pill.
Code
import { useState } from 'react';
import { CampaignChangeRequests, type CampaignChangeRequest } from '@ergasti/bricks';
function Requests() {
const [requests, setRequests] = useState<CampaignChangeRequest[]>([
{ id: 'cq1', what: 'Discount per coupon', from: '10% off', to: '15% off', date: '14 Nov', quote: 'Black Friday week', status: 'waiting' },
{ id: 'cq3', what: 'Creator limit', from: '300 seats', to: '400 seats', date: '2 Nov', status: 'approved' },
]);
const decide = (r: CampaignChangeRequest, status: CampaignChangeRequest['status']) => setRequests((all) => all.map((x) => (x.id === r.id ? { ...x, status } : x)));
return <CampaignChangeRequests brandName="Glow Lab" requests={requests} onApprove={(r) => decide(r, 'approved')} onDecline={(r) => decide(r, 'declined')} />;
}A decision that failed
error with onRetry: a red alert with Try again at the top of the card.
Code (not run)
import { CampaignChangeRequests } from '@ergasti/bricks';
function Failed() {
return <CampaignChangeRequests brandName="Glow Lab" requests={[{ id: 'cq1', what: 'Discount per coupon', from: '10% off', to: '15% off', date: '14 Nov', status: 'waiting' }]} onApprove={() => {}} onDecline={() => {}} error onRetry={() => {}} />;
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prChangeRequests, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
title | Change requests from {brand} | طلبات التغيير من {brand} |
waiting | {n} waiting | {n} مستنيين |
none | No requests. | مفيش طلبات. |
was | Was | كان |
now | Now | دلوقتي |
quote | “{text2}” | «{text2}» |
decline | Decline | ارفض |
approve | Approve | وافق |
declineName | Decline: {what} | ارفض: {what} |
approveName | Approve: {what} | وافق: {what} |
footnote | Approving applies the change to orders placed from now on. Declining asks for a reason the brand sees. | الموافقة بتطبّق التغيير على الطلبات اللي تتعمل من دلوقتي. الرفض بيطلب سبب البراند هيشوفه. |
error | Couldn’t save that decision. | مقدرناش نحفظ القرار ده. |
retry | Try again | جرّب تاني |
Design guidance
How the BRICKS design system uses CampaignChangeRequests. Written in docs/content/components/CampaignChangeRequests.md; the props above are read from the code, which wins where the two disagree.
The campaign page's "Change requests from {brand}" card: each change the brand asked for, old value struck through and new value in bold, the date and the brand's note, with Decline / Approve; use it on the PR campaign page.
CampaignChangeRequests is the v3 mock's CREQ list and cqDo. The header says how many wait. Approving applies the change to orders placed from now on; declining asks for a reason the brand sees (the app opens a ReasonDialog). Decided requests keep their facts and show an Approved or Declined pill. Each button names its request for screen readers ("Approve: Discount per coupon").
Anatomy
- Card:
<section class="kit-card kit-pr-creq">withh2"Change requests from Glow Lab" and "1 waiting". - Rows: "Discount per coupon:
10% off→ 15% off" (hidden "Was:" / "Now:"), a mirrored arrow; muted "14 Nov · "Black Friday week""; at the end Decline (default) and Approve (ink), or the decision pill. - Empty: "No requests."
- Footnote: "Approving applies the change to orders placed from now on. Declining asks for a reason the brand sees."
Variants
Request status | End of row |
|---|---|
waiting | Decline / Approve |
approved | request_approved pill (green) |
declined | request_declined pill (red) |
States
| State | Trigger |
|---|---|
| Saving one | busy(request) true: its buttons disabled |
| Empty | no requests |
Types
CampaignChangeRequest (requests): { id, what, from, to, date, quote?, status: 'waiting' | 'approved' | 'declined' }.
Usage
import { useState } from 'react';
import { CampaignChangeRequests, type CampaignChangeRequest } from '@ergasti/bricks';
export function Requests() {
const [requests, setRequests] = useState<CampaignChangeRequest[]>([
{ id: 'cq1', what: 'Discount per coupon', from: '10% off', to: '15% off', date: '14 Nov', quote: 'Black Friday week', status: 'waiting' },
{ id: 'cq3', what: 'Creator limit', from: '300 seats', to: '400 seats', date: '2 Nov', status: 'approved' },
]);
const decide = (r: CampaignChangeRequest, status: CampaignChangeRequest['status']) => setRequests((all) => all.map((x) => (x.id === r.id ? { ...x, status } : x)));
return <CampaignChangeRequests brandName="Glow Lab" requests={requests} onApprove={(r) => decide(r, 'approved')} onDecline={(r) => decide(r, 'declined')} />;
}// Decline through the reason dialog
<CampaignChangeRequests brandName="Glow Lab" requests={requests} onApprove={approve} onDecline={setDeclining} busy={(r) => r.id === savingId} />
<ReasonDialog open={declining != null} onClose={() => setDeclining(null)} title={`Decline: ${declining?.what}?`}
mode="text" confirmLabel="Decline" onConfirm={({ reason }) => decline(declining!, reason)} />Where it appears
- PR Portal › Affiliate programs › Campaigns › a campaign's page › "Change requests from Glow Lab".
- Dashboard screen: PrPrograms.
Guidelines
Do
- Always collect a decline reason; the brand sees it.
- Keep decided requests visible for context until the campaign ends.
Don't
- Don't apply a change retroactively; the footnote promises "from now on".
RTL and Arabic
Rows mirror and the arrow flips (kit-pr-flip). Arabic: "طلبات التغيير من {brand}", "{n} مستنيين", "ارفض" / "وافق", quotes «…».
Tokens
--ink, --line, card and pill tokens.
Accessibility
Labelled section; old and new values are <del> and bold with hidden "Was:" / "Now:"; buttons carry the request's name; the arrow is decorative.
Found in the source
- ARIA attributes set:
aria-labelledby,aria-hidden,aria-label. - Its tests cover: “a labelled card: the count waiting, old struck → new, date and quote, the footnote”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
ReasonDialog: the decline reason.NextCampaignCard: the brand's next-campaign request.ChangePreview: old → new for PR's own edits.
See also: Button · useLanguage · PrIcon · PrStatusPill · AffiliateProgramCard · CampaignChallenges · CommissionChangeForm · CustomerAffiliatesCard
Source
src/pr/programs/CampaignChangeRequests.tsx (line 84) on GitHub.