Skip to Content
BBRICKSv0.7.4
PR PortalCampaigns

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.

prChangeRequests
KeyEnglishArabic
titleChange requests from {brand}طلبات التغيير من {brand}
waiting{n} waiting{n} مستنيين
noneNo requests.مفيش طلبات.
wasWasكان
nowNowدلوقتي
quote“{text2}”«{text2}»
declineDeclineارفض
approveApproveوافق
declineNameDecline: {what}ارفض: {what}
approveNameApprove: {what}وافق: {what}
footnoteApproving applies the change to orders placed from now on. Declining asks for a reason the brand sees.الموافقة بتطبّق التغيير على الطلبات اللي تتعمل من دلوقتي. الرفض بيطلب سبب البراند هيشوفه.
errorCouldn’t save that decision.مقدرناش نحفظ القرار ده.
retryTry 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

  1. Card: <section class="kit-card kit-pr-creq"> with h2 "Change requests from Glow Lab" and "1 waiting".
  2. 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.
  3. Empty: "No requests."
  4. Footnote: "Approving applies the change to orders placed from now on. Declining asks for a reason the brand sees."

Variants

Request statusEnd of row
waitingDecline / Approve
approvedrequest_approved pill (green)
declinedrequest_declined pill (red)

States

StateTrigger
Saving onebusy(request) true: its buttons disabled
Emptyno 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.

See also: Button · useLanguage · PrIcon · PrStatusPill · AffiliateProgramCard · CampaignChallenges · CommissionChangeForm · CustomerAffiliatesCard

Source

src/pr/programs/CampaignChangeRequests.tsx (line 84) on GitHub.

On this page