A House Divided A House DividedDocumentation
Changelog
Engineering/Conventions

UI reuse and consistency

Last updated 2026-08-20
Source files

This document captures repeatable layout patterns in the Next.js App Router frontend, when to extract shared components, and what we intentionally leave local. It complements .claude/skills/ahd-design-system/SKILL.md (tokens and visual rules).

Investigation summary (2026-03)#

The codebase uses a small set of dashboard-style surfaces: hero image + horizontal stats row, bordered cards with uppercase micro-labels, and admin widgets with grid + dividers. Duplication is highest in the hero stats strip wrapper (same flex + divide + border classes across many routes). Secondary duplication appears in stat cell markup (label + value columns), but those vary enough in padding and content that a single abstraction would fight the routes.

Findings (with references)#

Repeated structures#

Pattern Where it appears Notes
Hero + stats strip , , , , , , , src/app/central-bank/[code]/CentralBankClient.tsx, , , , src/app/national/page.tsx, , UK executive clients, etc. Same outer flex/divide/border classes; inner cells differ.
Political meters (influence / favorability) (StatMeter, HeatMeter from ProfileMeters.tsx), Actions hero uses slimmer inline bars aligned with the design-system progress pattern; profile uses segmented BarMeter.
Admin task widget row grid + divide-x, different layout goal than hero strip; do not force into HeroStatsStrip.

Inconsistencies worth knowing#

When to generalize vs keep local#

Extract a shared primitive when:

Keep markup local when:

Prefer composition over configuration: A thin wrapper + JSX children beats a component with twelve optional props.

Shared primitives#

HeroStatsStrip#

Adopted in:

Deferred: Migrating every remaining hero page to HeroStatsStrip is a mechanical follow-up; touch files only when those areas change for other reasons, or in a dedicated cleanup PR.

Leader / person cells#

Profile meters#

Admin and dashboard surfaces#

Validation checklist for UI changes#

  1. Token classes only, no raw Tailwind palette colors (see design-system skill).
  2. Hero image dimensions unchanged unless the task explicitly allows it.
  3. New shared component: used in at least two call sites or justified as the single supported API for new work.
  4. Run npm run verify before merge.

Remaining risks / deferred issues#