Skip to Content
BBRICKSv0.7.4
PR PortalForms and dialogs

ScoreExplainer

"How the TRNDR score works" (v3 mock scoreInfo): a modal with the score's parts, the points each can give and what it measures, the total (100), and the rules (no score until followers and engagement are read, unmeasured parts left out, provisional parts, readings older than 120 days, sales not counted). On the kit Modal.

import { ScoreExplainer } from '@ergasti/bricks';

Examples

TRNDR score

The score with its nine parts (what was read, the points, a bar) and the formula; "How the score works" opens the ScoreExplainer modal. Pass parts as the backend splits the score.

Code
import { useState } from 'react';
import { ScoreBreakdown, ScoreExplainer, type ScorePart } from '@ergasti/bricks';

const parts: ScorePart[] = [
  { key: 'followers', points: 19, reading: '460K followers' }, { key: 'engagement', points: 25, reading: '8.0% engagement' },
  { key: 'approved_tasks', points: 8, reading: '8 approved' }, { key: 'packages_done', points: 9, reading: '5 finished' },
  { key: 'verified_accounts', points: 5, reading: '2 of 2 verified' }, { key: 'posting', points: 5, reading: '2.0 posts a week' },
  { key: 'growth', points: 5, reading: '+20% a month' }, { key: 'on_time', points: 7, reading: '7 of 10 on time', provisional: true },
  { key: 'quality', points: 8, reading: '4.0 / 5 average' },
];

function Score() {
  const [open, setOpen] = useState(false);
  return (
    <div style={{ maxWidth: 380 }}>
      <ScoreBreakdown score={91} parts={parts} onExplain={() => setOpen(true)} />
      <ScoreExplainer open={open} onClose={() => setOpen(false)} />
    </div>
  );
}

No score

Still measuring (no verified followers and engagement yet), or a customer affiliate, who has no score or tier.

Code
import { ScoreBreakdown } from '@ergasti/bricks';

function NoScore() {
  return (
    <div style={{ display: 'grid', gap: 12, maxWidth: 380 }}>
      <ScoreBreakdown score={null} onExplain={() => {}} />
      <ScoreBreakdown score={null} track="customer" onExplain={() => {}} />
    </div>
  );
}

As kit pieces

variant="card" draws the same content as a Card variant="inset" with the score as its badge and DetailsBars variant="stacked" rows, for an app that styles those kit pieces.

Code
import { ScoreBreakdown, type ScorePart } from '@ergasti/bricks';

const parts: ScorePart[] = [
  { key: 'followers', points: 19, reading: '460K followers' }, { key: 'engagement', points: 25, reading: '8.0% engagement' },
  { key: 'approved_tasks', points: 8, reading: '8 approved' }, { key: 'packages_done', points: 9, reading: '5 finished' },
  { key: 'verified_accounts', points: 5, reading: '2 of 2 verified' }, { key: 'posting', points: 5, reading: '2.0 posts a week' },
  { key: 'growth', points: 5, reading: '+20% a month' }, { key: 'on_time', points: 7, reading: '7 of 10 on time', provisional: true },
  { key: 'quality', points: 8, reading: '4.0 / 5 average' },
];

