Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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
useRouterfromnext/navigationfor 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-awareuseRouterfromsrc/i18n/navigation(or construct URLs withgetPathname) so metric-to-metric navigation preserves locale.
src/app/[locale]/metrics/_components/Analytics/GTFSFeatureAnalytics/GTFSFeatureAnalytics.tsx:5 - This file uses
useRouterfromnext/navigationbut relies on locale-prefixed routes. To avoid dropping the/frprefix during navigation, use the locale-awareuseRouterfromsrc/i18n/navigation(orgetPathnameto build localized hrefs) for allrouter.push(...)calls.
src/app/[locale]/metrics/_components/Analytics/GBFSNoticeAnalytics/GBFSNoticeAnalytics.tsx:5 - This file uses
useRouterfromnext/navigation, but these pages are locale-prefixed using next-intl (/fr/...). Non-locale-aware navigation can send users to the wrong locale. Switch touseRouterfromsrc/i18n/navigation(or build paths withgetPathname) sorouter.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
useRouterfromnext/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/frprefix. PreferuseRouterfromsrc/i18n/navigation(orgetPathname) so navigation stays in the active locale.
src/app/[locale]/metrics/_components/Analytics/GBFSVersionAnalytics/GBFSVersionAnalytics.tsx:5 - This file uses
useRouterfromnext/navigationeven though routing is locale-prefixed via next-intl. To prevent losing the/frprefix on navigation, switch to the locale-awareuseRouterfromsrc/i18n/navigation(or usegetPathnameto generate localized URLs) before pushing to other metrics pages.
| import { getLocationName } from '../../services/feeds/utils'; | ||
| import { getAnalyticsBucketEndpoint } from '../../screens/Analytics/utils'; | ||
| import { getAnalyticsBucketEndpoint } from '../../[locale]/metrics/_components/Analytics/utils'; | ||
|
|
There was a problem hiding this comment.
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.
| } 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'; |
There was a problem hiding this comment.
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.
|
*Lighthouse ran on https://mobilitydatabase-pd3jh68zw-mobility-data.vercel.app/ * (Desktop)
*Lighthouse ran on https://mobilitydatabase-pd3jh68zw-mobility-data.vercel.app/feeds * (Desktop)
*Lighthouse ran on https://mobilitydatabase-pd3jh68zw-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
*Lighthouse ran on https://mobilitydatabase-pd3jh68zw-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
*Lighthouse ran on https://mobilitydatabase-pd3jh68zw-mobility-data.vercel.app/feeds/gbfs/gbfs-flamingo_porirua * (Desktop)
|
332766d to
84299af
Compare
Summary:
closes #25
This PR moves the following pages out of the legacy router and into NextJs App Router
Expected behavior:
All these pages and URLs should have the exact same behaviour as they previously did
Testing tips:
Flows to test out
Please make sure these boxes are checked before submitting your pull request - thanks!
yarn testto make sure you didn't break anything