Repository navigation
Add drivers page - #5
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a drivers season explorer (UI + API) backed by existing CSV mock data, enabling /drivers to list drivers for a selected year.
Changes:
- Introduces drivers season response/types and a new
/api/driversendpoint backed by a new server service. - Extends championship mocks to derive per-season driver lists + ordering, and adds a dedicated driver-season mock accessor.
- Adds drivers UI components (explorer + cards) and test coverage for the explorer and API route.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/championship.ts | Adds driver-season DTO/types used by API + UI. |
| src/lib/server/drivers.ts | New server service for fetching driver season data (mock-backed) + error mapping. |
| src/lib/mocks/championships.ts | Refactors driver ID collection, adds sorting helper, and adds getDriverSeasonFromMocks. |
| src/components/drivers/DriversExplorer.tsx | Client-side explorer component that fetches and renders driver season cards. |
| src/components/drivers/DriversExplorer.spec.tsx | Tests for explorer: ordering, refetch on season change, error state. |
| src/components/drivers/DriverCard.tsx | Driver card link to /drivers/[id]. |
| src/app/layout.tsx | Adjusts main layout sizing (min-h-0) for scroll behavior. |
| src/app/drivers/page.tsx | Implements drivers page UI and client-side fetching (currently duplicating explorer logic). |
| src/app/api/drivers/route.ts | Adds /api/drivers GET route (mirrors championships route behavior). |
| src/app/api/drivers/route.spec.ts | Tests for /api/drivers route behavior (valid/invalid/default year). |
| src/app/championships/[year]/page.tsx | Removes the dynamic championship year page route. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.