TierChangeDialog
The PR mock's "Change {name}'s tier" (v3 changeTier): what the tier is now and where it comes from (set by PR, or from the score with the score), a select of the tiers, led by "Follow the score (Established)" when PR set the tier by hand, and a required reason the creator sees. Save without a reason marks the field and says why (ReasonDialog's rule). On the kit Modal.
import { TierChangeDialog } from '@ergasti/bricks';Examples
Change a tier
A tier set by hand stays until PR picks "Follow the score" again; the reason is required and the creator sees it.
Code
import { useState } from 'react';
import { Button, TierChangeDialog } from '@ergasti/bricks';
function ChangeTier() {
const [open, setOpen] = useState(false);
const [last, setLast] = useState('');
return (
<>
<Button onClick={() => setOpen(true)}>Change Ali Tarek’s tier</Button> <small>{last}</small>
<TierChangeDialog open={open} onClose={() => setOpen(false)} onSave={(r) => { setLast(`${r.tier}: ${r.reason}`); setOpen(false); }}
name="Ali Tarek" tier="rising" source="manual" score={46} scoreTier="established" tiers={['rising', 'established', 'influential', 'elite']} />
</>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prTierChange, 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 {n}’s tier | غيّر مستوى {n} |
now | Now | دلوقتي |
manual | Set by PR. | حدده الـ PR. |
fromScore | From the score ({s}). | من التقييم ({s}). |
stays | A tier set by hand stays until you choose “Follow the score” again. | المستوى اللي بيتحدد بالإيد بيفضل لحد ما تختار «امشي مع التقييم» تاني. |
tier | New tier | المستوى الجديد |
follow | Follow the score ({t}) | امشي مع التقييم ({t}) |
reason | Reason | السبب |
reasonHint | Required · the creator sees it | لازم · صانع المحتوى هيشوفه |
reasonErr | Write a reason. The creator sees it. | اكتب السبب. صانع المحتوى هيشوفه. |
cancel | Cancel | إلغاء |
save | Save | احفظ |
saving | Saving… | بنحفظ… |
Design guidance
How the BRICKS design system uses TierChangeDialog. Written in docs/content/components/TierChangeDialog.md; the props above are read from the code, which wins where the two disagree.
The "Change {name}'s tier" modal: the tier now and where it comes from, a select of tiers led by "Follow the score" for a hand-set tier, and a required reason the creator sees; use it from the creator drawer or the Tiers screen.
TierChangeDialog is the v3 mock's changeTier (it replaces ReasonDialog mode="text" for tiers). A tier set by hand stays until PR picks "Follow the score (Established)" again, so the dialog says where the current tier comes from (set by PR, or from the score with the score). Saving without a reason marks the field and says why, as ReasonDialog does; choosing the tier the creator already has simply closes.
Anatomy
- Modal: kit Modal titled "Change Ali Tarek's tier".
- Now line: "Now Rising. Set by PR. A tier set by hand stays until you choose "Follow the score" again." (or "From the score (62).").
- New tier: a select of
tiers(names from the provider), led by "Follow the score (Established)" when the tier is manual and a score tier exists. - Reason: required input, placeholder "Required · the creator sees it", max 300.
- Footer: error alert, Cancel, ink Save ("Saving…").
Variants
source | Now line | First option |
|---|---|---|
manual (+ score, scoreTier) | "Set by PR." | Follow the score (Established) |
manual, no score | "Set by PR." | tiers only |
score | "From the score (62)." | tiers only |
States
| State | Trigger |
|---|---|
| Fresh | each open: choice = current tier, empty reason |
| Same tier | Save closes without onSave |
| Missing reason | "Write a reason. The creator sees it." |
| Busy | busy: Save disabled, "Saving…", aria-busy |
| Error | error: footer alert |
Types
TierChangeResult (onSave): { tier: key | 'follow_score', reason }.
Usage
import { useState } from 'react';
import { Button, TierChangeDialog } from '@ergasti/bricks';
export function ChangeTier() {
const [open, setOpen] = useState(false);
const [last, setLast] = useState('');
return (
<>
<Button onClick={() => setOpen(true)}>Change Ali Tarek’s tier</Button> <small>{last}</small>
<TierChangeDialog open={open} onClose={() => setOpen(false)} onSave={(r) => { setLast(`${r.tier}: ${r.reason}`); setOpen(false); }}
name="Ali Tarek" tier="rising" source="manual" score={46} scoreTier="established" tiers={['rising', 'established', 'influential', 'elite']} />
</>
);
}// From the creator drawer's "Change" link
<PrCreatorDrawer open creator={creator} onClose={close} onChangeTier={() => setChanging(true)} />
<TierChangeDialog open={changing} onClose={() => setChanging(false)} name={creator.name} tier={creator.tier!}
source={creator.tierSource ?? 'score'} score={creator.score} scoreTier={scoreTierOf(creator.score)}
tiers={['rising', 'established', 'influential', 'elite']} onSave={saveTier} busy={saving} error={saveError} />Where it appears
- PR Portal › Creators › creator drawer › Tier "Change".
- PR Portal › Tiers › recent automatic moves › "Change".
- Dashboard screens: PrCreators, PrTiers.
Guidelines
Do
- Pass
scoreTierso PR can return a hand-set creator to the score. - Write reasons the creator can understand; they see them.
Don't
- Don't use
ReasonDialogfor tiers any more.
RTL and Arabic
Mirrors. Arabic: "غيّر مستوى {name}", "امشي مع التقييم (…)", "لازم · صانع المحتوى هيشوفه".
Tokens
Modal and field tokens; --ink for the current tier name.
Accessibility
Kit Modal; labelled select and required reason (aria-required, error tied to the field); errors are alerts; Save carries aria-busy.
Found in the source
- Roles in the markup:
alert. - ARIA attributes set:
aria-busy,aria-required. - Its tests cover: “busy disables Save; Escape closes; Arabic: the title and the follow option”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
PrCreatorDrawer,TierMoveList: where it opens from.TierLadder: the tier rules.ReasonDialog: other reasons.
See also: Button · FormField · Modal · useBricks · useLanguage
Source
src/pr/tiers/TierChangeDialog.tsx (line 69) on GitHub.