@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.
Files changed (31) hide show
  1. package/dist/lib/LoadScreen.svelte +3 -3
  2. package/dist/lib/MapLegend.svelte +1 -1
  3. package/dist/lib/MonitorDetailPanel.svelte +5 -3
  4. package/dist/lib/MonitorMapLayout.svelte +41 -59
  5. package/dist/lib/components/MapLayersDisplayOptions.svelte +4 -4
  6. package/dist/lib/components/SegmentedControl.svelte +0 -9
  7. package/dist/lib/components/ui/button/button.svelte.d.ts +44 -44
  8. package/dist/lib/ev-stations/components/EvStationsDisplayOptions.svelte +3 -3
  9. package/dist/lib/hms/components/HMSFireLegend.svelte +4 -4
  10. package/dist/lib/hms/hms-smoke-map-integration.svelte.js +15 -11
  11. package/dist/lib/map/Menu.svelte +6 -5
  12. package/dist/lib/monitors/components/MonitorMarkersLegend.svelte +5 -5
  13. package/dist/lib/monitors/components/MonitorSubscriptionManager.svelte +16 -9
  14. package/dist/lib/monitors/components/MonitorsDisplayOptions.svelte +1 -1
  15. package/dist/lib/search/Search.svelte +15 -15
  16. package/package.json +25 -25
  17. package/src/lib/LoadScreen.svelte +3 -3
  18. package/src/lib/MapLegend.svelte +1 -1
  19. package/src/lib/MonitorDetailPanel.svelte +5 -3
  20. package/src/lib/MonitorMapLayout.svelte +41 -59
  21. package/src/lib/collocation-sites/collocations-map-integration.svelte.ts +1 -4
  22. package/src/lib/components/MapLayersDisplayOptions.svelte +4 -4
  23. package/src/lib/components/SegmentedControl.svelte +0 -9
  24. package/src/lib/ev-stations/components/EvStationsDisplayOptions.svelte +3 -3
  25. package/src/lib/hms/components/HMSFireLegend.svelte +4 -4
  26. package/src/lib/hms/hms-smoke-map-integration.svelte.ts +15 -11
  27. package/src/lib/map/Menu.svelte +6 -5
  28. package/src/lib/monitors/components/MonitorMarkersLegend.svelte +5 -5
  29. package/src/lib/monitors/components/MonitorSubscriptionManager.svelte +16 -9
  30. package/src/lib/monitors/components/MonitorsDisplayOptions.svelte +1 -1
  31. package/src/lib/search/Search.svelte +15 -15
@@ -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 object-contain"
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 object-contain"
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 object-contain"
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}
@@ -9,7 +9,7 @@
9
9
  <HMSFireLegend />
10
10
  </div>
11
11
  -->
12
- <div class="flex flex-col gap-1 pointer-events-none pl-4 pb-4">
12
+ <div class="pointer-events-none flex flex-col gap-1 pb-4 pl-4">
13
13
  <HMSFireLegend />
14
14
  <MonitorMarkersLegend />
15
15
  </div>
@@ -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 overflow-y-auto p-5 pt-10">
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
- <MonitorWidgetModal monitorId={monitor.id} />
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 "./hms/hms-smoke-map-integration.svelte";
23
23
  import MapLegend from "./MapLegend.svelte";
24
24
  import Search from "./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="z-10 absolute bottom-0 left-0 pointer-events-none">
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 class="panel-container">
133
- <div class="panel-content">
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>
@@ -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 items-center">
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 items-center">
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 items-center">
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 items-center">
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;
@@ -3,62 +3,62 @@ import type { HTMLAnchorAttributes, HTMLButtonAttributes } from "svelte/elements
3
3
  import { type VariantProps } from "tailwind-variants";
4
4
  export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
5
5
  variant: {
6
- default: string;
7
- outline: string;
8
- secondary: string;
9
- ghost: string;
10
- destructive: string;
11
- link: string;
6
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80";
7
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground";
8
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground";
9
+ ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground";
10
+ destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30";
11
+ link: "text-primary underline-offset-4 hover:underline";
12
12
  };
13
13
  size: {
14
- default: string;
15
- xs: string;
16
- sm: string;
17
- lg: string;
18
- icon: string;
19
- "icon-xs": string;
20
- "icon-sm": string;
21
- "icon-lg": string;
14
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2";
15
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3";
16
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5";
17
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2";
18
+ icon: "size-8";
19
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3";
20
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg";
21
+ "icon-lg": "size-9";
22
22
  };
23
23
  }, undefined, "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
24
24
  variant: {
25
- default: string;
26
- outline: string;
27
- secondary: string;
28
- ghost: string;
29
- destructive: string;
30
- link: string;
25
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80";
26
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground";
27
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground";
28
+ ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground";
29
+ destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30";
30
+ link: "text-primary underline-offset-4 hover:underline";
31
31
  };
