ScheduleCampaignDialog
"Schedule {campaign}?" (the v3 mock's nextDo(…, 1) / doSched): the dates and suggested commission, a banner with the brand's customer rate now, and the customer rate for the new campaign (above 0, below the creator rate; checked when Schedule is pressed and said under the field). On the kit Modal.
import { ScheduleCampaignDialog } from '@ergasti/bricks';Examples
Next campaign
The brand's request with Decline / Schedule it; scheduling asks for the customer rate of the new campaign.
Code
import { useState } from 'react';
import { NextCampaignCard, ScheduleCampaignDialog, type NextCampaign } from '@ergasti/bricks';
function Next() {
const [next, setNext] = useState<NextCampaign>({ name: 'Ramadan 2027', from: '1 Feb 2027', to: '31 Mar 2027', commission: '18% of sale', status: 'waiting' });
const [open, setOpen] = useState(false);
return (
<div style={{ maxWidth: 520 }}>
<NextCampaignCard next={next} currentName="Winter glow 2026" onDecline={() => setNext({ ...next, status: 'declined' })} onSchedule={() => setOpen(true)} />
<ScheduleCampaignDialog open={open} onClose={() => setOpen(false)} onConfirm={() => { setNext({ ...next, status: 'scheduled' }); setOpen(false); }} next={next}
brandName="Glow Lab" customerRate="6" customerRateLabel="6% of sale" creatorRate="10" creatorRateLabel="10% of sale" />
</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 prNextCampaign, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
title | Next campaign | الحملة الجاية |
name | Name | الاسم |
dates | Dates | التواريخ |
commission | Suggested commission | العمولة المقترحة |
range | {from} → {to} | {from} ← {to} |
decline | Decline | ارفض |
schedule | Schedule it | جدولها |
note | It starts the day after {current} ends. Two campaigns never run at once. | بتبدأ تاني يوم بعد ما {current} تخلص. مفيش حملتين بيشتغلوا مع بعض. |
none | Nothing requested. The brand can request one from its Campaign page. | مفيش حاجة متطلبة. البراند يقدر يطلب حملة من صفحة الحملة بتاعته. |
dialogTitle | Schedule {name}? | تجدول {name}؟ |
dialogSub | [object Object] | [object Object] |
rateLead | Customer rate: | عمولة العملاء: |
rateNow | [object Object] | [object Object] |
rateLabel | Customer rate for {name} | عمولة العملاء في {name} |
rateHint | [object Object] | [object Object] |
errInvalid | Enter a rate above 0. | اكتب عمولة أكبر من صفر. |
errNotBelow | [object Object] | [object Object] |
cancel | Cancel | إلغاء |
confirm | Schedule | جدولها |
Design guidance
How the BRICKS design system uses ScheduleCampaignDialog. Written in docs/content/components/ScheduleCampaignDialog.md; the props above are read from the code, which wins where the two disagree.
The "Schedule {campaign}?" confirmation dialog that sets the customer rate for a brand's requested next campaign; open it from NextCampaignCard's "Schedule it".
It is the PR Portal's campaign page modal (mock nextDo(…, 1) / doSched): the requested dates and suggested commission in the header, an info banner with the brand's customer rate now, and one field for the customer rate of the new campaign, prefilled so keeping it is one click. The rate must be above 0 and below the brand's creator rate; the dialog checks it with customerRateIssue when Schedule is pressed. Built on the kit Modal.
Anatomy
- Scrim (
.kit-scrim--modal): click closes; hidden from assistive tech. - Dialog (
.kit-modal,role="dialog",aria-modal): centred, up to 660px wide, max 92vh. - Header (
.kit-dlg-h): title<h2>"Schedule Ramadan 2027?", hint "1 Feb 2027 → 31 Mar 2027 · suggested commission 18% of sale.", round close "×". - Body (
.kit-pr-reason):- Banner (
Banner tone="info" icon="alert"): "Customer rate: Glow Lab's customers earn 6% of sale now. Keep it, or set a new rate for this campaign." - Rate field (
FormField): label "Customer rate for Ramadan 2027",<input inputMode="decimal" dir="ltr">, hint "Above 0 and below the creator rate (10% of sale). Applies to every Glow Lab customer from 1 Feb 2027.", error under it.
- Banner (
- Footer (
.kit-dlg-f): optionalerroralert at the start, Cancel, Schedule (variant="ink").
Variants
None: one layout. The commission and rate labels are whatever the app formats ("18% of sale", "EGP 50.00 per sale").
States
| State | Trigger | Look |
|---|---|---|
| Open, default | open | Field holds customerRate; no error. |
| Reopened | open turns true again, or customerRate changes while open | Field resets to customerRate; errors clear. |
| Invalid rate | Schedule pressed with an empty, non-numeric, 0 or negative rate, or more than 2 decimals | "Enter a rate above 0." under the field; onConfirm not called. |
| Not below creator rate | Schedule pressed with a rate ≥ creatorRate | "It must be below the creator rate (10% of sale)." |
| Saving | busy | Schedule disabled (Cancel stays enabled). |
| Save failed | error | Alert text at the start of the footer. |
| Closed | open={false} | Nothing rendered. |
Arabic-Indic digits are accepted; onConfirm receives ASCII digits ("٦" → "6").
Types
NextCampaign (next), the requested campaign: name, from, to, commission, status.
Usage
// PR Portal › Affiliate programs › Campaigns › Glow Lab's campaign page: the card and its dialog
const NEXT: NextCampaign = { name: 'Ramadan 2027', from: '1 Feb 2027', to: '31 Mar 2027', commission: '18% of sale', status: 'waiting' };
function NextCampaignBlock({ onDecline }: { onDecline: () => void }) {
const [next, setNext] = useState(NEXT);
const [scheduling, setScheduling] = useState(false);
return (
<>
<NextCampaignCard next={next} currentName="Winter glow 2026" onDecline={onDecline} onSchedule={() => setScheduling(true)} />
<ScheduleCampaignDialog
open={scheduling}
onClose={() => setScheduling(false)}
onConfirm={() => { setNext({ ...next, status: 'scheduled' }); setScheduling(false); }}
next={next}
brandName="Glow Lab"
customerRate="6"
customerRateLabel="6% of sale"
creatorRate="10"
creatorRateLabel="10% of sale"
/>
</>
);
}// A fixed-amount brand (EGP per sale), with a server error
<ScheduleCampaignDialog open onClose={close} onConfirm={save} next={next} brandName="Nile Threads"
customerRate="30" customerRateLabel="EGP 30.00 per sale" creatorRate="50" creatorRateLabel="EGP 50.00 per sale"
busy={saving} error={failed ? "We couldn't schedule this campaign. Try again." : undefined} />Where it appears
- PR Portal › Affiliate programs › Campaigns › a brand's campaign page › "Next campaign" card › "Schedule it" (mock
P.program,nextDo/doSched). Gallery screenprograms-campaign; screen PR · Affiliate programs shows the Campaigns list.
Guidelines
Do
- Pass
customerRateandcreatorRatein the same unit as plain decimal strings; pass the labels already formatted. - Close it and toast "<name> scheduled" on success, as the mock does; log the change.
- Use
ReasonDialogfor Decline: this dialog only schedules.
Don't
- Don't pre-validate and disable Schedule: the rule is checked on press and explained under the field.
- Don't parse
onConfirm's rate as a float for money logic; it is a decimal string. - Don't open it for a request that is not
waiting.
RTL and Arabic
- The dialog mirrors; the date range uses "←" in Arabic ("1 فبراير 2027 ← 31 مارس 2027").
- The input is
dir="ltr"withinputMode="decimal"; Arabic-Indic digits are accepted and converted. - Arabic copy: "تجدول <name>؟", "عمولة العملاء:", "إلغاء", "جدولها".
Tokens
--card, --ink, --ink-3, --line, --bad, --rasp, --sky, --sky-ink, --focus-ring, --modal-w, --modal-pad, --field-h, --field-radius.
Accessibility
role="dialog",aria-modal="true", named by its<h2>title. Focus moves in on open, Tab is trapped, Escape closes, focus returns to the opener.- While open, everything outside is inert and
aria-hidden(or only the subtree of theinertRefyou pass, as on the other PR dialogs). - The rate field's hint and error are tied by
aria-describedby;aria-invalidis set with the error. The footer error is a<p role="alert">that mounts with its text; most, not all, screen readers read it on insertion. - The close × is a button named "Close" (36px; 44px at 1024px and below); the scrim is
aria-hiddenand out of the tab order.
Found in the source
- Roles in the markup:
alert. - ARIA attributes set:
aria-labelledby.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
NextCampaignCard: the card whose "Schedule it" opens this.ReasonDialog: the Decline path (a reason the brand sees).CustomerAffiliatesCard: edits the brand's current customer rate with the same rule (customerRateIssue).Modal: the kit dialog it is built on.
See also: Banner · Button · FormField · useLanguage · PrStatusPill · AffiliateProgramCard · CampaignChallenges · CampaignChangeRequests · CommissionChangeForm
Source
src/pr/programs/NextCampaignCard.tsx (line 145) on GitHub.