Skip to Content
BBRICKSv0.7.4
PR PortalForms and dialogs

ScoreBreakdown

The PR creator drawer's TRNDR score card (v3 mock pulseRows): "TRNDR score" and "91 / 100", then each part with what was read ("8.0% engagement"), its points ("25 / 25") and a raspberry bar, the formula and a "How the score works" link. With no score: a "Still measuring" pill (or "Customer" for a customer affiliate) and why. The bars are decoration: each row's points are written out. A part's "what it measures" is its tooltip, as the mock's.

import { ScoreBreakdown } 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 ScoreBreakdown. Written in docs/content/components/ScoreBreakdown.md; the props above are read from the code, which wins where the two disagree.

The TRNDR score card: the creator's score out of 100 and its nine parts with readings, points and bars, or why there is no score; use it in the PR creator drawer and anywhere PR needs to explain a score.

ScoreBreakdown is the v3 mock's pulseRows (Creator Pulse v2, the backend's PulseScoreV2). Each part shows what was read ("8.0% engagement"), the points ("25 / 25") and a raspberry bar; a part that cannot be measured says "Not measured yet" and is left out of the total. Without a score it shows a "Still measuring" pill (or "Customer" for a customer affiliate) and the reason. ScoreExplainer is the "How the TRNDR score works" modal that the card's link opens, and TRNDR_SCORE_PARTS lists the parts and their maximum points.

Anatomy

ScoreBreakdown

  1. Card: <section aria-labelledby>, 16px padding, --line border, --r-lg radius, white.
  2. Head: "TRNDR score" heading (h3 by default, 15px / 700) and the value "91 / 100" (24px / 800 display, the "/ 100" muted), or a mute Pill.
  3. Parts list: one <li> per part, ruled: bold name, muted " · reading", " (provisional)"; at the end "25 / 25" or "Not measured yet"; a 6px track with a raspberry fill. The part's "what it measures" is its title tooltip.
  4. Foot: the formula ("Score = points earned ÷ points we can measure × 100…") and the "How the score works" link.
  5. No score: the reason ("No score until we can read followers and engagement from a verified account.") and the link.

ScoreExplainer: a kit Modal with a table (Part, Points, What it measures; a Total row) and five rule notes.

Variants

PropValueLookWhen to use
trackcreator (default)Score and parts, or "Still measuring"Creators
customer"Customer" pill and the customer textCustomer affiliates (no score, tier, gifts or challenges)
headingLevel2, 3 (default), 4Heading elementMatch the page outline (3 in a drawer under the name)
partsomittedScore only, no listWhere the split is not loaded

States

StateTrigger
Scoredscore is a number
Still measuringscore={null}, track="creator"
Customertrack="customer" (score ignored)
Part not measuredpart points: null: "Not measured yet", empty bar
Provisional partpart provisional: true: "(provisional)"
With linkonExplain given

Types

ScorePart: key (a ScorePartKey or your own), points: number | null, max? (default from TRNDR_SCORE_PARTS), name?, reading?: ReactNode, provisional?: boolean.

ScoreExplainer (ScoreExplainerProps): open (required), onClose (required), parts? (default TRNDR_SCORE_PARTS; { key, max, name?, measures? }), language?, labels?, inertRef?.

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 (100 total).

Usage

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

<ScoreBreakdown
  score={91}
  parts={[
    { key: 'followers', points: 19, reading: '460K followers' },
    { key: 'engagement', points: 25, reading: '8.0% engagement' },
    { key: 'on_time', points: 7, reading: '7 of 10 on time', provisional: true },
    { key: 'quality', points: null },
  ]}
  onExplain={() => setExplainer(true)}
/>
<ScoreExplainer open={explainer} onClose={() => setExplainer(false)} />
// A creator still being measured, and a customer affiliate
<ScoreBreakdown score={null} onExplain={() => setExplainer(true)} />
<ScoreBreakdown score={null} track="customer" />
// Inside the creator drawer (PrCreatorDrawer draws it for you from creator.score / scoreParts)
<PrCreatorDrawer open creator={nour} onClose={close} onExplainScore={() => setExplainer(true)} />

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. (docs example Score)

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' },
];

export 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>
  );
}

Where it appears

  • PR Portal › Creators › creator drawer › TRNDR score card, and "How the TRNDR score works" modal.
  • PR Portal › Tiers › score-based ladder links to the explainer (TierLadder onScoreInfo).
  • Dashboard screens: PrCreators, PrTiers.

Guidelines

Do

  • Pass the backend's parts as they are; send points: null for a part that cannot be measured.
  • Mark On time and Quality provisional until the creator has 10 deliveries or ratings.
  • Format readings in the app ("460K followers", "+20% a month").

Don't

  • Don't show 0 for an unmeasured part: it is left out of the score, not counted as zero.
  • Don't use it for sales or commission; they are not part of the score.
  • Don't show it for customer affiliates with a number: set track="customer".

RTL and Arabic

Rows mirror; bars fill from the inline start. Arabic words: "تقييم TRNDR", "لسه بنقيس", "عميل", "لسه متقاسش", "مبدئي", "التقييم بيتحسب إزاي"; part names ("المتابعين", "التفاعل", …) come from the copy. Explainer table head is 12px with no letter spacing in Arabic.

Tokens

--line, --r-lg, --card, --ink, --ink-3, --font-family-display, --track, --rasp, --soft.

Accessibility

  • A <section> labelled by its heading; set headingLevel to keep the outline.
  • Bars are aria-hidden; points are written out, with a visually hidden "25 of 25 points" for screen readers.
  • The value and points are dir="ltr" so "91 / 100" keeps its order in Arabic.
  • The explainer is a kit Modal with a real <table> (scope on headers).

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.

  • PrCreatorDrawer: the drawer that holds it.
  • TierLadder basis="score": tiers by score range.
  • ScoreRing (kit): the score alone as a ring in a table cell (the Creators table's Score column).

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

Source

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

On this page