Skip to content

feat(ui): consolidate Storybook and shared UI library - #615

Draft
zacjones93 wants to merge 57 commits into
mainfrom
codex/ui-library-foundation
Draft

feat(ui): consolidate Storybook and shared UI library#615
zacjones93 wants to merge 57 commits into
mainfrom
codex/ui-library-foundation

Conversation

@zacjones93

@zacjones93 zacjones93 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • consolidate the complete 35-PR Storybook and UI-library program into this single PR against main
  • establish Storybook 10 with light/dark theming, accessibility checks, interaction stories, static builds, and a reproducible UI inventory
  • extract shared @repo/ui foundations and compatibility adapters for Start and Crew
  • add composable AuthEntry, Field, FieldGroup, EmptyState, and Metric APIs alongside the shared primitive set
  • migrate reviewed Start and Crew consumers while preserving route controllers, handlers, payloads, and domain calculations
  • fix the accessibility, responsive-layout, hydration, form-context, and semantic issues found during page-by-page audits
  • add deterministic page-coverage contracts and captured evidence for public, athlete, organizer, Crew, and Start admin surfaces

Stack consolidation

PRs #616 through #649 were independently reviewed and fast-forward merged leaf-to-base into this branch. The non-numeric dependency junction was preserved as #637#639#638#640. PR #615 is now the only open PR from the stack.

Final head: 23be842b77d38bd533f220a734fa36878f9e1e52

Verification

Merge scope

This PR intentionally remains directly based on main and contains the reviewed cumulative stack. Intermediate PRs #616#649 are merged.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The Start app adds a React-Vite Storybook setup, themed component stories, accessibility configuration, and scripts for static builds. It also adds UI inventory generation and documentation describing the boundary and staged extraction constraints.

Changes

Start UI library tooling

