Skip to content

feat: legacy router migration 3#124

Open
Alessandro100 wants to merge 6 commits intomainfrom
feat/25-legacy-router-migration-3
Open

feat: legacy router migration 3#124
Alessandro100 wants to merge 6 commits intomainfrom
feat/25-legacy-router-migration-3

Conversation

@Alessandro100
Copy link
Copy Markdown
Contributor

@Alessandro100 Alessandro100 commented Apr 21, 2026

Summary:

closes #25

This PR moves the following pages out of the legacy router and into NextJs App Router

  • forgot-password
  • contribute
  • contribute/submitted
  • metrics/gtfs
  • feeds/*
  • notices/*
  • features/*
  • metrics/gbfs
  • feeds/*
  • notices/*
  • versions/*

Expected behavior:

All these pages and URLs should have the exact same behaviour as they previously did

Testing tips:

Flows to test out

  • Going through the Add Feed Form
  • Checking out the metrics (sign in with @mobilitydata.org account)
  • Do a forgot password check

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with yarn test to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@Alessandro100 Alessandro100 requested a review from Copilot April 21, 2026 11:58
@Alessandro100 Alessandro100 self-assigned this Apr 21, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 21, 2026

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

Project Deployment Actions Updated (UTC)
mobilitydatabase-web Ready Ready Preview, Comment Apr 24, 2026 2:04pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR continues the migration away from the legacy React Router catch-all by moving “forgot password”, “contribute” (feed submission), and the GTFS/GBFS metrics pages into the Next.js App Router under src/app/[locale]/..., while refactoring shared types to src/app/utils.

Changes:

  • Added App Router pages/layouts for /forgot-password, /contribute, and /metrics/{gtfs,gbfs}/... and wired them to existing screen/components.
  • Extracted and reused shared TypeScript types for feed submission and analytics across store/sagas/components.
  • Updated store/sagas and analytics components to import from the new locations.

Reviewed changes

Copilot reviewed 41 out of 46 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/app/utils/feed-submission-types.ts New shared type definitions for the feed submission form.
src/app/utils/analytics-types.ts Fixes import path + minor cleanup for shared analytics types.
src/app/store/saga/gtfs-analytics-saga.ts Updates analytics type import + analytics bucket endpoint import path.
src/app/store/saga/gbfs-analytics-saga.ts Updates analytics type import + analytics bucket endpoint import path.
src/app/store/gtfs-analytics-selector.ts Updates GTFS metrics type import to shared utils.
src/app/store/gtfs-analytics-reducer.ts Updates GTFS metrics type import to shared utils.
src/app/store/gbfs-analytics-selector.ts Updates GBFS metrics type import to shared utils.
src/app/store/gbfs-analytics-reducer.ts Updates GBFS metrics type import to shared utils.
src/app/store/analytics-reducer.ts Updates analytics type import to shared utils.
src/app/services/feeds/add-feed-form-service.ts Switches feed submission form input typing to shared utils.
src/app/screens/ForgotPassword.tsx Marks the screen as a Client Component for App Router usage.
src/app/screens/FeedSubmitted.tsx Marks as Client Component and removes CssBaseline usage.
src/app/router/Router.tsx Removes legacy route definitions (router now renders null).
src/app/[locale]/metrics/layout.tsx Adds a metrics layout that wraps pages with ReduxGateWrapper.
src/app/[locale]/metrics/gtfs/page.tsx Adds GTFS metrics index page (renders GTFS feed analytics).
src/app/[locale]/metrics/gtfs/notices/page.tsx Adds GTFS notices metrics page.
src/app/[locale]/metrics/gtfs/feeds/page.tsx Adds GTFS feeds metrics page.
src/app/[locale]/metrics/gtfs/features/page.tsx Adds GTFS features metrics page.
src/app/[locale]/metrics/gbfs/feeds/page.tsx Adds GBFS feeds metrics page.
src/app/[locale]/metrics/gbfs/notices/page.tsx Adds GBFS notices metrics page.
src/app/[locale]/metrics/gbfs/versions/page.tsx Adds GBFS versions metrics page.
src/app/[locale]/metrics/_components/Analytics/utils.ts New module for storing analytics bucket endpoint (GBFS path).
src/app/[locale]/metrics/_components/Analytics/types.ts Re-export of shared analytics types for metrics components.
src/app/[locale]/metrics/_components/Analytics/analytics.css Adds analytics-specific CSS used by metrics tables.
src/app/[locale]/metrics/_components/Analytics/GTFSNoticeAnalytics/GTFSNoticeAnalytics.tsx Marks as Client Component + updates import paths.
src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx Updates import paths used by GTFS feed metrics table.
src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalytics.tsx Marks as Client Component + updates store/context import paths.
src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/DetailPanel.tsx Updates import path to feeds utils for location formatting.
src/app/[locale]/metrics/_components/Analytics/GTFSFeatureAnalytics/GTFSFeatureAnalytics.tsx Marks as Client Component + updates import paths.
src/app/[locale]/metrics/_components/Analytics/GBFSNoticeAnalytics/GBFSNoticeAnalytics.tsx Marks as Client Component + updates import paths.
src/app/[locale]/metrics/_components/Analytics/GBFSVersionAnalytics/GBFSVersionAnalytics.tsx Marks as Client Component + updates import paths.
src/app/[locale]/metrics/_components/Analytics/GBFSFeedAnalytics/GBFSFeedAnalyticsTable.tsx New GBFS feed metrics table columns implementation.
src/app/[locale]/metrics/_components/Analytics/GBFSFeedAnalytics/GBFSFeedAnalytics.tsx Marks as Client Component + updates store/context import paths.
src/app/[locale]/metrics/_components/Analytics/GBFSFeedAnalytics/DetailPanel.tsx New GBFS feed detail panel (chart + notices table).
src/app/[locale]/forgot-password/page.tsx Adds App Router page for forgot-password (Redux-gated).
src/app/[locale]/contribute/page.tsx Adds App Router page for contribute feed submission (Redux-gated).
src/app/[locale]/contribute/submitted/page.tsx Adds App Router page for contribute/submitted success screen.
src/app/[locale]/contribute/FeedSubmission/Form/types.ts Re-exports shared feed submission types for form modules.
src/app/[locale]/contribute/FeedSubmission/Form/index.tsx Removes inline types and switches to shared types module.
src/app/[locale]/contribute/FeedSubmission/Form/components/FormLabelDescription.tsx New shared typography helper used in the form steps.
src/app/[locale]/contribute/FeedSubmission/Form/ThirdStep.tsx Updates imports to use shared types and new services path.
src/app/[locale]/contribute/FeedSubmission/Form/SecondStepRealtime.tsx Updates imports to use shared types and new services path.
src/app/[locale]/contribute/FeedSubmission/Form/SecondStep.tsx Updates imports to use shared types.
src/app/[locale]/contribute/FeedSubmission/Form/FourthStep.tsx Updates imports to use shared types.
src/app/[locale]/contribute/FeedSubmission/Form/FirstStep.tsx Updates imports to use shared types and new services path.
src/app/[locale]/contribute/FeedSubmission/FeedSubmission.tsx Marks as Client Component + fixes store/styles import paths.

Skill applied: vercel-react-best-practices (custom)

Comments suppressed due to low confidence (5)

src/app/[locale]/metrics/_components/Analytics/GTFSNoticeAnalytics/GTFSNoticeAnalytics.tsx:5

  • This file uses useRouter from next/navigation for in-app navigation, but routing is locale-prefixed via next-intl. Using the non-locale-aware router risks navigating from /fr/... to non-prefixed URLs. Switch to the locale-aware useRouter from src/i18n/navigation (or construct URLs with getPathname) so metric-to-metric navigation preserves locale.
    src/app/[locale]/metrics/_components/Analytics/GTFSFeatureAnalytics/GTFSFeatureAnalytics.tsx:5
  • This file uses useRouter from next/navigation but relies on locale-prefixed routes. To avoid dropping the /fr prefix during navigation, use the locale-aware useRouter from src/i18n/navigation (or getPathname to build localized hrefs) for all router.push(...) calls.
    src/app/[locale]/metrics/_components/Analytics/GBFSNoticeAnalytics/GBFSNoticeAnalytics.tsx:5
  • This file uses useRouter from next/navigation, but these pages are locale-prefixed using next-intl (/fr/...). Non-locale-aware navigation can send users to the wrong locale. Switch to useRouter from src/i18n/navigation (or build paths with getPathname) so router.push(...) keeps the active locale.
    src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx:11
  • This module is already being updated for import paths; it also uses useRouter from next/navigation (see earlier import) and constructs absolute paths like /feeds/... and /metrics/.... Since routing is locale-prefixed via next-intl, non-locale-aware navigation can drop the /fr prefix. Prefer useRouter from src/i18n/navigation (or getPathname) so navigation stays in the active locale.
    src/app/[locale]/metrics/_components/Analytics/GBFSVersionAnalytics/GBFSVersionAnalytics.tsx:5
  • This file uses useRouter from next/navigation even though routing is locale-prefixed via next-intl. To prevent losing the /fr prefix on navigation, switch to the locale-aware useRouter from src/i18n/navigation (or use getPathname to generate localized URLs) before pushing to other metrics pages.

Comment thread src/app/[locale]/metrics/gbfs/notices/page.tsx
Comment on lines 15 to 17
import { getLocationName } from '../../services/feeds/utils';
import { getAnalyticsBucketEndpoint } from '../../screens/Analytics/utils';
import { getAnalyticsBucketEndpoint } from '../../[locale]/metrics/_components/Analytics/utils';

Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

This saga depends on getAnalyticsBucketEndpoint() returning a real string, but it’s typed as string | undefined and is interpolated into fetch URLs below (which will become "undefined/..." if not set). Consider making the getter throw (or return a non-optional string after explicit initialization) and add an explicit guard/error message before doing any fetches, so failures are deterministic and easier to debug.

Copilot uses AI. Check for mistakes.
Comment thread src/app/[locale]/metrics/gtfs/notices/page.tsx
Comment thread src/app/[locale]/metrics/gtfs/feeds/page.tsx
Comment thread src/app/[locale]/metrics/gbfs/feeds/page.tsx
Comment thread src/app/[locale]/metrics/gbfs/versions/page.tsx
Comment on lines +14 to +16
} from '../../utils/analytics-types';
import { getLocationName } from '../../services/feeds/utils';
import { getAnalyticsBucketEndpoint } from '../../screens/Analytics/GTFSFeedAnalytics';
import { getAnalyticsBucketEndpoint } from '../../[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalytics';
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

getAnalyticsBucketEndpoint is being imported from a React component module under app/[locale]/.... This couples saga/data code to a UI component and makes it easy to end up fetching with an unset endpoint (it’s string | undefined, but it’s interpolated into URLs later). Move the bucket-endpoint getter/setter into a shared non-UI module (e.g. src/app/utils/analytics-bucket-endpoint.ts) and have both the saga and the component import from there; also fail fast with a clear error when the endpoint isn’t set instead of building undefined/... URLs.

Copilot uses AI. Check for mistakes.
Comment thread src/app/[locale]/metrics/gtfs/features/page.tsx
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

*Lighthouse ran on https://mobilitydatabase-pd3jh68zw-mobility-data.vercel.app/ * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 100 🟢 94 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-pd3jh68zw-mobility-data.vercel.app/feeds * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 85 🟠 87 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-pd3jh68zw-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🔴 46 🟢 94 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-pd3jh68zw-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 95 🟠 84 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-pd3jh68zw-mobility-data.vercel.app/feeds/gbfs/gbfs-flamingo_porirua * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 79 🟢 94 🟢 96 🟢 100

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.

SSR: Legacy Router Migration Split 3 (Add Feed + Metrics)

2 participants