32
32
  size: {
33
- default: string;
34
- xs: string;
35
- sm: string;
36
- lg: string;
37
- icon: string;
38
- "icon-xs": string;
39
- "icon-sm": string;
40
- "icon-lg": string;
33
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2";
34
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3";
35
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5";
36
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2";
37
+ icon: "size-8";
38
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3";
39
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg";
40
+ "icon-lg": "size-9";
41
41
  };
42
- }, undefined, import("tailwind-variants").TVReturnType<{
42
+ }, undefined, import("tailwind-variants").TVReturnTypeLike<{
43
43
  variant: {
44
- default: string;
45
- outline: string;
46
- secondary: string;
47
- ghost: string;
48
- destructive: string;
49
- link: string;
44
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80";
45
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground";
46
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground";
47
+ ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground";
48
+ destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30";
49
+ link: "text-primary underline-offset-4 hover:underline";
50
50
  };
51
51
  size: {
52
- default: string;
53
- xs: string;
54
- sm: string;
55
- lg: string;
56
- icon: string;
57
- "icon-xs": string;
58
- "icon-sm": string;
59
- "icon-lg": string;
52
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2";
53
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3";
54
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5";
55
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2";
56
+ icon: "size-8";
57
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3";
58
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg";
59
+ "icon-lg": "size-9";
60
60
  };
61
- }, undefined, "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", unknown, unknown, undefined>>;
61
+ }, undefined>>;
62
62
  export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
63
63
  export type ButtonSize = VariantProps<typeof buttonVariants>["size"];
64
64
  export type ButtonProps = WithElementRef<HTMLButtonAttributes> & WithElementRef<HTMLAnchorAttributes> & {
@@ -7,7 +7,7 @@
7
7
  </script>
8
8
 
9
9
  <DisplayOption>
10
- <p class="whitespace-nowrap text-lg font-bold underline">EV Stations</p>
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 cursor-pointer select-none whitespace-nowrap">
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 cursor-pointer select-none whitespace-nowrap">
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 rounded shadow w-fit p-1">
9
- <p class="text-center whitespace-nowrap font-semibold">Fire Points</p>
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 items-center">
13
- <div class="size-9 flex justify-center items-center">
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>
@@ -21,19 +21,23 @@ class HMSSmokeMapIntegration extends MapGeoJSONIntegration {
21
21
  source: this.referenceId,
22
22
  layout: {},
23
23
  paint: {
24
- "fill-color": ["match", ["get", "density"],
25
- "light", "#bfc8c3",
26
- "medium", "#757b78",
24
+ "fill-color": [
25
+ "match",
26
+ ["get", "density"],
27
+ "light",
28
+ "#bfc8c3",
29
+ "medium",
30
+ "#757b78",
27
31
  "#333634"
28
32
  ],
29
- "fill-opacity": ["match", ["get", "density"],
30
- "light", 0.2,
31
- "medium", 0.3,
32
- 0.4
33
- ],
34
- "fill-outline-color": ["match", ["get", "density"],
35
- "light", "#bfc8c3",
36
- "medium", "#757b78",
33
+ "fill-opacity": ["match", ["get", "density"], "light", 0.2, "medium", 0.3, 0.4],
34
+ "fill-outline-color": [
35
+ "match",
36
+ ["get", "density"],
37
+ "light",
38
+ "#bfc8c3",
39
+ "medium",
40
+ "#757b78",
37
41
  "#333634"
38
42
  ]
39
43
  }
@@ -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 transition-all flex justify-center items-center"
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:h-55={isOpen}
54
- class:w-135={isOpen}
55
- class="relative flex h-0 w-0 items-center justify-center overflow-x-hidden overflow-y-scroll transition-all duration-250"
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 justify-between gap-4 p-2 flex-wrap"
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 flex-col bg-white rounded shadow py-[0.5em] px-[1.5em]">
11
- <p class="text-center whitespace-nowrap font-semibold">
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]">&nbsp;</div>
15
- <div class="flex mb-[1.5em]">
16
- <div class="w-1/5 shrink-0 h-[0.5em] border-l border-black">
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 h-[0.5em] border-l border-black last:relative last:right-px">
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(levelName: string | null) {
58
- if (saving || !levelName) return;
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 (levelName === subscribedLevel) {
63
- await unsubscribe({ monitorId, apiToken: "", level: levelName });
63
+ if (level === subscribedLevel) {
64
+ await unsubscribe({ monitorId, apiToken, level });
64
65
  subscribedLevel = null;
65
66
  } else {
66
- await subscribe({ monitorId, apiToken: "", level: levelName });
67
- subscribedLevel = levelName;
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="cursor-pointer px-4 py-2 text-sm rounded-t w-full flex items-center justify-between border border-black/30 hover:bg-[#F5F5F3]"
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 cursor-pointer" : ""
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 cursor-pointer whitespace-nowrap select-none">
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} />