From 51bd122bada6276613b528d9e3a2b01f7c6cf159 Mon Sep 17 00:00:00 2001 From: Alexander McCormick Date: Thu, 25 Jul 2024 14:41:11 -0700 Subject: [PATCH 1/7] Always show calibrators, even if not active --- src/DisplayOptions/MonitorMarkers.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/DisplayOptions/MonitorMarkers.ts b/src/DisplayOptions/MonitorMarkers.ts index 202cc18..ea2021c 100644 --- a/src/DisplayOptions/MonitorMarkers.ts +++ b/src/DisplayOptions/MonitorMarkers.ts @@ -210,7 +210,10 @@ function isVisible(monitor: Monitor | Calibrator): boolean { // showAirNow if ("data" in monitor) { - if (!monitorMarkersVisibility.displayInactive.model.value && !monitor.data.is_active) { + if (monitorMarkersVisibility.Calibrators.model.value && monitorIsCalibrator(monitor)) { + return true; + + } else if (!monitorMarkersVisibility.displayInactive.model.value && !monitor.data.is_active) { return false; } @@ -238,11 +241,14 @@ function isVisible(monitor: Monitor | Calibrator): boolean { : monitorMarkersVisibility.AQview.model.value; } } else if ("id" in monitor && isCalibratorObject(monitor.id)) { - const ref = getMonitor(monitor.reference_id); - - if (!monitorMarkersVisibility.displayInactive.model.value && !ref.data.is_active) { - return false; - } + // NOTE: This commented out block hides inactive calibrator sites if the reference_id + // monitor is inactive. Feature removed by request + // + //const ref = getMonitor(monitor.reference_id); + + //if (!monitorMarkersVisibility.displayInactive.model.value && !ref.data.is_active) { + // return false; + //} return monitorMarkersVisibility.Calibrators.model.value; } From 1825e814bded18b5abc1be1e09475b0597e27b02 Mon Sep 17 00:00:00 2001 From: Alexander McCormick Date: Thu, 25 Jul 2024 14:41:36 -0700 Subject: [PATCH 2/7] Changes calibrator icon color when not active --- src/DisplayOptions/MonitorMarkers.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DisplayOptions/MonitorMarkers.ts b/src/DisplayOptions/MonitorMarkers.ts index ea2021c..917fdc5 100644 --- a/src/DisplayOptions/MonitorMarkers.ts +++ b/src/DisplayOptions/MonitorMarkers.ts @@ -256,11 +256,12 @@ function isVisible(monitor: Monitor | Calibrator): boolean { } function genCalibratorMapMarker(calibrator: Calibrator) { + const ref = getMonitor(calibrator.reference_id); const [lng, lat] = calibrator.position.coordinates; const icon = L.divIcon({ className: "is-flex is-justify-content-center is-align-items-center", iconAnchor: new L.Point(6, 11), - html: "
Hello
" + html: `
Hello
` }); return L.marker(L.latLng(lat, lng), { icon, From 3062461eb2bd54638aeedc182ac0e5b7fdacf051 Mon Sep 17 00:00:00 2001 From: Alexander McCormick Date: Thu, 25 Jul 2024 14:42:08 -0700 Subject: [PATCH 3/7] Swaps calibrator and inactive display option locations --- src/DisplayOptions/MonitorMarkers.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/DisplayOptions/MonitorMarkers.ts b/src/DisplayOptions/MonitorMarkers.ts index 917fdc5..e7e01ed 100644 --- a/src/DisplayOptions/MonitorMarkers.ts +++ b/src/DisplayOptions/MonitorMarkers.ts @@ -57,10 +57,13 @@ const monitorMarkersVisibility: DisplayOptionRecord = Checkbox.defineO model: true, label: "Private PurpleAir" }, - Calibrators: { - label: "Collocation Sites", + displayInactive: { + containerClass: "has-text-grey-light", + icon: { + id: "square" + }, model: false, - svg: "crosshairs-svg" + label: "Inactive monitors" }, PurpleAirInside: { containerClass: "icon-border has-text-success", @@ -70,13 +73,10 @@ const monitorMarkersVisibility: DisplayOptionRecord = Checkbox.defineO model: false, label: "Inside monitors" }, - displayInactive: { - containerClass: "has-text-grey-light", - icon: { - id: "square" - }, + Calibrators: { + label: "Collocation Sites", model: false, - label: "Inactive monitors" + svg: "crosshairs-svg" }, }); From 9f396c64027efbcdd0b793b7b27bd065836e1096 Mon Sep 17 00:00:00 2001 From: Alexander McCormick Date: Thu, 25 Jul 2024 14:42:28 -0700 Subject: [PATCH 4/7] Adds check for calibrators on SJVAir BAMs --- src/DisplayOptions/MonitorMarkers.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DisplayOptions/MonitorMarkers.ts b/src/DisplayOptions/MonitorMarkers.ts index e7e01ed..aecc4e9 100644 --- a/src/DisplayOptions/MonitorMarkers.ts +++ b/src/DisplayOptions/MonitorMarkers.ts @@ -228,7 +228,9 @@ function isVisible(monitor: Monitor | Calibrator): boolean { return visibleByNetwork && visibleByLocation; case "Central California Asthma Collaborative": - return monitorMarkersVisibility.SJVAirBAM.model.value; + return (monitorIsCalibrator(monitor)) + ? monitorMarkersVisibility.Calibrators.model.value || monitorMarkersVisibility.SJVAirBAM.model.value + : monitorMarkersVisibility.SJVAirBAM.model.value; case "AirNow.gov": return (monitorIsCalibrator(monitor)) From 1460fd4d4f47c902ee6e2f48af8a9877c9d0d8cf Mon Sep 17 00:00:00 2001 From: Alexander McCormick Date: Thu, 25 Jul 2024 14:42:50 -0700 Subject: [PATCH 5/7] Adds disabled-monitor class for svg mask icons --- src/styles.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/styles.scss b/src/styles.scss index 24d5908..34876d8 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -147,6 +147,10 @@ height: 80px; } +.disabled-monitor { + background-color: #7d7d7d; +} + .marker-selected { /* shadow From baf2882f0fd8e19f1131e29aab2a286578c03ad8 Mon Sep 17 00:00:00 2001 From: Alexander McCormick Date: Thu, 25 Jul 2024 14:42:58 -0700 Subject: [PATCH 6/7] Formatted --- src/modules/colors.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/modules/colors.ts b/src/modules/colors.ts index 948cf91..387d75b 100644 --- a/src/modules/colors.ts +++ b/src/modules/colors.ts @@ -3,16 +3,16 @@ import type { IColorLevel } from "../types"; export { darken, mix, toHex, readableColor } from "color2k"; export const Colors = { - white: 'ffffff', - gray: '969696', - black: '000000', - blue: '0000FF', - green: '00e400', - yellow: 'ffff00', - orange: 'ff7e00', - red: 'ff0000', - purple: '8f3f97', - maroon: '7e0023' + white: "ffffff", + gray: "969696", + black: "000000", + blue: "0000FF", + green: "00e400", + yellow: "ffff00", + orange: "ff7e00", + red: "ff0000", + purple: "8f3f97", + maroon: "7e0023" } as const; export function valueToColor(value: number, colors: Array) { @@ -28,7 +28,7 @@ export function valueToColor(value: number, colors: Array) { for (let i = 0; i <= colors.length - 1; i++) { if (colors[i].min > value) { // Level for current value - const min = colors[i-1]; + const min = colors[i - 1]; // Level threshold for current value const max = colors[i]; // Difference between max and min values => total steps in level From 77f8d94faf0b6170ee26f1420db9264706ffd6da Mon Sep 17 00:00:00 2001 From: Alexander McCormick Date: Thu, 25 Jul 2024 14:44:01 -0700 Subject: [PATCH 7/7] updates package version to 1.9.5 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f90c92a..d70c485 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@sjvair/monitor-map", - "version": "1.9.2", + "version": "1.9.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@sjvair/monitor-map", - "version": "1.9.2", + "version": "1.9.5", "devDependencies": { "@types/d3": "^7.4.3", "@types/leaflet": "^1.9.12", diff --git a/package.json b/package.json index 6e8a23c..21f42d0 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "files": [ "dist" ], - "version": "1.9.4", + "version": "1.9.5", "type": "module", "scripts": { "dev": "vite",