function KitCard() {
  return (
    <div style={{ display: 'grid', gap: 12, maxWidth: 380 }}>
      <ScoreBreakdown variant="card" score={91} parts={parts} onExplain={() => {}} />
      <ScoreBreakdown variant="card" score={null} onExplain={() => {}} />
    </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 prScore, or with the component's own prop where it has one. A {name} is a value the component fills in.

prScore
KeyEnglishArabic
titleTRNDR scoreتقييم TRNDR
outOf/ 100/ 100
of{pts} / {max}{pts} / {max}
pointsOf{pts} of {max} points{pts} من {max} نقطة
customerCustomerعميل
measuringStill measuringلسه بنقيس
notMeasuredNot measured yetلسه متقاسش
provisionalprovisionalمبدئي
customerTextCustomer affiliates have no TRNDR score or tier, and get no gifts or challenges.العملاء الأفلييت ملهمش تقييم TRNDR ولا مستوى، ومبياخدوش هدايا ولا يدخلوا تحديات.
measuringTextNo score until we can read followers and engagement from a verified account.مفيش تقييم لحد ما نقدر نقرا المتابعين والتفاعل من حساب موثّق.
formulaScore = points earned ÷ points we can measure × 100. A part we can’t measure yet is left out, not counted as 0.التقييم = النقط اللي جابها ÷ النقط اللي نقدر نقيسها × 100. الجزء اللي لسه منقدرش نقيسه بيتشال من الحساب، مش بيتحسب صفر.
howHow the score worksالتقييم بيتحسب إزاي
parts.followersFollowers,All verified accounts added up, on a log scale. About 890K is full marks.المتابعين,كل الحسابات الموثّقة مع بعض، على مقياس لوغاريتمي. حوالي 890 ألف هي الدرجة الكاملة.
parts.engagementEngagement,Best engagement rate across their accounts. 8% is full marks.التفاعل,أعلى نسبة تفاعل على حساباته. 8% هي الدرجة الكاملة.
parts.approved_tasksApproved tasks,Videos and posts TRNDR approved. 10 is full marks.مهام اتقبلت,فيديوهات وبوستات TRNDR وافقت عليها. 10 هي الدرجة الكاملة.
parts.packages_donePackages done,Gift packages finished. 5 is full marks.باكدجات خلصت,باكدجات هدايا خلّصها. 5 هي الدرجة الكاملة.
parts.verified_accountsVerified accounts,Share of connected accounts that are verified.حسابات موثّقة,نسبة الحسابات المربوطة اللي موثّقة.
parts.postingPosting,Posts per week over the last 60 days. 2 a week is full marks.النشر,بوستات في الأسبوع آخر 60 يوم. 2 في الأسبوع هي الدرجة الكاملة.
parts.growthGrowth,Follower growth per month: 20%+ full, then 10%, 5%, 2%, 0%.النمو,نمو المتابعين في الشهر: 20%+ كاملة، وبعدها 10% و5% و2% و0%.
parts.on_timeOn time,Last 10 deliveries on time. New creators start at 80%.في الميعاد,آخر 10 تسليمات في ميعادها. صنّاع المحتوى الجداد بيبدأوا من 80%.
parts.qualityQuality,Average TRNDR rating of the last 10 videos. New creators start at 70%.الجودة,متوسط تقييم TRNDR لآخر 10 فيديوهات. صنّاع المحتوى الجداد بيبدأوا من 70%.
explainTitleHow the TRNDR score worksتقييم TRNDR بيتحسب إزاي
explainSubA number from 0 to 100, the same on every brand. TRNDR recalculates it automatically as new data comes in.رقم من 0 لـ 100، هو هو على كل البراندات. TRNDR بيحسبه تاني لوحده كل ما بيانات جديدة توصل.
partPartالجزء
pointsPointsالنقط
measuresWhat it measuresبيقيس إيه
totalTotalالمجموع
notes,No score yet ("Still measuring"), until we can read both followers and engagement from a verified account.,Parts we can’t measure yet are left out of the total, not counted as zero.,,,On time and Quality count as ,provisional, until the creator has 10 deliveries or ratings.,Follower and engagement readings older than 120 days stop counting.,,,Sales and commission are ,not, part of the score.,مفيش تقييم لسه ("لسه بنقيس"), لحد ما نقدر نقرا المتابعين والتفاعل الاتنين من حساب موثّق.,الأجزاء اللي لسه منقدرش نقيسها بتتشال من المجموع، مش بتتحسب صفر.,,,الالتزام بالميعاد والجودة بيتحسبوا ,مبدئي, لحد ما صانع المحتوى يكمّل 10 تسليمات أو تقييمات.,قراءات المتابعين والتفاعل اللي عدّى عليها أكتر من 120 يوم مبتتحسبش.,,,المبيعات والعمولة ,مش, جزء من التقييم.

Design guidance

How the BRICKS design system uses ScoreExplainer. Written in docs/content/components/ScoreExplainer.md; the props above are read from the code, which wins where the two disagree.

The "How the TRNDR score works" modal: a table of the score's parts, the points each can give and what it measures, the total (100) and the rules; open it from any "How the score works" link.

It is the PR Portal's scoreInfo() modal (Creator Pulse v2). Three links in the mock open it: the creator drawer's TRNDR score card (ScoreBreakdown's onExplain, via PrCreatorDrawer's onExplainScore), the drawer's "Still measuring" / customer note, and each range on the Tiers page (TierLadder basis="score"'s onScoreInfo). With no parts it shows TRNDR_SCORE_PARTS: nine parts, 100 points. Built on the kit Modal.

Anatomy

  1. Scrim and dialog (.kit-modal, role="dialog", aria-modal): centred, up to 660px wide, max 92vh, the body scrolls.
  2. Header: title <h2> "How the TRNDR score works", hint "A number from 0 to 100, the same on every brand. TRNDR recalculates it automatically as new data comes in.", round close "×".
  3. Table (.kit-pr-scoreinfo-t, 1px --line border, radius 18, 13.5px):
    1. <thead> on --soft: Part · Points · What it measures (11px caps, --ink-3).
    2. <tbody>: one row per part, the name as a row header (<th scope="row">, 700), the points end-aligned and tabular, the description muted 12.5px.
    3. <tfoot>: "Total" and the sum in bold.
  4. Rules (.kit-pr-scoreinfo-notes, a <ul>, 13px muted, key words bold in --ink): no score until followers and engagement are read; unmeasured parts left out, not zero; On time and Quality provisional until 10 deliveries or ratings; readings older than 120 days stop counting; sales and commission are not part of the score.

Variants

Prop / valueLookUse when
parts omittedThe nine TRNDR_SCORE_PARTS (Followers 20, Engagement 25, Approved tasks 10, Packages done 10, Verified accounts 5, Posting 5, Growth 5, On time 10, Quality 10) with the copy's names and descriptions; total 100Default: the backend's PulseScoreV2 config.
parts givenYour rows; name / measures override the copy for known keys, and are needed for unknown keysThe config changed (other maxima) or the app adds a part.

The total is the sum of max, so a custom list that does not add to 100 shows its real sum.

States

  • Open: open; focus moves into the dialog.
  • Closed: open={false} renders nothing.
  • Long content: the dialog stops at 92vh and its body scrolls.
  • Unknown key without name: the row header shows the raw key; give name and measures.
  • Static otherwise: no loading or error.

Usage

// PR Portal › Creators: the drawer's score card opens the explainer
function CreatorDrawerWithScore({ creator, onClose }: { creator: PrDrawerCreator; onClose: () => void }) {
  const [explain, setExplain] = useState(false);
  return (
    <>
      <PrCreatorDrawer open onClose={onClose} creator={creator} onExplainScore={() => setExplain(true)} />
      <ScoreExplainer open={explain} onClose={() => setExplain(false)} />
    </>
  );
}
// PR Portal › Tiers: each score range links to it
function TiersWithScoreInfo({ tiers }: { tiers: ReadonlyArray<LadderTier> }) {
  const [explain, setExplain] = useState(false);
  return (
    <>
      <TierLadder basis="score" tiers={tiers} onScoreInfo={() => setExplain(true)} />
      <ScoreExplainer open={explain} onClose={() => setExplain(false)} />
    </>
  );
}
// A changed config from the backend
<ScoreExplainer
  open={explain}
  onClose={close}
  parts={config.parts.map((p) => ({ key: p.key, max: p.max }))}
/>

Where it appears

  • PR Portal › Creators › creator drawer › TRNDR score › "How the score works" (mock pulseRows → scoreInfo()). Gallery screens creator-drawer, creator-customer; screen PR · Creators, drawer card PrCreatorDrawer.
  • PR Portal › Tiers › each tier's score range › "How the score works" (mock P.tiers). Gallery screen tiers; screen PR · Tiers.

Guidelines

Do

  • Keep one instance per page and open it from every "How the score works" link there.
  • Pass parts from the backend config if the maxima ever change, so the table and the breakdown agree.
  • Keep the rules list as written: they answer the questions PR gets about missing or provisional scores.

Don't

  • Don't put per-creator numbers here: that is ScoreBreakdown.
  • Don't mention sales or commission as score inputs.
  • Don't override notes with marketing copy; keep them as rules.

RTL and Arabic

  • The table mirrors (Part on the right, Points end-aligned to the left); header caps use 12px with no letter-spacing in RTL.
  • Arabic copy: "تقييم TRNDR بيتحسب إزاي", columns "الجزء · النقط · بيقيس إيه", "المجموع"; each part has an Arabic name and description.
  • Numbers go through count(), so they follow the language's digits.

Tokens

--card, --line, --soft, --ink, --ink-3, --modal-w, --modal-pad, --focus-ring, --font-family-display.

Accessibility

  • role="dialog", aria-modal="true", named by its title. Focus moves in, Tab is trapped, Escape closes, focus returns to the link that opened it.
  • A real <table> with scope="col" headers and scope="row" part names, so each value is read as "Engagement, 25, Best engagement rate…".
  • The total row is in <tfoot>; the bold total is text, not colour.
  • Scrim aria-hidden; close × is a button named "Close" (36px; 44px at 1024px and below).

Found in the source

  • ARIA attributes set: aria-hidden, aria-labelledby.
  • Its tests cover: “a modal with the nine parts, their points adding up to 100, and the rules; Escape closes it”; “a Card variant=”.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

  • ScoreBreakdown: one creator's score by part; its onExplain opens this.
  • PrCreatorDrawer: hosts the breakdown (onExplainScore).
  • TierLadder: basis="score" ranges link here (onScoreInfo).
  • ScoreRing (table cell ring) and ScoreCard (Brand Find creators mini profile): the score shown, not explained.

See also: Card · DetailsBars · Modal · Pill · useLanguage · BulkAction · ChangePreview · ChoiceGroup · DecisionsCard

Source

src/pr/creators/Score.tsx (line 248) on GitHub.

On this page