Skip to content

Commit 3b9a084

Browse files
committed
Map style improvements
1 parent d393319 commit 3b9a084

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

website/src/styles/global.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
--hero-to: #ffffff;
6161
--shadow: rgba(226, 232, 240, 0.5);
6262

63+
/* Map overlay colors — satellite base is always dark, no dark-mode swap */
64+
--neaps-map-text: #ffffff;
65+
--neaps-map-bg: #000000;
66+
6367
/* Status colors */
6468
--status-green-bg: #dcfce7;
6569
--status-green-text: #166534;

website/src/utils/useMapStyle.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,18 @@ function buildStyle(): Promise<StyleSpecification> {
4040
promise = fetch(VECTOR_SOURCE_URL)
4141
.then((r) => r.json())
4242
.then((style: StyleSpecification) => {
43-
// Insert satellite imagery above fill/background layers but below
44-
// labels and lines. The fills act as a loading placeholder so there
45-
// is no white flash while satellite tiles load.
46-
const firstSymbolIdx = style.layers.findIndex(
47-
(l: LayerSpecification) => l.type === "symbol" || l.type === "line",
43+
// Partition layers: fills/backgrounds below satellite as a loading
44+
// placeholder (avoids white flash), everything else on top.
45+
const fills = style.layers.filter(
46+
(l: LayerSpecification) =>
47+
l.type === "background" || l.type === "fill",
48+
);
49+
const rest = style.layers.filter(
50+
(l: LayerSpecification) =>
51+
l.type !== "background" && l.type !== "fill",
4852
);
49-
const insertAt =
50-
firstSymbolIdx === -1 ? style.layers.length : firstSymbolIdx;
5153

52-
const layers = [
53-
...style.layers.slice(0, insertAt),
54-
SATELLITE_LAYER,
55-
...style.layers.slice(insertAt),
56-
];
54+
const layers = [...fills, SATELLITE_LAYER, ...rest];
5755

5856
const composite: StyleSpecification = {
5957
...style,

0 commit comments

Comments
 (0)