Commit 047dbca
committed
refactor: consolidate duplicated helpers, extract shared factories, drop dead code
Behaviour-preserving structural cleanup across the monorepo. No functional
changes except one deliberate display refinement (noted below). Full suite,
type-check, and lint pass.
Shared helpers / dedup:
- core: new `fetchJson(url, { timeoutMs, headers, label, userAgent, nullOnError,
errorMessage, init })`; migrated ~31 inline AbortController/AbortSignal fetch
sites across integrations onto it, each preserving its exact timeout, headers,
User-Agent presence, and throw-vs-null error mode. Added `haversineKm` and
routed fuel / overlay-nautical / overlay-natural-events / ev-charging /
parking / geocoding off their local great-circle copies. New `safeEqual`
util (apps/api) and `useExploreFilters` hook (core).
- web: deduped `formatBytes` / `formatRelativeTime` / `formatDistance` onto lib
helpers; extracted `floatingChipSx`, `ResultListItem`/`ResultList`,
`removeLayerAndSource`/`upsertGeoJsonSource` (layerStyleUtils), `OverlayLegend`,
`useStyleSyncedLayer`, admin `ServiceStatusChip`/`MetaRow`,
`useDataSourceAttribution`, `PanelDetailHeader`/`SectionLabel`.
Config-driven integration factories (exact-match sites only; divergent providers
left explicit):
- `defineTransitProvider`, `createTidesIntegration`, `createBboxPhotoProvider`
(integration-framework / integration-photos); geocoding `resolveEndpoint` +
shared types; isochrone types re-exported from the framework contract.
apps/api integration-host: extracted `buildIntegrationContext` /
`buildIntegrationDb` / `warnInvalidConfig` so cold start and reload share one
context builder; made reload emit `integration.error` + warn on duplicate id,
symmetric with cold start.
Dead code removed: core `geo.ts` + unused coordinate helpers; apps/api `MemCache`
+ `road-snap`; web `DirectionsDestinationMarker` + `useIntegrationAttribution`;
4 duplicate `photos-*/types.ts` + 6 duplicate `geocoding-*/types.ts`; duplicate
`knowledge-ourairports/csv.ts` (test relocated to ourairports-data); dead apps/api
knowledge types.
Display refinement: shared `formatBytes` now renders TB-scale sizes as "TB"
rather than overflowing into "GB" — the only observable change.1 parent dc05e24 commit 047dbca
133 files changed
Lines changed: 2168 additions & 2917 deletions
File tree
- apps
- api/src
- routes
- services
- isochrone
- knowledge
- utils
- web/src
- components
- admin
- activity
- integrations
- services
- map
- layers
- panels
- category
- datasource
- place
- transit
- search
- ui
- lib
- integrations
- bike-sharing/providers
- car-sharing/providers
- ev-charging/providers
- fuel/providers
- geocoding-db-ris
- geocoding-entur
- geocoding-maptiler
- geocoding-nominatim
- geocoding-pelias
- geocoding-photon
- geocoding
- knowledge-marine-weather
- knowledge-ourairports
- knowledge-tides-canada
- knowledge-tides-ioc
- knowledge-tides-norway
- knowledge-tides-pegelonline
- knowledge-wikidata
- overlay-air-quality
- overlay-earthquakes
- overlay-environment
- overlay-hiking
- overlay-natural-events
- overlay-nautical
- overlay-ourairports
- overlay-traffic-tomtom
- overlay-wildfires
- overlay-winter-sports
- parking/providers
- photos-flickr
- photos-mapillary
- photos-panoramax
- photos-wikimedia
- photos
- reviews-mangrove
- scooter-sharing/providers
- transit-db-vendo
- transit-entur
- transit-gtfs-local
- transit-hafas
- transit-irail
- transit-mbta
- transit-opentransportdata-ch
- transit-otp
- transit-overpass
- transit-ris-routing
- transit-tfl
- transit-transitland
- packages
- core/src
- hooks
- utils
- integration-framework
- src
- ourairports-data/__tests__
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | 34 | | |
42 | 35 | | |
43 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
2 | 13 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
25 | 22 | | |
26 | 23 | | |
27 | 24 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | 125 | | |
174 | 126 | | |
175 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 47 | | |
55 | 48 | | |
56 | 49 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | 195 | | |
203 | 196 | | |
204 | 197 | | |
| |||
427 | 420 | | |
428 | 421 | | |
429 | 422 | | |
430 | | - | |
| 423 | + | |
431 | 424 | | |
432 | 425 | | |
433 | 426 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | 58 | | |
66 | 59 | | |
67 | 60 | | |
| |||
118 | 111 | | |
119 | 112 | | |
120 | 113 | | |
121 | | - | |
| 114 | + | |
122 | 115 | | |
123 | 116 | | |
124 | 117 | | |
| |||
0 commit comments