@sjvair/monitor-map 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/LoadScreen.svelte +3 -3
- package/dist/lib/MapLegend.svelte +1 -1
- package/dist/lib/MonitorDetailPanel.svelte +5 -3
- package/dist/lib/MonitorMapLayout.svelte +41 -59
- package/dist/lib/components/MapLayersDisplayOptions.svelte +4 -4
- package/dist/lib/components/SegmentedControl.svelte +0 -9
- package/dist/lib/components/ui/button/button.svelte.d.ts +44 -44
- package/dist/lib/ev-stations/components/EvStationsDisplayOptions.svelte +3 -3
- package/dist/lib/hms/components/HMSFireLegend.svelte +4 -4
- package/dist/lib/hms/hms-smoke-map-integration.svelte.js +15 -11
- package/dist/lib/map/Menu.svelte +6 -5
- package/dist/lib/monitors/components/MonitorMarkersLegend.svelte +5 -5
- package/dist/lib/monitors/components/MonitorSubscriptionManager.svelte +16 -9
- package/dist/lib/monitors/components/MonitorsDisplayOptions.svelte +1 -1
- package/dist/lib/search/Search.svelte +15 -15
- package/package.json +25 -25
- package/src/lib/LoadScreen.svelte +3 -3
- package/src/lib/MapLegend.svelte +1 -1
- package/src/lib/MonitorDetailPanel.svelte +5 -3
- package/src/lib/MonitorMapLayout.svelte +41 -59
- package/src/lib/collocation-sites/collocations-map-integration.svelte.ts +1 -4
- package/src/lib/components/MapLayersDisplayOptions.svelte +4 -4
- package/src/lib/components/SegmentedControl.svelte +0 -9
- package/src/lib/ev-stations/components/EvStationsDisplayOptions.svelte +3 -3
- package/src/lib/hms/components/HMSFireLegend.svelte +4 -4
- package/src/lib/hms/hms-smoke-map-integration.svelte.ts +15 -11
- package/src/lib/map/Menu.svelte +6 -5
- package/src/lib/monitors/components/MonitorMarkersLegend.svelte +5 -5
- package/src/lib/monitors/components/MonitorSubscriptionManager.svelte +16 -9
- package/src/lib/monitors/components/MonitorsDisplayOptions.svelte +1 -1
- package/src/lib/search/Search.svelte +15 -15
|
@@ -111,34 +111,34 @@
|
|
|
111
111
|
|
|
112
112
|
<div
|
|
113
113
|
class={[
|
|
114
|
-
"flex flex-col bg-white shadow-md
|
|
115
|
-
collapsed ? "
|
|
114
|
+
"flex flex-col overflow-hidden bg-white shadow-md transition-all duration-300 select-none",
|
|
115
|
+
collapsed ? "h-12 w-12 rounded-full" : "w-90 rounded-3xl",
|
|
116
116
|
!collapsed && results.length ? "max-h-90" : "max-h-12"
|
|
117
117
|
]}
|
|
118
118
|
use:clickOutside
|
|
119
119
|
>
|
|
120
|
-
<div class="flex
|
|
120
|
+
<div class="flex h-12 w-full shrink-0 items-center">
|
|
121
121
|
<button
|
|
122
|
-
class="
|
|
122
|
+
class="bg-brand flex h-12 w-12 shrink-0 items-center justify-center rounded-full border-4 border-white"
|
|
123
123
|
onclick={openSearch}
|
|
124
124
|
aria-label="Open search"
|
|
125
125
|
>
|
|
126
126
|
<SearchIcon size="24" color="#FFFFFF" />
|
|
127
127
|
</button>
|
|
128
|
-
<div class="
|
|
128
|
+
<div class="flex h-full w-full items-center overflow-hidden">
|
|
129
129
|
<input
|
|
130
130
|
bind:this={inputEl}
|
|
131
131
|
bind:value={searchText}
|
|
132
132
|
oninput={debouncedSearch}
|
|
133
133
|
type="text"
|
|
134
134
|
placeholder="Search monitors or locations..."
|
|
135
|
-
class="h-full
|
|
135
|
+
class="h-full w-full border-none bg-transparent px-2 text-sm outline-none"
|
|
136
136
|
tabindex={collapsed ? -1 : 0}
|
|
137
137
|
/>
|
|
138
138
|
{#if searchText && !collapsed}
|
|
139
139
|
<button
|
|
140
140
|
onclick={clearSearch}
|
|
141
|
-
class="px-2 text-gray-400 hover:text-gray-600
|
|
141
|
+
class="cursor-pointer px-2 text-xl leading-none text-gray-400 hover:text-gray-600"
|
|
142
142
|
aria-label="Clear search">×</button
|
|
143
143
|
>
|
|
144
144
|
{/if}
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
</div>
|
|
147
147
|
<div
|
|
148
148
|
class={[
|
|
149
|
-
"overflow-y-auto transition-all duration-300
|
|
149
|
+
"divide-y divide-gray-100 overflow-y-auto transition-all duration-300",
|
|
150
150
|
!collapsed ? "max-h-80" : "max-h-0"
|
|
151
151
|
]}
|
|
152
152
|
>
|
|
@@ -154,30 +154,30 @@
|
|
|
154
154
|
{#if result.type === "monitor"}
|
|
155
155
|
<button
|
|
156
156
|
onclick={() => selectMonitor(result)}
|
|
157
|
-
class="flex
|
|
157
|
+
class="flex h-12 w-full items-center bg-white px-4 text-left hover:brightness-95"
|
|
158
158
|
>
|
|
159
159
|
{#if result.logo.url}
|
|
160
160
|
<img
|
|
161
161
|
src={result.logo.url}
|
|
162
162
|
alt={result.logo.alt}
|
|
163
|
-
class="
|
|
163
|
+
class="mr-3 h-10 w-10 shrink-0 object-contain"
|
|
164
164
|
/>
|
|
165
165
|
{/if}
|
|
166
|
-
<span class="text-sm
|
|
166
|
+
<span class="truncate text-sm">{result.monitor.name}</span>
|
|
167
167
|
</button>
|
|
168
168
|
{:else}
|
|
169
169
|
{@const comma = result.feature.place_name.indexOf(",")}
|
|
170
170
|
<button
|
|
171
171
|
onclick={() => selectGeocode(result)}
|
|
172
|
-
class="flex
|
|
172
|
+
class="flex h-12 w-full items-center bg-white px-4 text-left hover:brightness-95"
|
|
173
173
|
>
|
|
174
|
-
<span class="svg-icon location-on bg-brand
|
|
174
|
+
<span class="svg-icon location-on bg-brand mr-3 h-6 w-6 shrink-0"></span>
|
|
175
175
|
<div class="min-w-0">
|
|
176
|
-
<p class="text-sm font-medium
|
|
176
|
+
<p class="truncate text-sm font-medium">
|
|
177
177
|
{result.feature.place_name.substring(0, comma < 0 ? undefined : comma)}
|
|
178
178
|
</p>
|
|
179
179
|
{#if comma >= 0}
|
|
180
|
-
<p class="text-
|
|
180
|
+
<p class="text-muted-foreground truncate text-xs">
|
|
181
181
|
{result.feature.place_name.substring(comma + 1).trim()}
|
|
182
182
|
</p>
|
|
183
183
|
{/if}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjvair/monitor-map",
|
|
3
3
|
"description": "SJVAir's interactive monitor map",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.8",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite dev",
|
|
7
7
|
"build:local": "PROD_MODE=local vite build",
|
|
@@ -31,54 +31,54 @@
|
|
|
31
31
|
"**/*.css"
|
|
32
32
|
],
|
|
33
33
|
"peerDependencies": {
|
|
34
|
+
"@internationalized/date": "^3.12.3",
|
|
34
35
|
"@sveltejs/enhanced-img": "^0.11.0",
|
|
36
|
+
"bits-ui": "^2.18.1",
|
|
35
37
|
"sv-router": "^0.16.2",
|
|
36
38
|
"svelte": "^5.0.0"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@eslint/compat": "^2.1.0",
|
|
40
42
|
"@eslint/js": "^10.0.1",
|
|
41
|
-
"@fontsource-variable/inter": "^5.
|
|
43
|
+
"@fontsource-variable/inter": "^5.3.0",
|
|
42
44
|
"@sveltejs/enhanced-img": "^0.11.0",
|
|
43
45
|
"@sveltejs/package": "^2.5.8",
|
|
44
46
|
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
|
45
|
-
"@tailwindcss/vite": "^4.3.
|
|
46
|
-
"@types/node": "^26.1.
|
|
47
|
-
"eslint": "^10.
|
|
47
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
48
|
+
"@types/node": "^26.1.2",
|
|
49
|
+
"eslint": "^10.8.0",
|
|
48
50
|
"eslint-config-prettier": "^10.1.8",
|
|
49
|
-
"eslint-plugin-svelte": "^3.
|
|
50
|
-
"globals": "^17.
|
|
51
|
-
"postcss": "^8.5.
|
|
52
|
-
"prettier": "^3.9.
|
|
51
|
+
"eslint-plugin-svelte": "^3.22.0",
|
|
52
|
+
"globals": "^17.9.0",
|
|
53
|
+
"postcss": "^8.5.25",
|
|
54
|
+
"prettier": "^3.9.6",
|
|
53
55
|
"prettier-plugin-svelte": "^4.1.1",
|
|
54
|
-
"prettier-plugin-tailwindcss": "^0.8.
|
|
55
|
-
"shadcn-svelte": "^1.
|
|
56
|
-
"svelte": "^5.56.
|
|
57
|
-
"svelte-check": "^4.7.
|
|
58
|
-
"tailwindcss": "^4.3.
|
|
56
|
+
"prettier-plugin-tailwindcss": "^0.8.1",
|
|
57
|
+
"shadcn-svelte": "^1.5.0",
|
|
58
|
+
"svelte": "^5.56.8",
|
|
59
|
+
"svelte-check": "^4.7.4",
|
|
60
|
+
"tailwindcss": "^4.3.3",
|
|
59
61
|
"tw-animate-css": "^1.4.0",
|
|
60
62
|
"typescript": "^6.0.3",
|
|
61
|
-
"typescript-eslint": "^8.
|
|
62
|
-
"vite": "^8.
|
|
63
|
+
"typescript-eslint": "^8.66.0",
|
|
64
|
+
"vite": "^8.2.0"
|
|
63
65
|
},
|
|
64
66
|
"dependencies": {
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@maptiler/sdk": "^4.0.2",
|
|
67
|
+
"@lucide/svelte": "^1.28.0",
|
|
68
|
+
"@maptiler/sdk": "^4.1.0",
|
|
68
69
|
"@maptiler/weather": "^3.1.1",
|
|
69
|
-
"@sjvair/sdk": "npm:@jsr/sjvair__sdk@^3.0.
|
|
70
|
+
"@sjvair/sdk": "npm:@jsr/sjvair__sdk@^3.0.3",
|
|
70
71
|
"@tstk/builtin-extensions": "npm:@jsr/tstk__builtin-extensions@^1.0.8",
|
|
71
72
|
"@tstk/utils": "npm:@jsr/tstk__utils@^1.1.2",
|
|
72
|
-
"@turf/area": "^7.
|
|
73
|
-
"@turf/clusters-dbscan": "^7.
|
|
74
|
-
"@turf/helpers": "^7.
|
|
73
|
+
"@turf/area": "^7.4.0",
|
|
74
|
+
"@turf/clusters-dbscan": "^7.4.0",
|
|
75
|
+
"@turf/helpers": "^7.4.0",
|
|
75
76
|
"@types/geojson": "^7946.0.16",
|
|
76
|
-
"bits-ui": "^2.18.1",
|
|
77
77
|
"clsx": "^2.1.1",
|
|
78
78
|
"color2k": "^2.0.4",
|
|
79
79
|
"date-fns": "^4.4.0",
|
|
80
80
|
"tailwind-merge": "^3.6.0",
|
|
81
|
-
"tailwind-variants": "^3.
|
|
81
|
+
"tailwind-variants": "^3.3.1",
|
|
82
82
|
"uplot": "^1.6.32"
|
|
83
83
|
},
|
|
84
84
|
"keywords": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<enhanced:img
|
|
40
40
|
src="./assets/logos/sjvair-parts/sjvair-icon.webp"
|
|
41
41
|
alt="SJVAir Icon"
|
|
42
|
-
class="icon inline-block h-24! w-auto! transition-all duration-500 ease-out
|
|
42
|
+
class="icon inline-block h-24! w-auto! object-contain transition-all duration-500 ease-out"
|
|
43
43
|
class:translate-x-0={loadScreenState.entered}
|
|
44
44
|
class:-translate-x-full={!loadScreenState.entered}
|
|
45
45
|
class:opacity-100={loadScreenState.entered}
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
<enhanced:img
|
|
49
49
|
src="./assets/logos/sjvair-parts/sjvair-sjv.webp"
|
|
50
50
|
alt="SJV"
|
|
51
|
-
class="sjv inline-block h-24! w-auto! transition-all duration-500 ease-out
|
|
51
|
+
class="sjv inline-block h-24! w-auto! object-contain transition-all duration-500 ease-out"
|
|
52
52
|
class:translate-y-0={loadScreenState.entered}
|
|
53
53
|
class:-translate-y-full={!loadScreenState.entered}
|
|
54
54
|
class:opacity-100={loadScreenState.entered}
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
<enhanced:img
|
|
58
58
|
src="./assets/logos/sjvair-parts/sjvair-air.webp"
|
|
59
59
|
alt="Air"
|
|
60
|
-
class="air inline-block h-24! w-auto! transition-all duration-500 ease-out
|
|
60
|
+
class="air inline-block h-24! w-auto! object-contain transition-all duration-500 ease-out"
|
|
61
61
|
class:translate-y-0={loadScreenState.entered}
|
|
62
62
|
class:translate-y-full={!loadScreenState.entered}
|
|
63
63
|
class:opacity-100={loadScreenState.entered}
|
package/src/lib/MapLegend.svelte
CHANGED
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
</span>
|
|
79
79
|
{/snippet}
|
|
80
80
|
|
|
81
|
-
<div class="flex h-full w-full flex-col overflow-y-auto bg-white">
|
|
81
|
+
<div class="tall:overflow-y-hidden flex h-full w-full flex-col overflow-y-auto bg-white">
|
|
82
82
|
<div
|
|
83
83
|
class="flex flex-col items-center justify-center gap-8 border-b border-gray-200 p-4 shadow-lg"
|
|
84
84
|
>
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
{/if}
|
|
108
108
|
</div>
|
|
109
109
|
|
|
110
|
-
<div class="flex flex-col items-center gap-12
|
|
110
|
+
<div class="tall:overflow-y-auto flex flex-col items-center gap-12 p-5 pt-10">
|
|
111
111
|
{#if monitor}
|
|
112
112
|
<div class="flex w-full justify-around">
|
|
113
113
|
{#if tempData}
|
|
@@ -123,7 +123,9 @@
|
|
|
123
123
|
{/if}
|
|
124
124
|
</div>
|
|
125
125
|
|
|
126
|
-
<
|
|
126
|
+
<div class="tall:block hidden">
|
|
127
|
+
<MonitorWidgetModal monitorId={monitor.id} />
|
|
128
|
+
</div>
|
|
127
129
|
<!-- eslint-disable-next-line @typescript-eslint/no-explicit-any -->
|
|
128
130
|
{#if (globalThis as any).USER?.is_authenticated}
|
|
129
131
|
<MonitorSubscriptionManager monitorId={monitor.id} />
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
import { hmsSmokeMapIntegration } from "$lib/hms/hms-smoke-map-integration.svelte";
|
|
23
23
|
import MapLegend from "$lib/MapLegend.svelte";
|
|
24
24
|
import Search from "$lib/search/Search.svelte";
|
|
25
|
+
import { searchParams } from "sv-router";
|
|
25
26
|
import { useMonitorMapRouter } from "./router-context";
|
|
26
27
|
|
|
27
28
|
interface Props {
|
|
@@ -53,6 +54,28 @@
|
|
|
53
54
|
|
|
54
55
|
let panelOpen = $derived(route.pathname.startsWith(`${basePath}/monitor/`));
|
|
55
56
|
|
|
57
|
+
// Keep monitorsManager.pollutant and the "pollutant" URL param in sync, both directions.
|
|
58
|
+
// init() only seeds pollutant on the manager's first-ever initialization; this effect is what
|
|
59
|
+
// applies a later "?pollutant=" change (e.g. navigating in from elsewhere) to an already-running manager.
|
|
60
|
+
$effect(() => {
|
|
61
|
+
const urlPollutant = route.search.pollutant;
|
|
62
|
+
if (
|
|
63
|
+
monitorsManager.initialized &&
|
|
64
|
+
(urlPollutant === "pm25" || urlPollutant === "o3") &&
|
|
65
|
+
monitorsManager.pollutant !== urlPollutant
|
|
66
|
+
) {
|
|
67
|
+
monitorsManager.pollutant = urlPollutant;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// ...and the reverse: reflect UI-driven pollutant changes (e.g. the display-options toggle) back to the URL.
|
|
72
|
+
$effect(() => {
|
|
73
|
+
const pollutant = monitorsManager.pollutant;
|
|
74
|
+
if (pollutant && searchParams.get("pollutant") !== pollutant) {
|
|
75
|
+
searchParams.set("pollutant", pollutant);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
56
79
|
$effect(() => {
|
|
57
80
|
if (mapManager.map && monitorsManager.initialized) {
|
|
58
81
|
mapManager.map.once("idle", () => disableLoadScreen());
|
|
@@ -108,11 +131,14 @@
|
|
|
108
131
|
);
|
|
109
132
|
</script>
|
|
110
133
|
|
|
134
|
+
<!--
|
|
111
135
|
<div class="shell" class:panel-open={panelOpen}>
|
|
136
|
+
-->
|
|
137
|
+
<div class="relative flex h-full w-full flex-col md:flex-row">
|
|
112
138
|
<LoadScreen />
|
|
113
139
|
<div class="relative flex-1 overflow-hidden">
|
|
114
140
|
<Map {integrations} />
|
|
115
|
-
<div class="
|
|
141
|
+
<div class="pointer-events-none absolute bottom-0 left-0 z-10">
|
|
116
142
|
<MapLegend />
|
|
117
143
|
</div>
|
|
118
144
|
<div class="absolute top-4 left-4 z-10">
|
|
@@ -129,65 +155,21 @@
|
|
|
129
155
|
</div>
|
|
130
156
|
</div>
|
|
131
157
|
</div>
|
|
132
|
-
<div
|
|
133
|
-
|
|
158
|
+
<div
|
|
159
|
+
class={[
|
|
160
|
+
"panel-containr w-full shrink-0 overflow-hidden",
|
|
161
|
+
panelOpen ? "h-1/2 md:h-full md:w-1/3" : "md:w-0"
|
|
162
|
+
]}
|
|
163
|
+
>
|
|
164
|
+
<div
|
|
165
|
+
class={[
|
|
166
|
+
"panel-contet h-full duration-300 ease-in-out",
|
|
167
|
+
panelOpen
|
|
168
|
+
? "translate-y-0 md:translate-x-0"
|
|
169
|
+
: "translate-y-full md:translate-x-full md:translate-y-0"
|
|
170
|
+
]}
|
|
171
|
+
>
|
|
134
172
|
{@render children()}
|
|
135
173
|
</div>
|
|
136
174
|
</div>
|
|
137
175
|
</div>
|
|
138
|
-
|
|
139
|
-
<style>
|
|
140
|
-
.shell {
|
|
141
|
-
display: flex;
|
|
142
|
-
position: relative;
|
|
143
|
-
width: 100%;
|
|
144
|
-
height: 100%;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.panel-container {
|
|
148
|
-
flex-shrink: 0;
|
|
149
|
-
overflow: hidden;
|
|
150
|
-
width: 0;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.shell.panel-open .panel-container {
|
|
154
|
-
width: 33.333vw;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.panel-content {
|
|
158
|
-
width: 33.333vw;
|
|
159
|
-
height: 100%;
|
|
160
|
-
transform: translateX(100%);
|
|
161
|
-
transition: transform 300ms ease-in-out;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.shell.panel-open .panel-content {
|
|
165
|
-
transform: translateX(0);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
@media (max-width: 768px) {
|
|
169
|
-
.shell {
|
|
170
|
-
flex-direction: column;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.panel-container {
|
|
174
|
-
width: 100vw;
|
|
175
|
-
height: 0;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.shell.panel-open .panel-container {
|
|
179
|
-
width: 100vw;
|
|
180
|
-
height: 50vh;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.panel-content {
|
|
184
|
-
width: 100vw;
|
|
185
|
-
height: 50vh;
|
|
186
|
-
transform: translateY(100%);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.shell.panel-open .panel-content {
|
|
190
|
-
transform: translateY(0);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
</style>
|
|
@@ -2,10 +2,7 @@ import { type Popup, type MapLayerEventType, type Map as MaptilerMap } from "@ma
|
|
|
2
2
|
import type { Geometry } from "geojson";
|
|
3
3
|
import { mapManager } from "$lib/map/map.svelte";
|
|
4
4
|
import { MapIconLayerIntegration } from "$lib/map/integrations/map-geojson-integration.svelte";
|
|
5
|
-
import {
|
|
6
|
-
CollocationIconManager,
|
|
7
|
-
getCollocationIconId
|
|
8
|
-
} from "./collocations-icon-manager.svelte";
|
|
5
|
+
import { CollocationIconManager, getCollocationIconId } from "./collocations-icon-manager.svelte";
|
|
9
6
|
import { TooltipManager } from "$lib/map/integrations/tooltip.svelte";
|
|
10
7
|
import { collocationSitesManager } from "./collocations.svelte";
|
|
11
8
|
import { monitorsManager } from "$lib/monitors/monitors.svelte";
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
<DisplayOption>
|
|
15
15
|
<p class="text-lg font-bold whitespace-nowrap underline">Map Layers</p>
|
|
16
|
-
<div class="flex gap-1
|
|
16
|
+
<div class="flex items-center gap-1">
|
|
17
17
|
<WindIcon size="16" />
|
|
18
18
|
<ToggleSwitch id="wind" label="Wind" bind:value={windMapIntegration.enabled}></ToggleSwitch>
|
|
19
19
|
</div>
|
|
20
20
|
{#if monitorsManager.pollutant === "pm25"}
|
|
21
|
-
<div class="flex gap-1
|
|
21
|
+
<div class="flex items-center gap-1">
|
|
22
22
|
<CrosshairIcon size="16" color="#4A5FC6" />
|
|
23
23
|
<ToggleSwitch
|
|
24
24
|
id="collocation-sites"
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
></ToggleSwitch>
|
|
28
28
|
</div>
|
|
29
29
|
{/if}
|
|
30
|
-
<div class="flex gap-1
|
|
30
|
+
<div class="flex items-center gap-1">
|
|
31
31
|
{#if fireIcon}
|
|
32
32
|
<img class="w-4" src={fireIcon.image.src} alt={fireIcon.image.alt} />
|
|
33
33
|
{/if}
|
|
34
34
|
<ToggleSwitch id="hms-fire" label="HMS Fire" bind:value={hmsFireMapIntegration.enabled}
|
|
35
35
|
></ToggleSwitch>
|
|
36
36
|
</div>
|
|
37
|
-
<div class="flex gap-1
|
|
37
|
+
<div class="flex items-center gap-1">
|
|
38
38
|
<WavesVerticalIcon size="16" />
|
|
39
39
|
<ToggleSwitch id="hms-smoke" label="HMS Smoke" bind:value={hmsSmokeMapIntegration.enabled}
|
|
40
40
|
></ToggleSwitch>
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { searchParams } from "sv-router";
|
|
3
|
-
import { untrack } from "svelte";
|
|
4
|
-
|
|
5
2
|
interface SegmentedControlProps {
|
|
6
3
|
segmentLabel?: string;
|
|
7
4
|
options: Array<{ label: string; value: string }>;
|
|
@@ -19,12 +16,6 @@
|
|
|
19
16
|
const checked = inner.querySelector<HTMLInputElement>("input:checked");
|
|
20
17
|
if (!checked) return;
|
|
21
18
|
|
|
22
|
-
// FIXME: this shouldn't live in this file
|
|
23
|
-
const pollutant = untrack(() => searchParams.get("pollutant"));
|
|
24
|
-
if (pollutant !== checked.value) {
|
|
25
|
-
untrack(() => searchParams.set("pollutant", checked.value));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
19
|
const fontSize = parseFloat(getComputedStyle(inner).fontSize);
|
|
29
20
|
const padding = fontSize; // 1em
|
|
30
21
|
const label = checked.closest("label") as HTMLLabelElement;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<DisplayOption>
|
|
10
|
-
<p class="
|
|
10
|
+
<p class="text-lg font-bold whitespace-nowrap underline">EV Stations</p>
|
|
11
11
|
<div class="mb-2 w-full text-xs">
|
|
12
12
|
<div class="w-fit">
|
|
13
13
|
<ToggleSwitch
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
/>
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
|
-
<label for="ev-lvl2" class="flex gap-1
|
|
20
|
+
<label for="ev-lvl2" class="flex cursor-pointer gap-1 whitespace-nowrap select-none">
|
|
21
21
|
<input
|
|
22
22
|
type="checkbox"
|
|
23
23
|
id="ev-lvl2"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
/>
|
|
31
31
|
Level 2
|
|
32
32
|
</label>
|
|
33
|
-
<label for="ev-lvl3" class="flex gap-1
|
|
33
|
+
<label for="ev-lvl3" class="flex cursor-pointer gap-1 whitespace-nowrap select-none">
|
|
34
34
|
<input
|
|
35
35
|
type="checkbox"
|
|
36
36
|
id="ev-lvl3"
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
{#if hmsFireMapIntegration.enabled && hmsFireMapIntegration.features.length > 0}
|
|
8
|
-
<div class="flex flex-col bg-white
|
|
9
|
-
<p class="text-center whitespace-nowrap
|
|
8
|
+
<div class="flex w-fit flex-col rounded bg-white p-1 shadow">
|
|
9
|
+
<p class="text-center font-semibold whitespace-nowrap">Fire Points</p>
|
|
10
10
|
<div class="flex flex-col">
|
|
11
11
|
{#each hmsFireMapIntegration.icons.iter as [, icon], idx (idx)}
|
|
12
|
-
<div class="flex gap-1
|
|
13
|
-
<div class="size-9
|
|
12
|
+
<div class="flex items-center gap-1">
|
|
13
|
+
<div class="flex size-9 items-center justify-center">
|
|
14
14
|
<img src={icon.image.src} alt={icon.image.alt} />
|
|
15
15
|
</div>
|
|
16
16
|
<span>{levels[idx]} MW</span>
|
|
@@ -32,19 +32,23 @@ class HMSSmokeMapIntegration extends MapGeoJSONIntegration<SmokeProperties> {
|
|
|
32
32
|
source: this.referenceId,
|
|
33
33
|
layout: {},
|
|
34
34
|
paint: {
|
|
35
|
-
"fill-color": [
|
|
36
|
-
"
|
|
37
|
-
"
|
|
35
|
+
"fill-color": [
|
|
36
|
+
"match",
|
|
37
|
+
["get", "density"],
|
|
38
|
+
"light",
|
|
39
|
+
"#bfc8c3",
|
|
40
|
+
"medium",
|
|
41
|
+
"#757b78",
|
|
38
42
|
"#333634"
|
|
39
43
|
],
|
|
40
|
-
"fill-opacity": ["match", ["get", "density"],
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
44
|
+
"fill-opacity": ["match", ["get", "density"], "light", 0.2, "medium", 0.3, 0.4],
|
|
45
|
+
"fill-outline-color": [
|
|
46
|
+
"match",
|
|
47
|
+
["get", "density"],
|
|
48
|
+
"light",
|
|
49
|
+
"#bfc8c3",
|
|
50
|
+
"medium",
|
|
51
|
+
"#757b78",
|
|
48
52
|
"#333634"
|
|
49
53
|
]
|
|
50
54
|
}
|
package/src/lib/map/Menu.svelte
CHANGED
|
@@ -44,19 +44,20 @@
|
|
|
44
44
|
class:w-0={isOpen}
|
|
45
45
|
class:h-0={isOpen}
|
|
46
46
|
class:opacity-0={isOpen}
|
|
47
|
-
class="relative size-10
|
|
47
|
+
class="relative flex size-10 items-center justify-center transition-all"
|
|
48
48
|
aria-label="Display Options"
|
|
49
49
|
>
|
|
50
50
|
<SlidersHorizontalIcon size="24" />
|
|
51
51
|
</button>
|
|
52
52
|
<div
|
|
53
|
-
class
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
class={[
|
|
54
|
+
"relative flex max-w-[90vw] items-center justify-center overflow-x-hidden overflow-y-scroll transition-all duration-250",
|
|
55
|
+
isOpen ? "h-55 w-135" : "h-0 w-0"
|
|
56
|
+
]}
|
|
56
57
|
>
|
|
57
58
|
<div
|
|
58
59
|
data-trigger
|
|
59
|
-
class="absolute top-0 left-0 flex h-fit w-full items-start
|
|
60
|
+
class="xs:justify-between absolute top-0 left-0 flex h-fit w-full flex-wrap items-start gap-2 p-2 sm:justify-evenly md:justify-between md:gap-4"
|
|
60
61
|
>
|
|
61
62
|
{@render children?.()}
|
|
62
63
|
</div>
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
);
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
|
-
<div class="min-w-50 flex
|
|
11
|
-
<p class="text-center whitespace-nowrap
|
|
10
|
+
<div class="flex min-w-50 flex-col rounded bg-white px-[1.5em] py-[0.5em] shadow">
|
|
11
|
+
<p class="text-center font-semibold whitespace-nowrap">
|
|
12
12
|
{label} Concentration
|
|
13
13
|
</p>
|
|
14
14
|
<div class="map-legend-bar inline-block h-[1.5em]"> </div>
|
|
15
|
-
<div class="
|
|
16
|
-
<div class="w-1/5 shrink-0
|
|
15
|
+
<div class="mb-[1.5em] flex">
|
|
16
|
+
<div class="h-[0.5em] w-1/5 shrink-0 border-l border-black">
|
|
17
17
|
<span class="relative top-[0.5em] right-[0.3em]">0</span>
|
|
18
18
|
</div>
|
|
19
19
|
{#each values as value, idx (idx)}
|
|
20
|
-
<div class="w-1/5 shrink-0
|
|
20
|
+
<div class="h-[0.5em] w-1/5 shrink-0 border-l border-black last:relative last:right-px">
|
|
21
21
|
<span class="relative top-[0.5em] {idx >= 3 ? 'right-[0.8em]' : 'right-[0.5em]'}"
|
|
22
22
|
>{value}</span
|
|
23
23
|
>
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
const id = monitorId;
|
|
46
46
|
loading = true;
|
|
47
47
|
try {
|
|
48
|
-
const subscriptions = await getSubscriptions(
|
|
48
|
+
const subscriptions = await getSubscriptions(getApiToken());
|
|
49
49
|
if (id !== monitorId) return;
|
|
50
50
|
const match = subscriptions.find((s) => s.monitor === id);
|
|
51
51
|
subscribedLevel = match?.level ?? null;
|
|
@@ -54,17 +54,18 @@
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
async function handleLevelClick(
|
|
58
|
-
if (saving || !
|
|
57
|
+
async function handleLevelClick(level: string | null) {
|
|
58
|
+
if (saving || !level) return;
|
|
59
59
|
saving = true;
|
|
60
60
|
const previous = subscribedLevel;
|
|
61
|
+
const apiToken = getApiToken();
|
|
61
62
|
try {
|
|
62
|
-
if (
|
|
63
|
-
await unsubscribe({ monitorId, apiToken
|
|
63
|
+
if (level === subscribedLevel) {
|
|
64
|
+
await unsubscribe({ monitorId, apiToken, level });
|
|
64
65
|
subscribedLevel = null;
|
|
65
66
|
} else {
|
|
66
|
-
await subscribe({ monitorId, apiToken
|
|
67
|
-
subscribedLevel =
|
|
67
|
+
await subscribe({ monitorId, apiToken, level });
|
|
68
|
+
subscribedLevel = level;
|
|
68
69
|
}
|
|
69
70
|
} catch {
|
|
70
71
|
subscribedLevel = previous;
|
|
@@ -74,6 +75,12 @@
|
|
|
74
75
|
}
|
|
75
76
|
open = false;
|
|
76
77
|
}
|
|
78
|
+
|
|
79
|
+
function getApiToken(): string {
|
|
80
|
+
return (
|
|
81
|
+
(globalThis as unknown as Record<string, Record<string, string>>)["USER"]?.api_token ?? ""
|
|
82
|
+
);
|
|
83
|
+
}
|
|
77
84
|
</script>
|
|
78
85
|
|
|
79
86
|
<div class="relative select-none">
|
|
@@ -99,7 +106,7 @@
|
|
|
99
106
|
<div class="absolute top-full left-0 z-20 mt-1 w-full overflow-hidden rounded shadow-lg">
|
|
100
107
|
{#if subscribedLevel}
|
|
101
108
|
<button
|
|
102
|
-
class="
|
|
109
|
+
class="flex w-full cursor-pointer items-center justify-between rounded-t border border-black/30 px-4 py-2 text-sm hover:bg-[#F5F5F3]"
|
|
103
110
|
onclick={() => handleLevelClick(subscribedLevel)}
|
|
104
111
|
>
|
|
105
112
|
Unsubscribe
|
|
@@ -111,7 +118,7 @@
|
|
|
111
118
|
<button
|
|
112
119
|
class={[
|
|
113
120
|
"flex w-full items-center justify-between px-4 py-2 text-sm text-white last:rounded-b",
|
|
114
|
-
!isSubscribed ? "first:rounded-t hover:brightness-90
|
|
121
|
+
!isSubscribed ? "cursor-pointer first:rounded-t hover:brightness-90" : ""
|
|
115
122
|
]}
|
|
116
123
|
style="background-color: {level.color}"
|
|
117
124
|
disabled={saving}
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
|
|
69
69
|
{#each monitorDisplayOptions as [id, option] (option.label)}
|
|
70
70
|
{@const inputId = `${id}-monitor-display-option`}
|
|
71
|
-
<label for={inputId} class="flex gap-1
|
|
71
|
+
<label for={inputId} class="flex cursor-pointer gap-1 whitespace-nowrap select-none">
|
|
72
72
|
<input type="checkbox" id={inputId} name={option.label} bind:checked={option.value} />
|
|
73
73
|
{#if option.icon}
|
|
74
74
|
<img class="w-3" src={option.icon.image.src} alt={option.icon.image.alt} />
|