Layer / File(s) Summary
Storybook configuration and scripts
apps/wodsmith-start/.storybook/*, apps/wodsmith-start/package.json, apps/wodsmith-start/.gitignore
Configures Storybook with React Vite, Tailwind, path aliases, themed previews, accessibility checks, and local serve/build scripts.
Primitive component stories
apps/wodsmith-start/src/components/ui/*.stories.tsx
Adds stories covering Badge, Button, Card, Input, and Textarea states, variants, controls, and compositions.
UI inventory generation and boundary documentation
apps/wodsmith-start/scripts/*, apps/wodsmith-start/docs/*, lat.md/*
Adds inventory generation and freshness checking for UI consumers and Start/Crew differences, with documentation for the UI boundary and Storybook contract.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant Storybook
  participant main_ts as main.ts
  participant vite_config as vite.config.ts
  participant preview_tsx as preview.tsx
  participant UIStories as UI stories
  Developer->>Storybook: Start or build Storybook
  Storybook->>main_ts: Load StorybookConfig
  main_ts->>vite_config: Apply Vite configuration
  Storybook->>preview_tsx: Load preview decorators and parameters
  Storybook->>UIStories: Discover component stories
  preview_tsx->>UIStories: Wrap stories with theme and TooltipProvider
Loading

Poem

A rabbit hops through stories bright,
With buttons dressed in variant light.
Badges, cards, inputs bloom,
Inventory maps the UI room.
Storybook checks each leafy sprout!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the PR’s main theme: establishing Storybook and the UI library foundation for the Start app.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ui-library-foundation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zacjones93

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/wodsmith-start/.storybook/vite.config.ts (1)

8-17: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the duplicate @ alias The manual resolve.alias duplicates the @/* mapping already provided by vite-tsconfig-paths via apps/wodsmith-start/tsconfig.json, so keep a single source of truth to avoid drift.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/wodsmith-start/.storybook/vite.config.ts` around lines 8 - 17, Remove
the manual "@" entry from the resolve.alias configuration in the Vite config,
relying on the tsconfigPaths plugin and the "`@/`*" mapping in tsconfig.json as
the single source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/wodsmith-start/scripts/generate-ui-library-inventory.mjs`:
- Around line 67-71: Normalize the relative path in consumerArea before the
prefix checks by converting platform-specific separators to POSIX “/”
separators, then classify the normalized value with the existing routes/ and
components/ui/ prefixes.

---

Nitpick comments:
In `@apps/wodsmith-start/.storybook/vite.config.ts`:
- Around line 8-17: Remove the manual "@" entry from the resolve.alias
configuration in the Vite config, relying on the tsconfigPaths plugin and the
"`@/`*" mapping in tsconfig.json as the single source of truth.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e179745e-5a39-425a-9e72-ed0cc1a50360

📥 Commits

Reviewing files that changed from the base of the PR and between 6fe262e and afb89af.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (13)
  • apps/wodsmith-start/.gitignore
  • apps/wodsmith-start/.storybook/main.ts
  • apps/wodsmith-start/.storybook/preview.tsx
  • apps/wodsmith-start/.storybook/vite.config.ts
  • apps/wodsmith-start/docs/ui-library-inventory.md
  • apps/wodsmith-start/package.json
  • apps/wodsmith-start/scripts/generate-ui-library-inventory.mjs
  • apps/wodsmith-start/src/components/ui/badge.stories.tsx
  • apps/wodsmith-start/src/components/ui/button.stories.tsx
  • apps/wodsmith-start/src/components/ui/card.stories.tsx
  • apps/wodsmith-start/src/components/ui/input.stories.tsx
  • lat.md/lat.md
  • lat.md/ui-library.md

Comment thread apps/wodsmith-start/scripts/generate-ui-library-inventory.mjs

Copy link
Copy Markdown
Contributor Author

Independent review result: blockers found on afb89afb33a123648b22f98955cbfc91c90b1ba2.

  1. [P2] Keep the dark theme from styling Storybook's Autodocs chromeapps/wodsmith-start/.storybook/preview.tsx:7-12

    The decorator toggles .dark on document.documentElement, so the app's global dark styles affect the entire preview document, including Autodocs UI that is not inside the decorator wrapper. In a clean Storybook browser session I opened all four groups (Badge, Button, Card, Form controls) in light and dark themes. Every dark Autodocs page rendered the document background as rgb(12, 10, 9) while the visible Docs heading remained rgb(46, 51, 56); headings/control labels become effectively black-on-black, and story canvases appear as narrow dark columns inside white Docs frames. There were no console errors or Vite overlays, so the successful build does not catch this visual failure. Please scope the theme class to the rendered story and/or configure a matching Storybook Docs theme so dark mode remains readable.

  2. [P2] Normalize path.relative() output before classifying inventory consumersapps/wodsmith-start/scripts/generate-ui-library-inventory.mjs:67-71

    On Windows, relative(sourceRoot, path) returns backslash-separated paths. The current startsWith("routes/") and startsWith("components/ui/") checks therefore never match, misclassifying route/UI imports as shared components and making the checked-in inventory platform-dependent. Normalize separators to / before applying the prefixes. This matches the still-unresolved inline review thread and is a real correctness issue.

Validation completed with the repository toolchain (Node 24.15.0, corepack pnpm 9.12.1): focused app type-check passed, inventory freshness passed, static Storybook build passed, dev server/browser smoke passed with no console/page errors, lat check passed, and git diff --check passed. Independent inventory counts matched the artifact (36 Start primitives, 36 Crew primitives, 4 story groups, 181 route consumers, 149 shared-component consumers). The PR changes no runtime route files, GitNexus reports zero affected runtime execution flows, and all current GitHub checks are green.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

LGTM — no blockers remain on ae63ca98f9f3c4c0a0f3d41064bc4d24556d2836.

I re-reviewed the incremental range afb89afb3..ae63ca98f and verified the prior findings:

  • Dark theme state is scoped to the full-width story wrapper; Storybook Docs chrome is no longer restyled.
  • Docs omits the viewport-height wrapper, while Canvas remains full-viewport.
  • The inventory classifier normalizes Windows path separators before applying route/UI prefixes.
  • The redundant manual @ Vite alias is removed; vite-tsconfig-paths remains the single source and the static build resolves successfully.

Focused validation with Node 24.15.0 and corepack pnpm 9.12.1 passed: app type-check, inventory freshness, Windows path-normalization simulation, static Storybook build, lat check, and incremental git diff --check.

Clean browser verification covered all four story groups (Badge, Button, Card, Form controls) in the full 16-state Docs/Canvas × light/dark matrix. Docs chrome remained readable, dark stories used isolated full-width backgrounds, Canvas filled the 1440×1000 viewport, and no Vite overlays or page errors appeared.

Live state is also clean: all GitHub checks are green, the PR is mergeable with CLEAN state, and CodeRabbit's only inline thread is resolved as addressed in ae63ca9.

@zacjones93 zacjones93 changed the title Establish Storybook and UI library foundation feat(ui): consolidate Storybook and shared UI library Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant