Skip to documentation

Design system / Molecules

Molecule / Presentation

RoundStatsStrip

RoundStatsStrip derives submission, scored and shortlisted counts from supplied records. Loading replaces the strip with a Skeleton; unavailable replaces counts with an explicit unavailable message. The parent owns data loading and error feedback.

Live example

Live preview

Current component with fictional data. Example changes are not persisted.

Submissions:
3
Scored:
2 / 3
Advanced:
1 / 3

Responsibility

The three counts summarize one supplied submission collection. Scored counts records with at least one score; Advanced counts shortlisted records. These labels do not prove complete scoring or perform advancement.

Public contract

The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.

Maintained component API notes; current source is authoritative
Prop / partTypeRequirementResponsibility
submissionsEditionRoundSubmission[]RequiredInput records; score presence and isShortlisted drive the derived counts.
loadingbooleanRequiredWhen true replaces all statistics with a Skeleton.
unavailablebooleanOptional · default falseWhen not loading, replaces counts with Review statistics unavailable. The owner sets this when a request fails without retained results.

API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.

State and behavior

Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.

No local state or fetch hook. Scored means scores.length > 0, not a complete score or completion percentage; Advanced means isShortlisted. RoundDetail passes submissions and loading from useRoundSubmissions and marks unavailable when an error has no retained rows. Advanced follows optimistic checkbox updates immediately; failure restores the previous confirmed count. The hook owns mutation state. The actionable error text remains outside this strip.

Dependencies

  • Skeleton
  • EditionRoundSubmission type from review-rounds-api
  • Array filtering and local view formatting

Token and styling contract

These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.

text-muted-foreground / text-foreground
Caption and numeral roles.
text-supporting / flex-wrap
Compact inline definition list, wrapping without a large statistics panel. A decorative document icon supplements the submission caption; labels and zero counts remain visible.
Skeleton h-5 w-full
Compact loading geometry.

Boundaries and limitations

  • No error, empty-message or className props. submissionLabelPlural customizes the submission caption.
  • An empty nonloading array produces 0, 0 / 0 and 0 / 0 only when unavailable is false; these are counts, not division. Failed loads must not be presented as successful empty results.
  • The source is coupled to a route API type; it is not an arbitrary generic statistics component.

Where to make a change

Change score/shortlist definitions with the feature’s domain owners, not as a cosmetic token edit. Change loading/fetching in the consumer hook. Extract a generic metric view only if there is a stable reusable contract, keeping round-specific derivation in an adapter.

Selected real uses

RoundDetail

Passes submissions and loading from useRoundSubmissions. An error without retained rows marks statistics unavailable instead of zero. Mutation errors retain rows and counts; fetching stays outside the strip.

Repository path: src/app/(tenants)/console/[tenantCode]/admin/programs/[programCode]/editions/[editionCode]/review-rounds/components/roundDetail.tsx

These traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.

Usage contract

import { RoundStatsStrip } from "./roundStatsStrip";

// RoundDetail obtains these from useRoundSubmissions.
<RoundStatsStrip submissions={submissions} loading={submissionsLoading}
  unavailable={Boolean(submissionsError && !submissions.length)} />

Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.

All molecules
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.