Commit Graph

79 Commits

Author SHA1 Message Date
fegger c0f34b9e2a Update CHECKLIST.md 2026-05-10 09:49:22 +02:00
fegger ce2a900545 Add correlation IDs and tests for monitoring
Generate short UUIDs in API route catch blocks to aid debugging.
Update existing API tests to assert the correlation ID. Add unit
tests for `useJourneys` and `useBikeRoute` hooks, and component
tests for `EventCard` and `CalendarView`.
2026-05-10 08:59:17 +02:00
fegger 7abfddd607 Add debounce, theme toggle, and calendar optimization
Implement 400ms debounce with AbortController in useGeocode and
useDestinationStation to prevent excessive API calls. Add dark mode
toggle via new useTheme hook, persisting preference to localStorage
and applying to document root.

Pre-group calendar events by date using a Map in CalendarView to
replace O(n) filter operations with O(1) lookups.
2026-05-10 03:39:30 +02:00
fegger 28c25c32ab Refactor API routes and hooks to use library clients
- Wire `api/geocode` and `api/bike-route` to use `GeocodingClient`
  and `BikeRoutingClient` instead of raw fetch calls
- Move `parseHafasJourneys` from `useJourneys` to `hafas-client`
- Remove dead code `src/lib/live-status-utils.ts`
- Update test setup to import `@testing-library/jest-dom/vitest`
2026-05-10 03:23:07 +02:00
fegger 77b8c6db98 Rewrite implementation checklist and fix runtime bugs
Update CHECKLIST.md and REWRITE_PLAN.md to reflect the current
post-rewrite status and remaining tasks.

- Add input validation to /api/hafas route to enforce request shape
  and cap results
- Fix SSR crash in useBikeRoute by using relative fetch URLs
- Wire CalendarPanel to fetch calendar events and merge them into the
  global events store
2026-05-10 03:09:38 +02:00
fegger c869d4958e Upgrade Next.js to v16 and refactor API client
Bump Next.js from v9 to v16.2.6 and add node-ical to
serverExternalPackages. Remove Geist font dependencies in favor
of system fonts. Fix state updates in geocode hooks to prevent
stale closures. Expose ApiClient methods as public and improve
error handling in fetchWithRetry.
2026-05-10 02:07:47 +02:00
fegger a7fcbd811e Refactor API clients and update project structure for TimeToLeave 2026-05-10 01:47:22 +02:00
fegger 7c345785a7 Add Docker support with multi-stage build and standalone output 2026-05-10 00:42:39 +02:00
fegger 6af44b5c13 Simplify hafas time midnight test 2026-05-10 00:14:14 +02:00
fegger 85dfeb3526 Fix midnight hour format to ensure "00" instead of "24" 2026-05-10 00:08:56 +02:00
fegger 0e451bf51e Refactor hafasDateTime to use Intl.DateTimeFormat for Vienna TZ 2026-05-09 23:57:41 +02:00
fegger 2737bac3a9 Document limitation of getTimezoneOffsetMinutes helper 2026-05-09 23:47:37 +02:00
fegger bbc0f312d8 Document ambiguous time resolution during DST fallback 2026-05-09 23:43:59 +02:00
fegger b27dd10470 Refactor HAFAS time parsing to handle DST transitions
Replace naive timezone offset calculation with a verification loop.
Try plausible offsets (CET/CEST), verify against actual offset at
candidate timestamp, and return the first match. This correctly
handles daylight saving time transitions in Vienna.
2026-05-09 23:38:13 +02:00
fegger 9d2ced4eb6 rewrite phase 10 2026-05-09 22:47:17 +02:00
fegger 3b6bb9d108 rewrite phase 9 2026-05-09 22:17:16 +02:00
fegger 556f96836c feat: Complete Phase 9 - Fix Broken Tests for geocoding, bike route, and calendar utils. Includes robust date parsing in calendar-utils and cache bypass logic for geocoding API failure. 2026-05-09 21:14:37 +02:00
fegger 2b509f58dc Complete migration checklist and update tests
Mark completed items in CHECKLIST.md. Update API tests to use
NextRequest instead of Request and fix type assertions. Add missing
imports in unit tests for calendar and countdown utils.
2026-05-09 19:26:37 +02:00
fegger 548190bc81 rewrite phase 7 2026-05-09 16:46:39 +02:00
fegger a8700cedc8 rewrite phase 6 2026-05-09 16:13:29 +02:00
fegger b1c3cb99bd rewrite phase 5 2026-05-09 15:34:57 +02:00
fegger edeb8ef8e3 rewrite phase 5 2026-05-09 14:57:28 +02:00
fegger 3d2aea7f7c Mark completed custom hooks in checklist 2026-05-09 13:56:55 +02:00
fegger facb75e294 rewrite phase 4 2026-05-09 13:37:54 +02:00
fegger 4b42695717 rewrite phase 3 2026-05-09 12:15:23 +02:00
fegger 3b87b8c4e5 Implement real API clients and update types
Replace mock data in geocoding, HAFAS, and bike routing clients with
actual implementations using fetch and appropriate interfaces. Update
typescript definitions to match the new data structures, including
Journey, Station, and BikeRoute. Add vitest and related testing
dependencies, replacing the placeholder test script with actual tests
for the new client logic. Refactor calendar and countdown utilities to
use the new types and remove unused files.

Implement real API clients and update types

Replace mock data in HafasClient, GeocodingClient, and
BikeRoutingClient with actual fetch implementations. Update
types to match API responses and add Vitest tests.
2026-05-09 11:55:20 +02:00
fegger b131e3c69a Rewrite to Node.js
Phases 1 and 2.
2026-05-09 11:00:21 +02:00
fegger 4133d0e9c8 Refactor endpoint tests for reliability and isolation
- Set fixed test port before requiring server
- Mock global fetch to avoid external network calls
- Implement server readiness check via health endpoint
- Add explicit mock assertions for HAFAS proxy tests
- Split large test block into focused describe sections
2026-05-09 09:52:24 +02:00
fegger 8e02656431 initial commit 2026-05-09 09:30:52 +02:00