PolicyEngine / PolicyEngine/policyengine-app-v2

Remove country prefix from global routes

Open
#607 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
1
Forks
3
Avg merge
1d 50m
Merged PRs (30d)
39

Description

Problem

Many routes don't need country context but still require /us or /uk prefix, creating URL clutter:

  • /us/research → same content globally
  • /us/team → same content globally
  • /us/ai-inequality → global research tool
  • /us/donate, /us/supporters, /us/privacy, /us/terms, /us/brand/* → all global

Proposed solution

Move global routes outside the /:countryId nesting while keeping country prefix for pages that need it (calculator, reports, policies, simulations).

Target URL structure
# Global routes (no country prefix)
/research
/research/:slug
/ai-inequality
/2025-year-in-review
/team
/donate
/supporters
/privacy
/terms
/brand/*

# Country-specific routes (keep prefix)
/us/calculator
/us/reports
/us/policies
/uk/calculator
...

Implementation

  1. Restructure WebsiteRouter.tsx - Move global routes outside /:countryId children
  2. Keep CalculatorRouter.tsx as-is - All calculator/data routes need country
  3. Update header/nav - Country selector on global pages sets preference for calculator entry
  4. Update internal links - Any links from global pages to country routes need to include country
  5. Handle RedirectToCountry - Root / could go directly to global homepage

Files to modify

  • app/src/WebsiteRouter.tsx
  • app/src/components/Header.tsx (if country selector logic needs updating)
  • Any pages with links to country-specific routes

Notes

  • The country architecture is well-documented in app/src/docs/ARCHITECTURE-COUNTRY-ID.md
  • ~321 files reference countryId but most are in calculator routes that will keep the prefix
  • This is a targeted change, not a full architecture rewrite

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app/src/docs/ARCHITECTURE-COUNTRY-ID.md and app/src/WebsiteRouter.tsx, then inspect app/src/components/Header.tsx and links from the listed global pages. Move only the specified global routes outside the country nesting, preserve country prefixes for calculator, reports, policies, and simulations, and verify that global navigation and country-specific links resolve to the target URL structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.