From 3087aa2ea122a045952f3e80dfa81b4674b1a614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller-Grud?= Date: Mon, 12 Oct 2026 12:14:55 +0200 Subject: [PATCH 1/6] Refactor: Make sighting types match the GraphQL API Allow null in every UfoSighting field except id, like the Sighting type in the schem, and show readable fallbacks when values are missing. Map the URL sort names to the API's SightingSort enum. Refs #34 --- frontend/src/components/SightingList.tsx | 7 ++-- frontend/src/components/SightingMap.css | 8 ++++ frontend/src/components/SightingMap.tsx | 15 ++++++- frontend/src/pages/SightingDetailPage.tsx | 2 +- frontend/src/tests/SightingList.test.tsx | 31 +++++++++++++- frontend/src/tests/SightingMap.test.tsx | 15 ++++++- frontend/src/tests/format-sighting.test.ts | 13 ++++++ frontend/src/types/ufo-sighting.ts | 47 ++++++++++++++-------- frontend/src/utils/filter-sightings.ts | 10 ++--- frontend/src/utils/format-sighting.ts | 14 +++++-- 10 files changed, 129 insertions(+), 33 deletions(-) diff --git a/frontend/src/components/SightingList.tsx b/frontend/src/components/SightingList.tsx index 341112c..af8bd6d 100644 --- a/frontend/src/components/SightingList.tsx +++ b/frontend/src/components/SightingList.tsx @@ -4,6 +4,7 @@ import { formatDate, formatDuration, formatLocation, + formatShape, } from '../utils/format-sighting' import SightingMap from './SightingMap' import './SightingList.css' @@ -46,21 +47,21 @@ function SightingList({ sightings }: SightingListProps) { {formatLocation(sighting)} -