fix(client): settle the two findings Sonar raised on the audit branch

The farthest-stop reduce gets its explicit seed (the guard above already refuses an empty list, the seed makes that local), and the toast pill moves into its own component so the host stays below the complexity ceiling.
This commit is contained in:
Maurice
2026-09-02 19:33:54 +02:00
committed by Maurice
parent ed3216f65d
commit c5d10dfd6f
2 changed files with 24 additions and 21 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ export const getAccommodationAnchors = (
const farthestFrom = (h: Accommodation): EdgeStop | undefined => {
if (!stops?.length) return undefined
const from = at(h)
const far = stops.reduce((a, b) => (haversineKm(from, b) > haversineKm(from, a) ? b : a))
const far = stops.reduce((a, b) => (haversineKm(from, b) > haversineKm(from, a) ? b : a), stops[0])
return { isPlace: true, time: null, lat: far.lat, lng: far.lng }
}
const hasStops = !!stops?.length