Skip to content

refactor: prepare monorepo for multi-app integration#19

Open
augmentcode[bot] wants to merge 3 commits into
masterfrom
refactor/prepare-multi-app-integration
Open

refactor: prepare monorepo for multi-app integration#19
augmentcode[bot] wants to merge 3 commits into
masterfrom
refactor/prepare-multi-app-integration

Conversation

@augmentcode
Copy link
Copy Markdown

@augmentcode augmentcode Bot commented May 19, 2026

Summary

Prepares the monorepo for integrating additional web applications by consolidating duplicated abstractions, adding configuration surfaces to the shared design system, improving code organization, and breaking down large components.

Changes

packages/topo (design system)

New configuration surfaces — ThemeProvider now accepts optional override props (all with backward-compatible defaults):

  • cognitoFormsId — override Cognito Forms account ID
  • usercentricsSettingsId — override Usercentrics CMP settings ID
  • apiEndpoint — override the GraphQL API endpoint
  • localizationConfig was already a prop

Consolidated QueryProvider — Added PageDataProvider / usePageData to topo for app-level page data. This replaces the duplicate context that www had in its own query.ts.

Split Provider.tsx — Extracted font loading into providers/Fonts.tsx and CMS string fetching into providers/CmsStrings.tsx. Provider.tsx is now a thin 105-line composition layer (was 240).

New shared components (extracted from apps/www):

  • Highlight (Atom) — text highlight wrapper
  • OnlyVisibleBox (Atom) — renders children only when element has dimensions
  • VideoPlayer (Molecule) — HLS-capable video player
  • VideoLink (Molecule) — video modal trigger
  • Markdown (Molecule) — themed ReactMarkdown wrapper
  • CalendlyEmbed (Molecule) — Calendly scheduling embed
  • ContentfulRichText (Molecule) — Contentful JSON rich text renderer (split into ContentfulAsset sub-component)
  • FlexScatter (Molecule) — randomized flex layout with seeded RNG

New helpercreateStaticProps in @codeday/topo/utils for standardized getStaticProps with GraphQL.

React 19 cleanup:

  • Removed PropTypes (TypeScript interface already existed)
  • Removed forwardRef from 15+ components and the pureRef utility (React 19 passes ref as a regular prop)

Other — Deduplicated ThemeData type (removed dead themeContext.ts), made apiFetch accept optional endpoint parameter.

packages/utils

  • Added shared dedupeFirstByKey (from arr.ts) and splitGroups utilities, moved from www.

apps/www

Import updates:

  • All 30 files using the local useQuery now import usePageData from @codeday/topo/Theme
  • Tracking IDs (LinkedIn, FundraiseUp, PostHog) moved to env vars with fallback defaults
  • Component imports updated to use new topo exports

Large component breakdowns:

Component Before After
Volunteer/Wizard.tsx 409 lines, 1 file 5 files: BackgroundStep, RegionStep, ContactStep, ConfirmationStep, orchestrator
Index/Community.tsx 290 lines, 1 file 4 files: PhotoTextCard, PhotoCard, Card, orchestrator
Index/Programs.tsx 193 lines, 1 file 4 files: NextEventDate, RegionList, ProgramCard, orchestrator
EventInfo.tsx 181 lines, 1 file 2 files: SubscribeBox, main component
Page.tsx 141 lines, 1 file 3 files: NavMenu, DisclaimerFooter, main component

Other cleanups:

  • Removed StaticContent.tsx (noop createElement wrapper, deprecated since React 18)
  • Consolidated near-duplicate Teaser.tsx + PreviewVideo.tsx into shared MuxAutoplayVideo component

apps/_template (new)

  • Minimal Next.js + topo scaffold for adding new apps to the monorepo

Build status

  • TypeScript compilation succeeds for all packages and both apps
  • Template app builds and generates static pages successfully
  • One pre-existing runtime error in doi/crossref page (undefined description from API, unrelated to this PR)

Consolidate duplicated abstractions, add configuration surfaces, and
improve code organization in advance of merging additional web apps
into this repository.

Changes by area:

packages/topo (design system):
- Add PageDataProvider/usePageData to Theme for app-level page data
- Make service IDs overridable from ThemeProvider (cognitoFormsId,
  usercentricsSettingsId, apiEndpoint) with existing values as defaults
- Split monolithic Provider.tsx into sub-providers (Fonts, CmsStrings)
- Remove deprecated PropTypes usage (TypeScript interface already exists)
- Remove forwardRef wrappers from 15+ components (unnecessary in React 19)
- Simplify pureRef/makePureBox utilities accordingly
- Add new shared components: VideoPlayer, VideoLink, Markdown, Highlight,
  CalendlyEmbed (extracted from apps/www)
- Add createStaticProps helper for standardized data fetching
- Deduplicate ThemeData (remove dead themeContext.ts)
- Make apiFetch accept optional endpoint parameter

packages/utils:
- Add shared arr.ts (dedupeFirstByKey) and splitGroups.ts utilities

apps/www:
- Replace local QueryProvider with topo's PageDataProvider/usePageData
- Move tracking IDs to environment variables with fallback defaults
- Update component imports to use new topo exports
- Remove deleted local utility files

apps/_template:
- New minimal Next.js app scaffold for adding future apps
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
www Ready Ready Preview, Comment May 20, 2026 4:12am

Request Review

Component extractions to packages/topo:
- ContentfulRichText → topo/Molecule (Contentful JSON rich text renderer)
- FlexScatter → topo/Molecule (randomized flex layout)
- OnlyVisibleBox → topo/Atom (visibility-conditional rendering)

Component breakdowns in apps/www:
- Wizard.tsx (409 lines) → 5 files: BackgroundStep, RegionStep,
  ContactStep, ConfirmationStep, orchestrator index
- Community.tsx (290 lines) → 4 files: PhotoTextCard, PhotoCard,
  Card, orchestrator index
- Programs.tsx (193 lines) → 4 files: NextEventDate, RegionList,
  ProgramCard, orchestrator index
- EventInfo.tsx (181 lines) → 2 files: SubscribeBox, main component
- Page.tsx (141 lines) → 3 files: NavMenu, DisclaimerFooter, main

Other cleanups:
- Remove StaticContent.tsx (noop wrapper, deprecated since React 18)
- Consolidate near-duplicate Teaser + PreviewVideo into shared
  MuxAutoplayVideo component
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.

0 participants