diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-10-13 00:14:56 +0200 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-10-13 00:14:56 +0200 |
| commit | 2da9964e49e64c02767342d2de675b776e8e6cda (patch) | |
| tree | 71bdae38ccf86afb01a673c9a9f3c90421b5b64c /src/frontend/app/maps | |
| parent | 497a2893465bf0cd84cf6d3cc9023daba336f253 (diff) | |
Use openfreemapinstead of self-hosting, improve stop display, improve dark mode
Diffstat (limited to 'src/frontend/app/maps')
| -rw-r--r-- | src/frontend/app/maps/styleloader.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/frontend/app/maps/styleloader.ts b/src/frontend/app/maps/styleloader.ts index cf285a5..08086f1 100644 --- a/src/frontend/app/maps/styleloader.ts +++ b/src/frontend/app/maps/styleloader.ts @@ -1,9 +1,22 @@ import type { StyleSpecification } from "react-map-gl/maplibre"; +import type { Theme } from "~/AppContext"; export async function loadStyle( styleName: string, - colorScheme: string, + colorScheme: Theme, ): Promise<StyleSpecification> { + if (styleName == "openfreemap") { + const url = "/maps/styles/openfreemap-any.json"; + + const resp = await fetch(url); + if (!resp.ok) { + throw new Error(`Failed to load style: ${url}`); + } + + const style = await resp.json(); + return style as StyleSpecification; + } + const stylePath = `/maps/styles/${styleName}-${colorScheme}.json`; const resp = await fetch(stylePath); |
