Skip to content

Next.js migration: calculator app #814

@MaxGhenis

Description

@MaxGhenis

Part of #811

Goal

Migrate the calculator app from React Router nested routes to Next.js App Router.

Tasks

  • Set up calculator route group (e.g. app/(calculator)/)
  • Port MetadataGuard as a layout or middleware check
  • Port CalcOrchestratorProvider context
  • Migrate calculator pages:
    • /:countryId/reports (list)
    • /:countryId/simulations (list)
    • /:countryId/policies (list)
    • /:countryId/populations (list)
    • /:countryId/report-output/:reportId/:subpage?/:view? (dynamic)
  • Flatten nested pathway routing into file-based routes:
    • PolicyPathwayWrapper sub-routes
    • SimulationPathwayWrapper sub-routes
    • ReportPathwayWrapper sub-routes
  • Port calculator-specific hooks (42 hooks, many use React Router)
  • Replace useNavigate/useParams/useSearchParams with Next.js equivalents
  • Verify React Query normalized cache works with Next.js
  • Test report builder flow end-to-end

Complexity notes

  • The calculator has the most complex routing: nested sub-routes within pathway wrappers
  • Heavy use of React Router hooks (useNavigate, useParams, useSearchParams)
  • CalcOrchestratorContext manages multi-step wizard state
  • This is the hardest phase — consider breaking into sub-issues if needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions