aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/app/maps
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/app/maps')
-rw-r--r--src/frontend/app/maps/styleloader.ts15
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);