Skip to content

[codex] Improve SPM calculator launch flow#947

Draft
MaxGhenis wants to merge 3 commits intomainfrom
codex/spm-calculator-launch
Draft

[codex] Improve SPM calculator launch flow#947
MaxGhenis wants to merge 3 commits intomainfrom
codex/spm-calculator-launch

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

What changed

This PR makes the calculator behave like a launchable poverty-analysis product instead of an internal saved-reports shell.

  • adds a dedicated country landing page for the calculator with SPM-focused framing and clear household/report entry points
  • routes / to /:countryId instead of dropping new users directly into saved reports
  • deep-links household users past the standalone scope picker with ?scope=household
  • upgrades the empty saved-analyses screen so first-time users get actionable next steps
  • fixes the shared standard layout so main content uses the full viewport width on mobile instead of rendering in a narrow strip
  • tightens calculator metadata around poverty and household analysis

Why

The previous first-run experience was weak for launch:

  • root users landed in an empty "saved reports" screen
  • the app framed itself as a generic calculator instead of an SPM-oriented analysis tool
  • the fastest household path still went through an avoidable scope step
  • mobile layout had a real width bug in the shared shell

User impact

  • first-time visitors now see a real launch page with clear CTAs
  • household users can get into the custom-household flow faster
  • empty-state pages no longer dead-end
  • mobile users can actually use the launch and saved-analysis screens without the content collapsing

Validation

  • cd app && bun run vitest --run src/tests/unit/components/IngredientReadView.test.tsx src/tests/unit/pages/Reports.page.test.tsx src/tests/unit/pathways/population/launchPrefill.test.ts
  • bun run --filter=@policyengine/calculator typecheck
  • cd app && bun run typecheck
  • bun run --filter=@policyengine/calculator build
  • manual browser verification in local Next dev server for /, /us, /us/households/create?scope=household, and /us/reports on desktop and narrow mobile viewport

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 12, 2026

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

Project Deployment Actions Updated (UTC)
policyengine-app-v2 Ready Ready Preview, Comment Apr 13, 2026 10:24am
policyengine-calculator Ready Ready Preview, Comment Apr 13, 2026 10:24am
policyengine-website Ready Ready Preview, Comment Apr 13, 2026 10:24am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
policyengine-calculator-next Skipped Skipped Apr 13, 2026 10:24am

Request Review

Copy link
Copy Markdown

@policyengine policyengine bot left a comment

Choose a reason for hiding this comment

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

Solid launch flow improvements. The new dedicated landing page, improved routing, and mobile layout fix all work well together. A few minor observations:

What works well:

  • The CalculatorLaunchPage component properly uses design tokens throughout (colors, spacing, typography)
  • Text correctly uses sentence case everywhere
  • The mobile layout fix in StandardLayout (tw:max-w-full on mobile, sm:tw:max-w-[calc(100vw-300px)] on desktop) properly addresses the width bug
  • The ?scope=household deep-link pattern with getPopulationLaunchPrefill is clean and well-tested
  • Empty state improvements in Reports.page give first-time users clear next steps
  • Routing changes (/ → /:countryId → launch page instead of /reports) make sense for a product launch
  • IngredientReadView's custom emptyState prop is a good pattern
  • Tests cover the new behavior

Minor observations:

  1. In CalculatorLaunchPage.tsx:101, the country fallback (LAUNCH_CONTENT[countryId] ?? LAUNCH_CONTENT.us) is defensive but countries outside us/uk will see US content. This seems acceptable for now since only those two are defined.

  2. The removed "Title Section" in IngredientReadView.tsx (lines 84-97 in the diff) means the title now only appears in the header area. The test confirms this renders exactly once, which is correct.

  3. StandardLayout.tsx:59 - the responsive max-width pattern looks correct: mobile gets full width, desktop gets sidebar-aware width. The ordering matters here (mobile-first, then sm: override).

The PR achieves its stated goals: better first-run experience, SPM-focused framing, faster household path, and mobile layout fix. No bugs, edge cases, or security issues found.

)

* Fix audited accessibility issues on website and calculator

* Add accessibility regression tests

* Fix calculator launch copy fallback
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