@collabdt/core 0.4.0 → 0.4.1

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 (93) hide show
  1. package/dist/core/components/AppSidebarContent.d.ts.map +1 -1
  2. package/dist/core/components/AppSidebarContent.js +2 -7
  3. package/dist/core/components/AppSidebarContent.js.map +1 -1
  4. package/dist/core/components/ui/LegendCard.d.ts +8 -3
  5. package/dist/core/components/ui/LegendCard.d.ts.map +1 -1
  6. package/dist/core/components/ui/LegendCard.js +36 -18
  7. package/dist/core/components/ui/LegendCard.js.map +1 -1
  8. package/dist/core/components/ui/Sensors/SensorDetailDialog.d.ts.map +1 -1
  9. package/dist/core/components/ui/Sensors/SensorDetailDialog.js +56 -19
  10. package/dist/core/components/ui/Sensors/SensorDetailDialog.js.map +1 -1
  11. package/dist/core/components/ui/Sensors/SensorLegend.d.ts +6 -3
  12. package/dist/core/components/ui/Sensors/SensorLegend.d.ts.map +1 -1
  13. package/dist/core/components/ui/Sensors/SensorLegend.js +95 -27
  14. package/dist/core/components/ui/Sensors/SensorLegend.js.map +1 -1
  15. package/dist/core/components/ui/Sensors/SensorMultiSeriesChart.d.ts +10 -4
  16. package/dist/core/components/ui/Sensors/SensorMultiSeriesChart.d.ts.map +1 -1
  17. package/dist/core/components/ui/Sensors/SensorMultiSeriesChart.js +60 -9
  18. package/dist/core/components/ui/Sensors/SensorMultiSeriesChart.js.map +1 -1
  19. package/dist/core/components/ui/Sensors/SensorsSection.d.ts +1 -2
  20. package/dist/core/components/ui/Sensors/SensorsSection.d.ts.map +1 -1
  21. package/dist/core/components/ui/Sensors/SensorsSection.js +34 -4
  22. package/dist/core/components/ui/Sensors/SensorsSection.js.map +1 -1
  23. package/dist/core/components/ui/Sensors/buildingSensorColours.d.ts +49 -0
  24. package/dist/core/components/ui/Sensors/buildingSensorColours.d.ts.map +1 -0
  25. package/dist/core/components/ui/Sensors/buildingSensorColours.js +68 -0
  26. package/dist/core/components/ui/Sensors/buildingSensorColours.js.map +1 -0
  27. package/dist/core/components/ui/Sensors/sensorScope.js +1 -1
  28. package/dist/core/components/ui/Sensors/sensorScope.js.map +1 -1
  29. package/dist/core/components/ui/Sensors/sensorVisibility.d.ts +47 -0
  30. package/dist/core/components/ui/Sensors/sensorVisibility.d.ts.map +1 -0
  31. package/dist/core/components/ui/Sensors/sensorVisibility.js +29 -0
  32. package/dist/core/components/ui/Sensors/sensorVisibility.js.map +1 -0
  33. package/dist/core/components/ui/Sensors/useBuildingSensorColours.d.ts +30 -0
  34. package/dist/core/components/ui/Sensors/useBuildingSensorColours.d.ts.map +1 -0
  35. package/dist/core/components/ui/Sensors/useBuildingSensorColours.js +92 -0
  36. package/dist/core/components/ui/Sensors/useBuildingSensorColours.js.map +1 -0
  37. package/dist/core/components/ui/Sensors/useSensorSeriesMulti.d.ts +1 -1
  38. package/dist/core/components/ui/Sensors/useSensorSeriesMulti.d.ts.map +1 -1
  39. package/dist/core/components/ui/Sensors/useSensorSeriesMulti.js.map +1 -1
  40. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useSensorMarkers.d.ts.map +1 -1
  41. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useSensorMarkers.js +17 -17
  42. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useSensorMarkers.js.map +1 -1
  43. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/index.d.ts.map +1 -1
  44. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/index.js +27 -1
  45. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/index.js.map +1 -1
  46. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/src/BuildingSensorDetails.d.ts +36 -0
  47. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/src/BuildingSensorDetails.d.ts.map +1 -0
  48. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/src/BuildingSensorDetails.js +95 -0
  49. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/src/BuildingSensorDetails.js.map +1 -0
  50. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/src/BuildingsTools.d.ts.map +1 -1
  51. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/src/BuildingsTools.js +55 -42
  52. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/src/BuildingsTools.js.map +1 -1
  53. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/buildingColourExpression.d.ts +32 -0
  54. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/buildingColourExpression.d.ts.map +1 -0
  55. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/buildingColourExpression.js +56 -0
  56. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/buildingColourExpression.js.map +1 -0
  57. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.d.ts.map +1 -1
  58. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.js +61 -39
  59. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/index.js.map +1 -1
  60. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/src/BuildingSensorMarkers.d.ts +18 -0
  61. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/src/BuildingSensorMarkers.d.ts.map +1 -0
  62. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/src/BuildingSensorMarkers.js +61 -0
  63. package/dist/core/components/viewers/map/src/MapLayers/src/BuildingLayers/src/BuildingSensorMarkers.js.map +1 -0
  64. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.d.ts.map +1 -1
  65. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.js +36 -19
  66. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.js.map +1 -1
  67. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/sensorClusterColour.d.ts +22 -0
  68. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/sensorClusterColour.d.ts.map +1 -0
  69. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/sensorClusterColour.js +36 -0
  70. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/sensorClusterColour.js.map +1 -0
  71. package/dist/core/components/viewers/map/src/MapLayers/src/mapLayersUtils.d.ts +5 -1
  72. package/dist/core/components/viewers/map/src/MapLayers/src/mapLayersUtils.d.ts.map +1 -1
  73. package/dist/core/components/viewers/map/src/MapLayers/src/mapLayersUtils.js +6 -2
  74. package/dist/core/components/viewers/map/src/MapLayers/src/mapLayersUtils.js.map +1 -1
  75. package/dist/core/i18n/messages/en.json +11 -1
  76. package/dist/core/i18n/messages/es.json +11 -1
  77. package/dist/core/i18n/messages/fr.json +11 -1
  78. package/dist/core/store/Menus/context.d.ts.map +1 -1
  79. package/dist/core/store/Menus/context.js +4 -2
  80. package/dist/core/store/Menus/context.js.map +1 -1
  81. package/dist/core/store/Menus/reducer.d.ts +15 -26
  82. package/dist/core/store/Menus/reducer.d.ts.map +1 -1
  83. package/dist/core/store/Menus/reducer.js +38 -4
  84. package/dist/core/store/Menus/reducer.js.map +1 -1
  85. package/dist/core/utils/appContent.d.ts +15 -0
  86. package/dist/core/utils/appContent.d.ts.map +1 -0
  87. package/dist/core/utils/appContent.js +24 -0
  88. package/dist/core/utils/appContent.js.map +1 -0
  89. package/dist/core/utils/colourUtils.d.ts +9 -0
  90. package/dist/core/utils/colourUtils.d.ts.map +1 -1
  91. package/dist/core/utils/colourUtils.js +16 -0
  92. package/dist/core/utils/colourUtils.js.map +1 -1
  93. package/package.json +1 -1
@@ -33,14 +33,16 @@ import { ViewerNames } from "../../../../../../../types/dbTypes";
33
33
  import { withAlpha } from "../../../../../../../utils/colourUtils";
34
34
  import { HIGHLIGHT_COLOR } from "../../../../../../../utils/markerUtils";
35
35
  import Sensor from "../../../../../../ui/Sensors/Sensor";
36
+ import { observedDomain, resolveDomain, resolveRamp } from "../../../../../../ui/Sensors/sensorColour";
36
37
  import { SensorDetailDialog } from "../../../../../../ui/Sensors/SensorDetailDialog";
37
38
  import { SensorInput } from "../../../../../../ui/Sensors/SensorInput";
38
- import { UNTAGGED_TAG } from "../../../../../../ui/Sensors/SensorsSection";
39
39
  import { valueColoursBySensor } from "../../../../../../ui/Sensors/sensorValueColours";
40
+ import { activeSensorTypeId, visibleSensors } from "../../../../../../ui/Sensors/sensorVisibility";
40
41
  import { useSensorSeriesMulti } from "../../../../../../ui/Sensors/useSensorSeriesMulti";
41
42
  import { extractCoordinatesFromFeature } from "../../../../utils/extractCoordinates";
42
43
  import { MapLayerClickPriority } from "../../../../utils/MapEventManager/MapClickManager";
43
- import { createClusterLayer, createClusterCountLayer, createUnclusteredPointLayer } from "../mapLayersUtils";
44
+ import { CLUSTER_COUNT_COLOUR, createClusterLayer, createClusterCountLayer, createUnclusteredPointLayer } from "../mapLayersUtils";
45
+ import { SENSOR_CLUSTER_PROPERTIES, sensorClusterColour } from "./sensorClusterColour";
44
46
  const SensorIconMarker = ({ feature, isHighlighted, isFocused, haloColour, onMouseEnter, onMouseLeave, sensorTypes }) => {
45
47
  var _a, _b;
46
48
  const coords = extractCoordinatesFromFeature(feature);
@@ -78,9 +80,8 @@ const SensorIconMarker = ({ feature, isHighlighted, isFocused, haloColour, onMou
78
80
  ) }, String((_b = (_a = feature.properties) == null ? void 0 : _a.id) != null ? _b : `${coords.lng},${coords.lat}`));
79
81
  };
80
82
  const SensorLayers = () => {
81
- var _a, _b, _c, _d;
83
+ var _a, _b;
82
84
  const [hoveredSensorId, setHoveredSensorId] = React.useState(null);
83
- const clusterLayer = createClusterLayer("sensors");
84
85
  const clusterCountLayer = createClusterCountLayer("sensors");
85
86
  const unclusteredPointLayer = createUnclusteredPointLayer("sensors");
86
87
  const t = useTranslations("SensorLayers");
@@ -93,7 +94,7 @@ const SensorLayers = () => {
93
94
  const [popupInfo, setPopUpInfo] = React.useState(null);
94
95
  const { deleteSensor, updateSensor } = useSensor((_b = popupInfo == null ? void 0 : popupInfo.id) != null ? _b : null);
95
96
  const { state: menusState, dispatch: menusDispatch } = React.useContext(MenusContext);
96
- const { visibleSensorTypes, visibleSensorTags, currentSensorId, focusedSensorId } = menusState.menus;
97
+ const { visibleSensorTypes, visibleSensorTags, currentSensorId, focusedSensorId, sensorLegendTypeId } = menusState.menus;
97
98
  const typesVisible = (visibleSensorTypes == null ? void 0 : visibleSensorTypes[ViewerNames.map]) || [];
98
99
  const tagsVisible = (visibleSensorTags == null ? void 0 : visibleSensorTags[ViewerNames.map]) || [];
99
100
  const { sensorTypes } = useSensorTypes();
@@ -101,12 +102,10 @@ const SensorLayers = () => {
101
102
  const timeZone = appConfigState.appConfig.displayTimeZone;
102
103
  const [detailSensor, setDetailSensor] = React.useState(null);
103
104
  const [editSensor, setEditSensor] = React.useState(null);
104
- const eligibleSensors = sensors.filter((sensor) => sensor.viewer === ViewerNames.map).filter((sensor) => {
105
- var _a2, _b2, _c2;
106
- const matchesType = typesVisible.includes(sensor.typeId);
107
- const hasNoTags = !((_a2 = sensor.tags) == null ? void 0 : _a2.length);
108
- const matchesTag = hasNoTags ? tagsVisible.includes(UNTAGGED_TAG) : (_c2 = (_b2 = sensor.tags) == null ? void 0 : _b2.some((tag) => tagsVisible.includes(tag))) != null ? _c2 : false;
109
- return matchesType || matchesTag;
105
+ const eligibleSensors = visibleSensors(sensors, {
106
+ viewer: ViewerNames.map,
107
+ visibleTypeIds: typesVisible,
108
+ visibleTags: tagsVisible
110
109
  }).map((sensor) => {
111
110
  var _a2;
112
111
  const user2 = users.find((u) => u.id === sensor.authorId);
@@ -121,17 +120,34 @@ const SensorLayers = () => {
121
120
  setPopUpInfo(null);
122
121
  }
123
122
  }, [sensors, popupInfo]);
124
- const focusedTypeId = focusedSensorId == null ? null : (_d = (_c = eligibleSensors.find((s) => s.id === focusedSensorId)) == null ? void 0 : _c.typeId) != null ? _d : null;
125
- const haloSensors = focusedTypeId == null ? [] : eligibleSensors.filter((s) => s.typeId === focusedTypeId);
123
+ const haloTypeId = activeSensorTypeId(eligibleSensors, {
124
+ legendTypeId: sensorLegendTypeId == null ? void 0 : sensorLegendTypeId[ViewerNames.map],
125
+ activeSensorId: focusedSensorId
126
+ });
127
+ const haloSensors = haloTypeId == null ? [] : eligibleSensors.filter((s) => s.typeId === haloTypeId);
126
128
  const { seriesById } = useSensorSeriesMulti(haloSensors, { enabled: haloSensors.length > 0 });
127
129
  const haloIdsKey = haloSensors.map((s) => s.id).join(",");
128
130
  const readings = React.useMemo(
129
131
  () => valueColoursBySensor(haloSensors, sensorTypes, seriesById),
130
132
  [seriesById, sensorTypes, haloIdsKey]
131
133
  );
134
+ const haloType = haloTypeId == null ? void 0 : sensorTypes.find((t2) => t2.id === haloTypeId);
135
+ const haloRamp = haloType ? resolveRamp(haloType) : null;
136
+ const haloDomain = resolveDomain(
137
+ haloType,
138
+ observedDomain(haloSensors.flatMap((s) => {
139
+ var _a2, _b2;
140
+ return (_b2 = (_a2 = seriesById.get(s.id)) == null ? void 0 : _a2.points) != null ? _b2 : [];
141
+ }))
142
+ );
143
+ const clusterLayer = createClusterLayer(
144
+ "sensors",
145
+ sensorClusterColour(haloRamp, haloDomain, CLUSTER_COUNT_COLOUR)
146
+ );
132
147
  const geojsonSensorData = React.useMemo(() => {
133
148
  const convertDataToGeojson = (sensorData) => {
134
149
  const sensorFeatures = sensorData.map((sensor) => {
150
+ var _a2;
135
151
  const { longitude, latitude, id, name, typeId, sensorType, data, dataFormat, updateFrequency, createdAt, authorId, organizationId, visible, url, authorName } = sensor;
136
152
  return {
137
153
  type: "Feature",
@@ -139,7 +155,7 @@ const SensorLayers = () => {
139
155
  type: "Point",
140
156
  coordinates: [longitude, latitude]
141
157
  },
142
- properties: {
158
+ properties: __spreadValues({
143
159
  id: Number(id),
144
160
  organizationId,
145
161
  visible,
@@ -156,7 +172,7 @@ const SensorLayers = () => {
156
172
  url,
157
173
  createdAt,
158
174
  viewer: ViewerNames.map
159
- }
175
+ }, readings.has(Number(id)) ? { value: (_a2 = readings.get(Number(id))) == null ? void 0 : _a2.value } : {})
160
176
  };
161
177
  });
162
178
  const sensorFC = {
@@ -166,7 +182,7 @@ const SensorLayers = () => {
166
182
  return sensorFC;
167
183
  };
168
184
  return convertDataToGeojson(eligibleSensors);
169
- }, [eligibleSensors]);
185
+ }, [eligibleSensors, readings]);
170
186
  React.useEffect(() => {
171
187
  if (!map) return;
172
188
  const showSensorPopUp = (e, features) => {
@@ -382,6 +398,7 @@ const SensorLayers = () => {
382
398
  cluster: true,
383
399
  clusterMaxZoom: 14,
384
400
  clusterRadius: 40,
401
+ clusterProperties: SENSOR_CLUSTER_PROPERTIES,
385
402
  children: [
386
403
  /* @__PURE__ */ jsx(Layer, __spreadValues({}, clusterLayer)),
387
404
  /* @__PURE__ */ jsx(Layer, __spreadValues({}, clusterCountLayer)),
@@ -391,13 +408,13 @@ const SensorLayers = () => {
391
408
  var _a2;
392
409
  return ((_a2 = feature.properties) == null ? void 0 : _a2.id) !== (popupInfo == null ? void 0 : popupInfo.id);
393
410
  }).map((feature) => {
394
- var _a2, _b2, _c2, _d2, _e, _f;
411
+ var _a2, _b2, _c, _d, _e, _f;
395
412
  return /* @__PURE__ */ jsx(
396
413
  SensorIconMarker,
397
414
  {
398
415
  feature,
399
- isHighlighted: currentSensorId === ((_b2 = feature.properties) == null ? void 0 : _b2.id) || hoveredSensorId === ((_c2 = feature.properties) == null ? void 0 : _c2.id),
400
- isFocused: focusedSensorId === ((_d2 = feature.properties) == null ? void 0 : _d2.id),
416
+ isHighlighted: currentSensorId === ((_b2 = feature.properties) == null ? void 0 : _b2.id) || hoveredSensorId === ((_c = feature.properties) == null ? void 0 : _c.id),
417
+ isFocused: focusedSensorId === ((_d = feature.properties) == null ? void 0 : _d.id),
401
418
  haloColour: (_f = readings.get(Number((_e = feature.properties) == null ? void 0 : _e.id))) == null ? void 0 : _f.colour,
402
419
  onMouseEnter: () => {
403
420
  var _a3;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as LR from 'lucide-react'\r\nimport { useSession } from 'next-auth/react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\nimport { Source, Layer, Popup, Marker } from 'react-map-gl/maplibre'\r\nimport { toast } from 'sonner'\r\n\r\nimport { useSensor, useSensors } from '../../../../../../../hooks/sensors/sensors'\r\nimport { useSensorTypes } from '../../../../../../../hooks/sensorTypes/sensorTypes'\r\nimport { useUsers } from '../../../../../../../hooks/users/users'\r\nimport { AppConfigContext, MapContext, MenusContext } from '../../../../../../../store'\r\nimport { ViewerNames, type Sensor as ISensor} from '../../../../../../../types/dbTypes'\r\nimport { withAlpha } from '../../../../../../../utils/colourUtils'\r\nimport { HIGHLIGHT_COLOR } from '../../../../../../../utils/markerUtils'\r\nimport Sensor from '../../../../../../ui/Sensors/Sensor'\r\nimport { SensorDetailDialog } from '../../../../../../ui/Sensors/SensorDetailDialog'\r\nimport { SensorInput } from '../../../../../../ui/Sensors/SensorInput'\r\nimport { UNTAGGED_TAG } from '../../../../../../ui/Sensors/SensorsSection'\r\nimport { valueColoursBySensor } from '../../../../../../ui/Sensors/sensorValueColours'\r\nimport { useSensorSeriesMulti } from '../../../../../../ui/Sensors/useSensorSeriesMulti'\r\nimport { extractCoordinatesFromFeature } from '../../../../utils/extractCoordinates'\r\nimport { MapLayerClickPriority } from '../../../../utils/MapEventManager/MapClickManager'\r\nimport { createClusterLayer, createClusterCountLayer, createUnclusteredPointLayer } from '../mapLayersUtils'\r\n\r\nimport type { SensorType} from '../../../../../../../types/dbTypes';\r\nimport type { ClickCallback } from '../../../../utils/MapEventManager/MapClickManager';\r\nimport type { MapGeoJSONFeature, MapLayerMouseEvent } from 'maplibre-gl'\r\n\r\nconst SensorIconMarker = ({ feature, isHighlighted, isFocused, haloColour, onMouseEnter, onMouseLeave, sensorTypes }: { feature: MapGeoJSONFeature; isHighlighted?: boolean; isFocused?: boolean; haloColour?: string; onMouseEnter?: () => void; onMouseLeave?: () => void; sensorTypes: SensorType[] }) => {\r\n\r\n const coords = extractCoordinatesFromFeature(feature)\r\n if (!coords) return null\r\n\r\n const sensorType = sensorTypes.find(t => t.id === feature.properties?.typeId)\r\n const icon = sensorType?.icon || 'Radio'\r\n const SensorIcon = LR[icon] || LR.Radio\r\n\r\n // The border carries the sensor's current value when there is one, so selection moves to\r\n // border width and scale. Ring widths mirror the BIM marker's 2/3/4px tiers.\r\n const borderWidth = isFocused ? 4 : isHighlighted ? 3 : 2\r\n const borderColour = haloColour ?? (isHighlighted || isFocused ? HIGHLIGHT_COLOR : 'white')\r\n const glowColour = haloColour ? withAlpha(haloColour, 0.55) : 'rgba(115, 206, 226, 0.5)'\r\n const scale = isFocused ? 1.25 : isHighlighted ? 1.2 : 1\r\n\r\n return (\r\n <Marker key={String(feature.properties?.id ?? `${coords.lng},${coords.lat}`)} longitude={coords.lng} latitude={coords.lat} anchor=\"center\">\r\n <div\r\n style={{\r\n width: '36px',\r\n height: '36px',\r\n borderRadius: '50%',\r\n border: `${borderWidth}px solid ${borderColour}`,\r\n backgroundColor: 'black',\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n boxShadow: haloColour || isHighlighted || isFocused\r\n ? `0 0 ${isFocused ? 16 : 12}px ${glowColour}`\r\n : 'none',\r\n transition: 'all 0.2s ease-in-out',\r\n transform: `scale(${scale})`,\r\n }}\r\n onMouseEnter={onMouseEnter}\r\n onMouseLeave={onMouseLeave}\r\n >\r\n <SensorIcon style={{ width: '20px', height: '20px', color: 'hsl(var(--primary-foreground))' }} />\r\n </div>\r\n </Marker>\r\n )\r\n}\r\n\r\nexport const SensorLayers = () => {\r\n const [hoveredSensorId, setHoveredSensorId] = React.useState<number | null>(null)\r\n const clusterLayer = createClusterLayer('sensors')\r\n const clusterCountLayer = createClusterCountLayer('sensors')\r\n const unclusteredPointLayer = createUnclusteredPointLayer('sensors')\r\n\r\n // global map state\r\n\r\n const t = useTranslations('SensorLayers')\r\n const tSensors = useTranslations('SensorsSection')\r\n\r\n const { state: mapState } = React.useContext(MapContext)\r\n const { map, mapClickManager } = mapState.map\r\n const { sensors } = useSensors()\r\n const { users } = useUsers()\r\n const user = useSession().data?.user\r\n\r\n const [popupInfo, setPopUpInfo] = React.useState<Partial<ISensor & { sensorType: SensorType }> | null>(null)\r\n const { deleteSensor, updateSensor } = useSensor(popupInfo?.id ?? null)\r\n const { state: menusState, dispatch: menusDispatch } = React.useContext(MenusContext)\r\n const { visibleSensorTypes, visibleSensorTags, currentSensorId, focusedSensorId } = menusState.menus\r\n const typesVisible = visibleSensorTypes?.[ViewerNames.map] || []\r\n const tagsVisible = visibleSensorTags?.[ViewerNames.map] || []\r\n\r\n const {sensorTypes} = useSensorTypes()\r\n\r\n const { state: appConfigState } = React.useContext(AppConfigContext)\r\n const timeZone = appConfigState.appConfig.displayTimeZone\r\n const [detailSensor, setDetailSensor] = React.useState<ISensor | null>(null)\r\n const [editSensor, setEditSensor] = React.useState<ISensor | null>(null)\r\n\r\n const eligibleSensors: Array<ISensor & { authorName: string } & { sensorType: SensorType }> = sensors\r\n .filter((sensor) => sensor.viewer === ViewerNames.map)\r\n .filter((sensor) => {\r\n const matchesType = typesVisible.includes(sensor.typeId)\r\n const hasNoTags = !sensor.tags?.length\r\n const matchesTag = hasNoTags\r\n ? tagsVisible.includes(UNTAGGED_TAG)\r\n : sensor.tags?.some(tag => tagsVisible.includes(tag)) ?? false\r\n return matchesType || matchesTag\r\n })\r\n .map((sensor) => {\r\n const user = users.find(u => u.id === sensor.authorId)\r\n const sensorType = sensorTypes.find(t => t.id === sensor.typeId)\r\n return {\r\n ...sensor,\r\n authorName: user?.name ?? 'Unknown User',\r\n sensorType,\r\n }\r\n })\r\n\r\n // Close popup if the sensor was deleted\r\n React.useEffect(() => {\r\n if (popupInfo && !sensors.find((s) => s.id === popupInfo.id)) {\r\n setPopUpInfo(null)\r\n }\r\n }, [sensors, popupInfo])\r\n\r\n // Every sensor sharing the focused sensor's type gets a halo coloured by its own current\r\n // value, readable against the SensorLegend card. Only that one type is polled.\r\n const focusedTypeId = focusedSensorId == null\r\n ? null\r\n : eligibleSensors.find(s => s.id === focusedSensorId)?.typeId ?? null\r\n const haloSensors = focusedTypeId == null\r\n ? []\r\n : eligibleSensors.filter(s => s.typeId === focusedTypeId)\r\n const { seriesById } = useSensorSeriesMulti(haloSensors, { enabled: haloSensors.length > 0 })\r\n\r\n const haloIdsKey = haloSensors.map(s => s.id).join(',')\r\n const readings = React.useMemo(\r\n () => valueColoursBySensor(haloSensors, sensorTypes, seriesById),\r\n [seriesById, sensorTypes, haloIdsKey],\r\n )\r\n\r\n const geojsonSensorData = React.useMemo(() => {\r\n const convertDataToGeojson = (sensorData: typeof eligibleSensors): GeoJSON.FeatureCollection<GeoJSON.Point, { [key: string]: any }> => {\r\n const sensorFeatures: GeoJSON.Feature<GeoJSON.Point, { [key: string]: any }>[] = sensorData\r\n .map((sensor) => {\r\n const { longitude, latitude, id, name, typeId, sensorType, data, dataFormat, updateFrequency, createdAt, authorId, organizationId, visible, url, authorName } = sensor\r\n\r\n return {\r\n type: 'Feature',\r\n geometry: {\r\n type: 'Point',\r\n coordinates: [longitude, latitude],\r\n },\r\n properties: {\r\n id: Number(id),\r\n organizationId,\r\n visible,\r\n longitude,\r\n latitude,\r\n authorId: Number(authorId),\r\n authorName,\r\n name,\r\n typeId: Number(typeId),\r\n typeIcon: sensorType?.icon,\r\n data,\r\n dataFormat,\r\n updateFrequency,\r\n url,\r\n createdAt,\r\n viewer: ViewerNames.map,\r\n },\r\n }\r\n })\r\n\r\n\r\n\r\n const sensorFC: GeoJSON.FeatureCollection<GeoJSON.Point, { [key: string]: any }> = {\r\n type: 'FeatureCollection',\r\n features: sensorFeatures,\r\n }\r\n return sensorFC\r\n }\r\n return convertDataToGeojson(eligibleSensors)\r\n }, [eligibleSensors])\r\n\r\n // event listeners for sensor unclustered points\r\n React.useEffect(() => {\r\n if (!map) return\r\n const showSensorPopUp: ClickCallback = (e: MapLayerMouseEvent, features: MapGeoJSONFeature[]) => {\r\n const feature = features?.[0]\r\n\r\n if (!feature || feature.properties.point_count) return\r\n\r\n if (feature.geometry.type !== 'Point') return\r\n const [longitude, latitude] = feature.geometry.coordinates\r\n const { id, authorId, name, typeId, data, dataFormat, updateFrequency, createdAt, url } = feature.properties\r\n // Focus on click so the legend and the sibling halos follow the sensor just opened.\r\n menusDispatch({ type: 'SET_FOCUSED_SENSOR_ID', payload: { sensorId: Number(id) } })\r\n setPopUpInfo({\r\n id: Number(id),\r\n authorId: Number(authorId),\r\n organizationId: feature.properties?.organizationId,\r\n visible: feature.properties?.visible,\r\n longitude,\r\n latitude,\r\n name,\r\n typeId: Number(typeId),\r\n data,\r\n dataFormat,\r\n updateFrequency,\r\n url,\r\n createdAt,\r\n viewer: ViewerNames.map,\r\n })\r\n }\r\n\r\n const mouseEnterChangeCursor = () => {\r\n map.getCanvas().style.cursor = 'pointer'\r\n }\r\n const mouseLeaveChangeCursor = () => {\r\n map.getCanvas().style.cursor = ''\r\n }\r\n\r\n // event listener for clicking on single point to show sensor, hover to change cursor\r\n mapClickManager.register('sensors-unclustered-points', MapLayerClickPriority.CommentLayersClickPriority, showSensorPopUp)\r\n\r\n map.on('mouseenter', 'sensors-unclustered-points', mouseEnterChangeCursor)\r\n map.on('mouseleave', 'sensors-unclustered-points', mouseLeaveChangeCursor)\r\n return () => {\r\n mapClickManager.unregister('sensors-unclustered-points')\r\n map.off('mouseenter', 'sensors-unclustered-points', mouseEnterChangeCursor)\r\n map.off('mouseleave', 'sensors-unclustered-points', mouseLeaveChangeCursor)\r\n }\r\n }, [map, mapClickManager, menusDispatch])\r\n\r\n const handleRemoveSensor = () => {\r\n toast.success(t('sensorDeleted'))\r\n void deleteSensor()\r\n setPopUpInfo(null)\r\n }\r\n\r\n // event listeners for clustered points\r\n React.useEffect(() => {\r\n if (!map) return\r\n\r\n const zoomInToDecluster = (e: MapLayerMouseEvent) => {\r\n const feature = e.features?.[0] // only proceed if this is actually a cluster\r\n if (!feature || !feature.properties.cluster_id) return\r\n\r\n const clusterId = feature.properties.cluster_id as number\r\n\r\n // Check if geometry has coordinates (not a GeometryCollection)\r\n if (!('coordinates' in feature.geometry)) return\r\n const [lng, lat] = feature.geometry.coordinates as [number, number]\r\n\r\n const source = map.getSource('sensors') as any\r\n source.getClusterExpansionZoom(clusterId).then(\r\n (zoom: number) => {\r\n map.easeTo({ center: [lng, lat], zoom })\r\n },\r\n )\r\n .catch((error) => {\r\n console.error(error)\r\n })\r\n }\r\n\r\n const mouseEnterChangeCursor = () => { map.getCanvas().style.cursor = 'pointer' }\r\n const mouseLeaveChangeCursor = () => { map.getCanvas().style.cursor = '' }\r\n\r\n // event listener for clicking on single point to zoom in and decluster, hover to change cursor\r\n map.on('click', 'sensors-clusters', zoomInToDecluster)\r\n map.on('mouseenter', 'sensors-clusters', mouseEnterChangeCursor)\r\n map.on('mouseleave', 'sensors-clusters', mouseLeaveChangeCursor)\r\n return () => {\r\n map.off('click', 'sensors-clusters', zoomInToDecluster)\r\n map.off('mouseenter', 'sensors-clusters', mouseEnterChangeCursor)\r\n map.off('mouseleave', 'sensors-clusters', mouseLeaveChangeCursor)\r\n }\r\n }, [map])\r\n\r\n const renderPopup = () => {\r\n if (!popupInfo) return null\r\n const sensorType = sensorTypes.find(t => t.id === popupInfo.typeId)\r\n const liveSensor = sensors.find(s => s.id === popupInfo.id)\r\n const dataUrl = popupInfo.url || popupInfo.data || ''\r\n\r\n return (\r\n <Popup\r\n className=\"noBorderPopup\"\r\n longitude={popupInfo.longitude}\r\n latitude={popupInfo.latitude}\r\n closeOnClick={false}\r\n closeButton={false}\r\n onClose={() => setPopUpInfo(null)}\r\n anchor=\"bottom\"\r\n style={{ height: '50px', border: 'none', boxShadow: 'none' }}\r\n offset={[0, 10]}\r\n >\r\n <Sensor\r\n sensorName={popupInfo.name || ''}\r\n sensorType={sensorType}\r\n sensorId={popupInfo.id}\r\n tags={liveSensor?.tags ?? []}\r\n onAddTag={async (tag) => { await updateSensor({ tags: [...(liveSensor?.tags ?? []), tag] }) }}\r\n onDeleteTag={async (tag) => { await updateSensor({ tags: (liveSensor?.tags ?? []).filter(t => t !== tag) }) }}\r\n tagsTranslations={{\r\n addTag: tSensors('addTag'),\r\n removeTag: tSensors('removeTag'),\r\n cancel: tSensors('cancel'),\r\n newTagPlaceholder: tSensors('newTagPlaceholder'),\r\n }}\r\n dataUrl={dataUrl}\r\n dataFormat={popupInfo.dataFormat}\r\n updateFrequency={popupInfo.updateFrequency}\r\n buildingId={popupInfo.buildingId}\r\n createdAt={popupInfo.createdAt}\r\n onRemove={user.id === String(popupInfo.authorId) ? handleRemoveSensor : null}\r\n onClose={() => setPopUpInfo(null)}\r\n onExpand={() => { if (liveSensor) setDetailSensor(liveSensor) }}\r\n onEdit={user.id === String(popupInfo.authorId) && liveSensor ? () => setEditSensor(liveSensor) : undefined}\r\n showActions\r\n focused={focusedSensorId === popupInfo.id}\r\n haloColour={popupInfo.id == null ? undefined : readings.get(popupInfo.id)?.colour}\r\n onSelect={() => {\r\n if (popupInfo.id != null) {\r\n menusDispatch({ type: 'SET_FOCUSED_SENSOR_ID', payload: { sensorId: popupInfo.id } })\r\n }\r\n }}\r\n timeZone={timeZone}\r\n size=\"sm\"\r\n />\r\n {/* inline styles to override MapLibre's Pop up CSS */}\r\n <style>\r\n {`\r\n .noBorderPopup .maplibregl-popup-content {\r\n border: none !important;\r\n box-shadow: none !important;\r\n background: transparent !important;\r\n }\r\n .noBorderPopup .maplibregl-popup-tip {\r\n display: none !important;\r\n }\r\n `}\r\n </style>\r\n </Popup>\r\n )\r\n }\r\n\r\n // Track unclustered sensors to display icons\r\n const [unclusteredFeatures, setUnclusteredFeatures] = React.useState<MapGeoJSONFeature[]>([])\r\n\r\n React.useEffect(() => {\r\n if (!map) return\r\n\r\n const updateUnclusteredFeatures = () => {\r\n const allFeatures = map.querySourceFeatures('sensors')\r\n const unclusteredOnly = allFeatures.filter(\r\n (f) => !f.properties?.cluster && !f.properties?.point_count\r\n )\r\n // Deduplicate by id\r\n const uniqueFeatures = new Map()\r\n unclusteredOnly.forEach((f) => uniqueFeatures.set(f.properties.id, f))\r\n setUnclusteredFeatures(Array.from(uniqueFeatures.values()))\r\n }\r\n\r\n const onSourceData = (e: any) => {\r\n if (e?.sourceId === 'sensors') updateUnclusteredFeatures()\r\n }\r\n\r\n map.on('sourcedata', onSourceData)\r\n map.on('moveend', updateUnclusteredFeatures)\r\n map.on('zoomend', updateUnclusteredFeatures)\r\n\r\n updateUnclusteredFeatures()\r\n\r\n return () => {\r\n map.off('sourcedata', onSourceData)\r\n map.off('moveend', updateUnclusteredFeatures)\r\n map.off('zoomend', updateUnclusteredFeatures)\r\n }\r\n }, [map])\r\n\r\n return (\r\n <>\r\n {detailSensor && (\r\n <SensorDetailDialog\r\n open={!!detailSensor}\r\n onOpenChange={(o) => !o && setDetailSensor(null)}\r\n sensor={detailSensor}\r\n sensorType={sensorTypes.find(t => t.id === detailSensor.typeId)}\r\n />\r\n )}\r\n {editSensor && (\r\n <SensorInput\r\n viewer={ViewerNames.map}\r\n layout=\"dialog\"\r\n isOpen={!!editSensor}\r\n editSensor={editSensor ?? undefined}\r\n onCancel={() => setEditSensor(null)}\r\n onSaved={() => setEditSensor(null)}\r\n />\r\n )}\r\n {(typesVisible.length > 0 || tagsVisible.length > 0) &&\r\n <Source\r\n id=\"sensors\"\r\n type=\"geojson\"\r\n data={geojsonSensorData}\r\n cluster={true}\r\n clusterMaxZoom={14}\r\n clusterRadius={40}\r\n >\r\n <Layer {...clusterLayer} />\r\n <Layer {...clusterCountLayer} />\r\n <Layer {...unclusteredPointLayer} />\r\n\r\n {renderPopup()}\r\n {unclusteredFeatures\r\n .filter((feature) => feature.properties?.id !== popupInfo?.id)\r\n .map((feature) => (\r\n <SensorIconMarker\r\n key={String(feature.properties?.id)}\r\n feature={feature}\r\n isHighlighted={currentSensorId === feature.properties?.id || hoveredSensorId === feature.properties?.id}\r\n isFocused={focusedSensorId === feature.properties?.id}\r\n haloColour={readings.get(Number(feature.properties?.id))?.colour}\r\n onMouseEnter={() => setHoveredSensorId(feature.properties?.id)}\r\n onMouseLeave={() => setHoveredSensorId(null)}\r\n sensorTypes={sensorTypes}\r\n />\r\n ))}\r\n </Source>}\r\n </>\r\n )\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsEQ,SAkUJ,UAlUI,KAkOF,YAlOE;AAjER,YAAY,QAAQ;AACpB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,YAAY,WAAW;AACvB,SAAS,QAAQ,OAAO,OAAO,cAAc;AAC7C,SAAS,aAAa;AAEtB,SAAS,WAAW,kBAAkB;AACtC,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB,YAAY,oBAAoB;AAC3D,SAAS,mBAA0C;AACnD,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,OAAO,YAAY;AACnB,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,qCAAqC;AAC9C,SAAS,6BAA6B;AACtC,SAAS,oBAAoB,yBAAyB,mCAAmC;AAMzF,MAAM,mBAAmB,CAAC,EAAE,SAAS,eAAe,WAAW,YAAY,cAAc,cAAc,YAAY,MAA0L;AAjC7S;AAmCE,QAAM,SAAS,8BAA8B,OAAO;AACpD,MAAI,CAAC,OAAQ,QAAO;AAEpB,QAAM,aAAa,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QAAOA,MAAA,QAAQ,eAAR,gBAAAA,IAAoB,EAAE;AAAA,YAQpC;AAAA,WACD;AAAA;AAAA;AAAA,IACL;AAAA,KACA;AAEJ;","names":["_a","_b","_c","user","t","_d"]}
1
+ {"version":3,"sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as LR from 'lucide-react'\r\nimport { useSession } from 'next-auth/react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\nimport { Source, Layer, Popup, Marker } from 'react-map-gl/maplibre'\r\nimport { toast } from 'sonner'\r\n\r\nimport { useSensor, useSensors } from '../../../../../../../hooks/sensors/sensors'\r\nimport { useSensorTypes } from '../../../../../../../hooks/sensorTypes/sensorTypes'\r\nimport { useUsers } from '../../../../../../../hooks/users/users'\r\nimport { AppConfigContext, MapContext, MenusContext } from '../../../../../../../store'\r\nimport { ViewerNames, type Sensor as ISensor} from '../../../../../../../types/dbTypes'\r\nimport { withAlpha } from '../../../../../../../utils/colourUtils'\r\nimport { HIGHLIGHT_COLOR } from '../../../../../../../utils/markerUtils'\r\nimport Sensor from '../../../../../../ui/Sensors/Sensor'\r\nimport { observedDomain, resolveDomain, resolveRamp } from '../../../../../../ui/Sensors/sensorColour'\r\nimport { SensorDetailDialog } from '../../../../../../ui/Sensors/SensorDetailDialog'\r\nimport { SensorInput } from '../../../../../../ui/Sensors/SensorInput'\r\nimport { valueColoursBySensor } from '../../../../../../ui/Sensors/sensorValueColours'\r\nimport { activeSensorTypeId, visibleSensors } from '../../../../../../ui/Sensors/sensorVisibility'\r\nimport { useSensorSeriesMulti } from '../../../../../../ui/Sensors/useSensorSeriesMulti'\r\nimport { extractCoordinatesFromFeature } from '../../../../utils/extractCoordinates'\r\nimport { MapLayerClickPriority } from '../../../../utils/MapEventManager/MapClickManager'\r\nimport { CLUSTER_COUNT_COLOUR, createClusterLayer, createClusterCountLayer, createUnclusteredPointLayer } from '../mapLayersUtils'\r\n\r\nimport { SENSOR_CLUSTER_PROPERTIES, sensorClusterColour } from './sensorClusterColour'\r\n\r\nimport type { SensorType} from '../../../../../../../types/dbTypes';\r\nimport type { ClickCallback } from '../../../../utils/MapEventManager/MapClickManager';\r\nimport type { MapGeoJSONFeature, MapLayerMouseEvent } from 'maplibre-gl'\r\n\r\nconst SensorIconMarker = ({ feature, isHighlighted, isFocused, haloColour, onMouseEnter, onMouseLeave, sensorTypes }: { feature: MapGeoJSONFeature; isHighlighted?: boolean; isFocused?: boolean; haloColour?: string; onMouseEnter?: () => void; onMouseLeave?: () => void; sensorTypes: SensorType[] }) => {\r\n\r\n const coords = extractCoordinatesFromFeature(feature)\r\n if (!coords) return null\r\n\r\n const sensorType = sensorTypes.find(t => t.id === feature.properties?.typeId)\r\n const icon = sensorType?.icon || 'Radio'\r\n const SensorIcon = LR[icon] || LR.Radio\r\n\r\n // The border carries the sensor's current value when there is one, so selection moves to\r\n // border width and scale. Ring widths mirror the BIM marker's 2/3/4px tiers.\r\n const borderWidth = isFocused ? 4 : isHighlighted ? 3 : 2\r\n const borderColour = haloColour ?? (isHighlighted || isFocused ? HIGHLIGHT_COLOR : 'white')\r\n const glowColour = haloColour ? withAlpha(haloColour, 0.55) : 'rgba(115, 206, 226, 0.5)'\r\n const scale = isFocused ? 1.25 : isHighlighted ? 1.2 : 1\r\n\r\n return (\r\n <Marker key={String(feature.properties?.id ?? `${coords.lng},${coords.lat}`)} longitude={coords.lng} latitude={coords.lat} anchor=\"center\">\r\n <div\r\n style={{\r\n width: '36px',\r\n height: '36px',\r\n borderRadius: '50%',\r\n border: `${borderWidth}px solid ${borderColour}`,\r\n backgroundColor: 'black',\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n boxShadow: haloColour || isHighlighted || isFocused\r\n ? `0 0 ${isFocused ? 16 : 12}px ${glowColour}`\r\n : 'none',\r\n transition: 'all 0.2s ease-in-out',\r\n transform: `scale(${scale})`,\r\n }}\r\n onMouseEnter={onMouseEnter}\r\n onMouseLeave={onMouseLeave}\r\n >\r\n <SensorIcon style={{ width: '20px', height: '20px', color: 'hsl(var(--primary-foreground))' }} />\r\n </div>\r\n </Marker>\r\n )\r\n}\r\n\r\nexport const SensorLayers = () => {\r\n const [hoveredSensorId, setHoveredSensorId] = React.useState<number | null>(null)\r\n const clusterCountLayer = createClusterCountLayer('sensors')\r\n const unclusteredPointLayer = createUnclusteredPointLayer('sensors')\r\n\r\n // global map state\r\n\r\n const t = useTranslations('SensorLayers')\r\n const tSensors = useTranslations('SensorsSection')\r\n\r\n const { state: mapState } = React.useContext(MapContext)\r\n const { map, mapClickManager } = mapState.map\r\n const { sensors } = useSensors()\r\n const { users } = useUsers()\r\n const user = useSession().data?.user\r\n\r\n const [popupInfo, setPopUpInfo] = React.useState<Partial<ISensor & { sensorType: SensorType }> | null>(null)\r\n const { deleteSensor, updateSensor } = useSensor(popupInfo?.id ?? null)\r\n const { state: menusState, dispatch: menusDispatch } = React.useContext(MenusContext)\r\n const { visibleSensorTypes, visibleSensorTags, currentSensorId, focusedSensorId, sensorLegendTypeId } = menusState.menus\r\n const typesVisible = visibleSensorTypes?.[ViewerNames.map] || []\r\n const tagsVisible = visibleSensorTags?.[ViewerNames.map] || []\r\n\r\n const {sensorTypes} = useSensorTypes()\r\n\r\n const { state: appConfigState } = React.useContext(AppConfigContext)\r\n const timeZone = appConfigState.appConfig.displayTimeZone\r\n const [detailSensor, setDetailSensor] = React.useState<ISensor | null>(null)\r\n const [editSensor, setEditSensor] = React.useState<ISensor | null>(null)\r\n\r\n const eligibleSensors: Array<ISensor & { authorName: string } & { sensorType: SensorType }> = visibleSensors(sensors, {\r\n viewer: ViewerNames.map,\r\n visibleTypeIds: typesVisible,\r\n visibleTags: tagsVisible,\r\n })\r\n .map((sensor) => {\r\n const user = users.find(u => u.id === sensor.authorId)\r\n const sensorType = sensorTypes.find(t => t.id === sensor.typeId)\r\n return {\r\n ...sensor,\r\n authorName: user?.name ?? 'Unknown User',\r\n sensorType,\r\n }\r\n })\r\n\r\n // Close popup if the sensor was deleted\r\n React.useEffect(() => {\r\n if (popupInfo && !sensors.find((s) => s.id === popupInfo.id)) {\r\n setPopUpInfo(null)\r\n }\r\n }, [sensors, popupInfo])\r\n\r\n // Every sensor sharing the active type gets a halo coloured by its own current value, readable\r\n // against the SensorLegend card. Only that one type is polled. Resolved through the same\r\n // helper the legend uses, so pinning a type in the legend dropdown moves the halos with it.\r\n const haloTypeId = activeSensorTypeId(eligibleSensors, {\r\n legendTypeId: sensorLegendTypeId?.[ViewerNames.map],\r\n activeSensorId: focusedSensorId,\r\n })\r\n const haloSensors = haloTypeId == null\r\n ? []\r\n : eligibleSensors.filter(s => s.typeId === haloTypeId)\r\n const { seriesById } = useSensorSeriesMulti(haloSensors, { enabled: haloSensors.length > 0 })\r\n\r\n const haloIdsKey = haloSensors.map(s => s.id).join(',')\r\n const readings = React.useMemo(\r\n () => valueColoursBySensor(haloSensors, sensorTypes, seriesById),\r\n [seriesById, sensorTypes, haloIdsKey],\r\n )\r\n\r\n // Cluster bubbles average the readings they hide, on the same ramp and domain the individual\r\n // halos use, so zooming out does not change what a colour means.\r\n const haloType = haloTypeId == null ? undefined : sensorTypes.find(t => t.id === haloTypeId)\r\n const haloRamp = haloType ? resolveRamp(haloType) : null\r\n const haloDomain = resolveDomain(\r\n haloType,\r\n observedDomain(haloSensors.flatMap(s => seriesById.get(s.id)?.points ?? [])),\r\n )\r\n const clusterLayer = createClusterLayer(\r\n 'sensors',\r\n sensorClusterColour(haloRamp, haloDomain, CLUSTER_COUNT_COLOUR),\r\n )\r\n\r\n const geojsonSensorData = React.useMemo(() => {\r\n const convertDataToGeojson = (sensorData: typeof eligibleSensors): GeoJSON.FeatureCollection<GeoJSON.Point, { [key: string]: any }> => {\r\n const sensorFeatures: GeoJSON.Feature<GeoJSON.Point, { [key: string]: any }>[] = sensorData\r\n .map((sensor) => {\r\n const { longitude, latitude, id, name, typeId, sensorType, data, dataFormat, updateFrequency, createdAt, authorId, organizationId, visible, url, authorName } = sensor\r\n\r\n return {\r\n type: 'Feature',\r\n geometry: {\r\n type: 'Point',\r\n coordinates: [longitude, latitude],\r\n },\r\n properties: {\r\n id: Number(id),\r\n organizationId,\r\n visible,\r\n longitude,\r\n latitude,\r\n authorId: Number(authorId),\r\n authorName,\r\n name,\r\n typeId: Number(typeId),\r\n typeIcon: sensorType?.icon,\r\n data,\r\n dataFormat,\r\n updateFrequency,\r\n url,\r\n createdAt,\r\n viewer: ViewerNames.map,\r\n // Only present for sensors of the active type that are actually reporting. The\r\n // cluster accumulators count exactly these, so the average is over real readings.\r\n ...(readings.has(Number(id)) ? { value: readings.get(Number(id))?.value } : {}),\r\n },\r\n }\r\n })\r\n\r\n\r\n\r\n const sensorFC: GeoJSON.FeatureCollection<GeoJSON.Point, { [key: string]: any }> = {\r\n type: 'FeatureCollection',\r\n features: sensorFeatures,\r\n }\r\n return sensorFC\r\n }\r\n return convertDataToGeojson(eligibleSensors)\r\n }, [eligibleSensors, readings])\r\n\r\n // event listeners for sensor unclustered points\r\n React.useEffect(() => {\r\n if (!map) return\r\n const showSensorPopUp: ClickCallback = (e: MapLayerMouseEvent, features: MapGeoJSONFeature[]) => {\r\n const feature = features?.[0]\r\n\r\n if (!feature || feature.properties.point_count) return\r\n\r\n if (feature.geometry.type !== 'Point') return\r\n const [longitude, latitude] = feature.geometry.coordinates\r\n const { id, authorId, name, typeId, data, dataFormat, updateFrequency, createdAt, url } = feature.properties\r\n // Focus on click so the legend and the sibling halos follow the sensor just opened.\r\n menusDispatch({ type: 'SET_FOCUSED_SENSOR_ID', payload: { sensorId: Number(id) } })\r\n setPopUpInfo({\r\n id: Number(id),\r\n authorId: Number(authorId),\r\n organizationId: feature.properties?.organizationId,\r\n visible: feature.properties?.visible,\r\n longitude,\r\n latitude,\r\n name,\r\n typeId: Number(typeId),\r\n data,\r\n dataFormat,\r\n updateFrequency,\r\n url,\r\n createdAt,\r\n viewer: ViewerNames.map,\r\n })\r\n }\r\n\r\n const mouseEnterChangeCursor = () => {\r\n map.getCanvas().style.cursor = 'pointer'\r\n }\r\n const mouseLeaveChangeCursor = () => {\r\n map.getCanvas().style.cursor = ''\r\n }\r\n\r\n // event listener for clicking on single point to show sensor, hover to change cursor\r\n mapClickManager.register('sensors-unclustered-points', MapLayerClickPriority.CommentLayersClickPriority, showSensorPopUp)\r\n\r\n map.on('mouseenter', 'sensors-unclustered-points', mouseEnterChangeCursor)\r\n map.on('mouseleave', 'sensors-unclustered-points', mouseLeaveChangeCursor)\r\n return () => {\r\n mapClickManager.unregister('sensors-unclustered-points')\r\n map.off('mouseenter', 'sensors-unclustered-points', mouseEnterChangeCursor)\r\n map.off('mouseleave', 'sensors-unclustered-points', mouseLeaveChangeCursor)\r\n }\r\n }, [map, mapClickManager, menusDispatch])\r\n\r\n const handleRemoveSensor = () => {\r\n toast.success(t('sensorDeleted'))\r\n void deleteSensor()\r\n setPopUpInfo(null)\r\n }\r\n\r\n // event listeners for clustered points\r\n React.useEffect(() => {\r\n if (!map) return\r\n\r\n const zoomInToDecluster = (e: MapLayerMouseEvent) => {\r\n const feature = e.features?.[0] // only proceed if this is actually a cluster\r\n if (!feature || !feature.properties.cluster_id) return\r\n\r\n const clusterId = feature.properties.cluster_id as number\r\n\r\n // Check if geometry has coordinates (not a GeometryCollection)\r\n if (!('coordinates' in feature.geometry)) return\r\n const [lng, lat] = feature.geometry.coordinates as [number, number]\r\n\r\n const source = map.getSource('sensors') as any\r\n source.getClusterExpansionZoom(clusterId).then(\r\n (zoom: number) => {\r\n map.easeTo({ center: [lng, lat], zoom })\r\n },\r\n )\r\n .catch((error) => {\r\n console.error(error)\r\n })\r\n }\r\n\r\n const mouseEnterChangeCursor = () => { map.getCanvas().style.cursor = 'pointer' }\r\n const mouseLeaveChangeCursor = () => { map.getCanvas().style.cursor = '' }\r\n\r\n // event listener for clicking on single point to zoom in and decluster, hover to change cursor\r\n map.on('click', 'sensors-clusters', zoomInToDecluster)\r\n map.on('mouseenter', 'sensors-clusters', mouseEnterChangeCursor)\r\n map.on('mouseleave', 'sensors-clusters', mouseLeaveChangeCursor)\r\n return () => {\r\n map.off('click', 'sensors-clusters', zoomInToDecluster)\r\n map.off('mouseenter', 'sensors-clusters', mouseEnterChangeCursor)\r\n map.off('mouseleave', 'sensors-clusters', mouseLeaveChangeCursor)\r\n }\r\n }, [map])\r\n\r\n const renderPopup = () => {\r\n if (!popupInfo) return null\r\n const sensorType = sensorTypes.find(t => t.id === popupInfo.typeId)\r\n const liveSensor = sensors.find(s => s.id === popupInfo.id)\r\n const dataUrl = popupInfo.url || popupInfo.data || ''\r\n\r\n return (\r\n <Popup\r\n className=\"noBorderPopup\"\r\n longitude={popupInfo.longitude}\r\n latitude={popupInfo.latitude}\r\n closeOnClick={false}\r\n closeButton={false}\r\n onClose={() => setPopUpInfo(null)}\r\n anchor=\"bottom\"\r\n style={{ height: '50px', border: 'none', boxShadow: 'none' }}\r\n offset={[0, 10]}\r\n >\r\n <Sensor\r\n sensorName={popupInfo.name || ''}\r\n sensorType={sensorType}\r\n sensorId={popupInfo.id}\r\n tags={liveSensor?.tags ?? []}\r\n onAddTag={async (tag) => { await updateSensor({ tags: [...(liveSensor?.tags ?? []), tag] }) }}\r\n onDeleteTag={async (tag) => { await updateSensor({ tags: (liveSensor?.tags ?? []).filter(t => t !== tag) }) }}\r\n tagsTranslations={{\r\n addTag: tSensors('addTag'),\r\n removeTag: tSensors('removeTag'),\r\n cancel: tSensors('cancel'),\r\n newTagPlaceholder: tSensors('newTagPlaceholder'),\r\n }}\r\n dataUrl={dataUrl}\r\n dataFormat={popupInfo.dataFormat}\r\n updateFrequency={popupInfo.updateFrequency}\r\n buildingId={popupInfo.buildingId}\r\n createdAt={popupInfo.createdAt}\r\n onRemove={user.id === String(popupInfo.authorId) ? handleRemoveSensor : null}\r\n onClose={() => setPopUpInfo(null)}\r\n onExpand={() => { if (liveSensor) setDetailSensor(liveSensor) }}\r\n onEdit={user.id === String(popupInfo.authorId) && liveSensor ? () => setEditSensor(liveSensor) : undefined}\r\n showActions\r\n focused={focusedSensorId === popupInfo.id}\r\n haloColour={popupInfo.id == null ? undefined : readings.get(popupInfo.id)?.colour}\r\n onSelect={() => {\r\n if (popupInfo.id != null) {\r\n menusDispatch({ type: 'SET_FOCUSED_SENSOR_ID', payload: { sensorId: popupInfo.id } })\r\n }\r\n }}\r\n timeZone={timeZone}\r\n size=\"sm\"\r\n />\r\n {/* inline styles to override MapLibre's Pop up CSS */}\r\n <style>\r\n {`\r\n .noBorderPopup .maplibregl-popup-content {\r\n border: none !important;\r\n box-shadow: none !important;\r\n background: transparent !important;\r\n }\r\n .noBorderPopup .maplibregl-popup-tip {\r\n display: none !important;\r\n }\r\n `}\r\n </style>\r\n </Popup>\r\n )\r\n }\r\n\r\n // Track unclustered sensors to display icons\r\n const [unclusteredFeatures, setUnclusteredFeatures] = React.useState<MapGeoJSONFeature[]>([])\r\n\r\n React.useEffect(() => {\r\n if (!map) return\r\n\r\n const updateUnclusteredFeatures = () => {\r\n const allFeatures = map.querySourceFeatures('sensors')\r\n const unclusteredOnly = allFeatures.filter(\r\n (f) => !f.properties?.cluster && !f.properties?.point_count\r\n )\r\n // Deduplicate by id\r\n const uniqueFeatures = new Map()\r\n unclusteredOnly.forEach((f) => uniqueFeatures.set(f.properties.id, f))\r\n setUnclusteredFeatures(Array.from(uniqueFeatures.values()))\r\n }\r\n\r\n const onSourceData = (e: any) => {\r\n if (e?.sourceId === 'sensors') updateUnclusteredFeatures()\r\n }\r\n\r\n map.on('sourcedata', onSourceData)\r\n map.on('moveend', updateUnclusteredFeatures)\r\n map.on('zoomend', updateUnclusteredFeatures)\r\n\r\n updateUnclusteredFeatures()\r\n\r\n return () => {\r\n map.off('sourcedata', onSourceData)\r\n map.off('moveend', updateUnclusteredFeatures)\r\n map.off('zoomend', updateUnclusteredFeatures)\r\n }\r\n }, [map])\r\n\r\n return (\r\n <>\r\n {detailSensor && (\r\n <SensorDetailDialog\r\n open={!!detailSensor}\r\n onOpenChange={(o) => !o && setDetailSensor(null)}\r\n sensor={detailSensor}\r\n sensorType={sensorTypes.find(t => t.id === detailSensor.typeId)}\r\n />\r\n )}\r\n {editSensor && (\r\n <SensorInput\r\n viewer={ViewerNames.map}\r\n layout=\"dialog\"\r\n isOpen={!!editSensor}\r\n editSensor={editSensor ?? undefined}\r\n onCancel={() => setEditSensor(null)}\r\n onSaved={() => setEditSensor(null)}\r\n />\r\n )}\r\n {(typesVisible.length > 0 || tagsVisible.length > 0) &&\r\n <Source\r\n id=\"sensors\"\r\n type=\"geojson\"\r\n data={geojsonSensorData}\r\n cluster={true}\r\n clusterMaxZoom={14}\r\n clusterRadius={40}\r\n clusterProperties={SENSOR_CLUSTER_PROPERTIES}\r\n >\r\n <Layer {...clusterLayer} />\r\n <Layer {...clusterCountLayer} />\r\n <Layer {...unclusteredPointLayer} />\r\n\r\n {renderPopup()}\r\n {unclusteredFeatures\r\n .filter((feature) => feature.properties?.id !== popupInfo?.id)\r\n .map((feature) => (\r\n <SensorIconMarker\r\n key={String(feature.properties?.id)}\r\n feature={feature}\r\n isHighlighted={currentSensorId === feature.properties?.id || hoveredSensorId === feature.properties?.id}\r\n isFocused={focusedSensorId === feature.properties?.id}\r\n haloColour={readings.get(Number(feature.properties?.id))?.colour}\r\n onMouseEnter={() => setHoveredSensorId(feature.properties?.id)}\r\n onMouseLeave={() => setHoveredSensorId(null)}\r\n sensorTypes={sensorTypes}\r\n />\r\n ))}\r\n </Source>}\r\n </>\r\n )\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyEQ,SA8UJ,UA9UI,KA8OF,YA9OE;AApER,YAAY,QAAQ;AACpB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,YAAY,WAAW;AACvB,SAAS,QAAQ,OAAO,OAAO,cAAc;AAC7C,SAAS,aAAa;A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,QACH,MAAK;AAAA,QACL,MAAM;AAAA,QACN,SAAS;AAAA,QACT,gBAAgB;AAAA,QAChB,eAAe;AAAA,QACf,mBAAmB;AAAA,QAEnB;AAAA,8BAAC,0BAAU,aAAc;AAAA,UACzB,oBAAC,0BAAU,kBAAmB;AAAA,UAC9B,oBAAC,0BAAU,sBAAuB;AAAA,UAEjC,YAAY;AAAA,UACZ,oBACE,OAAO,CAAC,YAAS;AA1b1B,gBAAAF;AA0b6B,qBAAAA,MAAA,QAAQ,eAAR,gBAAAA,IAAoB,SAAO,uCAAW;AAAA,WAAE,EAC5D,IAAI,CAAC,YAAS;AA3bvB,gBAAAA,KAAAG,KAAA;AA4bU;AAAA,cAAC;AAAA;AAAA,gBAEC;AAAA,gBACA,eAAe,sBAAoBA,MAAA,QAAQ,eAAR,gBAAAA,IAAoB,OAAM,sBAAoB,aAAQ,eAAR,mBAAoB;AAAA,gBACrG,WAAW,sBAAoB,aAAQ,eAAR,mBAAoB;AAAA,gBACnD,aAAY,cAAS,IAAI,QAAO,aAAQ,eAAR,mBAAoB,EAAE,CAAC,MAA3C,mBAA8C;AAAA,gBAC1D,cAAc,MAAG;AAlc7B,sBAAAH;AAkcgC,6CAAmBA,MAAA,QAAQ,eAAR,gBAAAA,IAAoB,EAAE;AAAA;AAAA,gBAC7D,cAAc,MAAM,mBAAmB,IAAI;AAAA,gBAC3C;AAAA;AAAA,cAPK,QAAOA,MAAA,QAAQ,eAAR,gBAAAA,IAAoB,EAAE;AAAA,YAQpC;AAAA,WACD;AAAA;AAAA;AAAA,IACL;AAAA,KACA;AAEJ;","names":["_a","user","t","_b"]}
@@ -0,0 +1,22 @@
1
+ import type { ColourDomain, ColourRamp } from '../../../../../../ui/Sensors/sensorColour';
2
+ import type { PaintValue } from '../mapLayersUtils';
3
+ /**
4
+ * Cluster accumulators for averaging sensor readings.
5
+ *
6
+ * Passed to the GeoJSON source once and never changed: MapLibre bakes `clusterProperties` in at
7
+ * source creation, so they have to cover the case where no sensor carries a value yet. Features
8
+ * without a `value` contribute nothing and are not counted.
9
+ */
10
+ export declare const SENSOR_CLUSTER_PROPERTIES: {
11
+ readonly valueSum: readonly ["+", readonly ["coalesce", readonly ["get", "value"], 0]];
12
+ readonly valueCount: readonly ["+", readonly ["case", readonly ["has", "value"], 1, 0]];
13
+ };
14
+ /**
15
+ * `circle-color` for the sensor cluster bubbles: the mean of the readings inside the cluster, on
16
+ * the type's ramp, so a cluster reads like a zoomed-out version of the badges and halos under it.
17
+ *
18
+ * Falls back to `fallback` for a cluster where nothing reported, and when the type has no usable
19
+ * domain, honouring the same "no colours configured" contract as the rest of the ramp code.
20
+ */
21
+ export declare function sensorClusterColour(ramp: ColourRamp | null | undefined, domain: ColourDomain | null | undefined, fallback: PaintValue): PaintValue;
22
+ //# sourceMappingURL=sensorClusterColour.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sensorClusterColour.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/SensorsLayer/sensorClusterColour.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAA;AACzF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB;;;CAG5B,CAAA;AAEV;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACnC,MAAM,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EACvC,QAAQ,EAAE,UAAU,GACnB,UAAU,CAqBZ"}
@@ -0,0 +1,36 @@
1
+ const SENSOR_CLUSTER_PROPERTIES = {
2
+ valueSum: ["+", ["coalesce", ["get", "value"], 0]],
3
+ valueCount: ["+", ["case", ["has", "value"], 1, 0]]
4
+ };
5
+ function sensorClusterColour(ramp, domain, fallback) {
6
+ if (!ramp || !domain || !(domain.max > domain.min)) return fallback;
7
+ const mid = (domain.min + domain.max) / 2;
8
+ const average = [
9
+ "/",
10
+ ["get", "valueSum"],
11
+ // Guard the divide: the branch below only runs when the count is positive, but MapLibre
12
+ // still type-checks and evaluates both arms of a `case`.
13
+ ["max", ["get", "valueCount"], 1]
14
+ ];
15
+ return [
16
+ "case",
17
+ [">", ["get", "valueCount"], 0],
18
+ [
19
+ "interpolate",
20
+ ["linear"],
21
+ average,
22
+ domain.min,
23
+ ramp.min,
24
+ mid,
25
+ ramp.mid,
26
+ domain.max,
27
+ ramp.max
28
+ ],
29
+ fallback
30
+ ];
31
+ }
32
+ export {
33
+ SENSOR_CLUSTER_PROPERTIES,
34
+ sensorClusterColour
35
+ };
36
+ //# sourceMappingURL=sensorClusterColour.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/SensorsLayer/sensorClusterColour.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport type { ColourDomain, ColourRamp } from '../../../../../../ui/Sensors/sensorColour'\r\nimport type { PaintValue } from '../mapLayersUtils'\r\n\r\n/**\r\n * Cluster accumulators for averaging sensor readings.\r\n *\r\n * Passed to the GeoJSON source once and never changed: MapLibre bakes `clusterProperties` in at\r\n * source creation, so they have to cover the case where no sensor carries a value yet. Features\r\n * without a `value` contribute nothing and are not counted.\r\n */\r\nexport const SENSOR_CLUSTER_PROPERTIES = {\r\n valueSum: ['+', ['coalesce', ['get', 'value'], 0]],\r\n valueCount: ['+', ['case', ['has', 'value'], 1, 0]],\r\n} as const\r\n\r\n/**\r\n * `circle-color` for the sensor cluster bubbles: the mean of the readings inside the cluster, on\r\n * the type's ramp, so a cluster reads like a zoomed-out version of the badges and halos under it.\r\n *\r\n * Falls back to `fallback` for a cluster where nothing reported, and when the type has no usable\r\n * domain, honouring the same \"no colours configured\" contract as the rest of the ramp code.\r\n */\r\nexport function sensorClusterColour(\r\n ramp: ColourRamp | null | undefined,\r\n domain: ColourDomain | null | undefined,\r\n fallback: PaintValue,\r\n): PaintValue {\r\n if (!ramp || !domain || !(domain.max > domain.min)) return fallback\r\n\r\n const mid = (domain.min + domain.max) / 2\r\n const average: PaintValue = [\r\n '/',\r\n ['get', 'valueSum'],\r\n // Guard the divide: the branch below only runs when the count is positive, but MapLibre\r\n // still type-checks and evaluates both arms of a `case`.\r\n ['max', ['get', 'valueCount'], 1],\r\n ]\r\n\r\n return [\r\n 'case',\r\n ['>', ['get', 'valueCount'], 0],\r\n ['interpolate', ['linear'], average,\r\n domain.min, ramp.min,\r\n mid, ramp.mid,\r\n domain.max, ramp.max],\r\n fallback,\r\n ]\r\n}\r\n"],"mappings":"AAaO,MAAM,4BAA4B;AAAA,EACvC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,OAAO,GAAG,CAAC,CAAC;AAAA,EACjD,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,OAAO,GAAG,GAAG,CAAC,CAAC;AACpD;AASO,SAAS,oBACd,MACA,QACA,UACY;AACZ,MAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,MAAM,OAAO,KAAM,QAAO;AAE3D,QAAM,OAAO,OAAO,MAAM,OAAO,OAAO;AACxC,QAAM,UAAsB;AAAA,IAC1B;AAAA,IACA,CAAC,OAAO,UAAU;AAAA;AAAA;AAAA,IAGlB,CAAC,OAAO,CAAC,OAAO,YAAY,GAAG,CAAC;AAAA,EAClC;AAEA,SAAO;AAAA,IACL;AAAA,IACA,CAAC,KAAK,CAAC,OAAO,YAAY,GAAG,CAAC;AAAA,IAC9B;AAAA,MAAC;AAAA,MAAe,CAAC,QAAQ;AAAA,MAAG;AAAA,MAC1B,OAAO;AAAA,MAAK,KAAK;AAAA,MACjB;AAAA,MAAK,KAAK;AAAA,MACV,OAAO;AAAA,MAAK,KAAK;AAAA,IAAG;AAAA,IACtB;AAAA,EACF;AACF;","names":[]}
@@ -1,5 +1,9 @@
1
1
  import type { LayerProps } from 'react-map-gl/maplibre';
2
- export declare const createClusterLayer: (sourceId: string) => LayerProps;
2
+ /** JSON form of a MapLibre paint value: a literal colour or an expression. */
3
+ export type PaintValue = string | (string | number | boolean | null | PaintValue)[];
4
+ /** Cluster bubbles keyed on how many points they hide. The default when nothing else applies. */
5
+ export declare const CLUSTER_COUNT_COLOUR: PaintValue;
6
+ export declare const createClusterLayer: (sourceId: string, circleColour?: PaintValue) => LayerProps;
3
7
  export declare const createClusterCountLayer: (sourceId: string) => LayerProps;
4
8
  export declare const createUnclusteredPointLayer: (sourceId: string) => LayerProps;
5
9
  //# sourceMappingURL=mapLayersUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapLayersUtils.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/mapLayersUtils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEtD,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,UASrD,CAAA;AAEF,eAAO,MAAM,uBAAuB,GAAI,UAAU,MAAM,KAAG,UAezD,CAAA;AAEF,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,KAAG,UAa7D,CAAA"}
1
+ {"version":3,"file":"mapLayersUtils.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/mapLayersUtils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,UAAU,CAAC,EAAE,CAAA;AAEnF,iGAAiG;AACjG,eAAO,MAAM,oBAAoB,EAAE,UAC4C,CAAA;AAE9E,eAAO,MAAM,kBAAkB,GAC9B,UAAU,MAAM,EAChB,eAAc,UAAiC,KAC9C,UAWD,CAAA;AAEF,eAAO,MAAM,uBAAuB,GAAI,UAAU,MAAM,KAAG,UAezD,CAAA;AAEF,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,KAAG,UAa7D,CAAA"}
@@ -1,10 +1,13 @@
1
- const createClusterLayer = (sourceId) => ({
1
+ const CLUSTER_COUNT_COLOUR = ["step", ["get", "point_count"], "#51bbd6", 100, "#f1f075", 750, "#f28cb1"];
2
+ const createClusterLayer = (sourceId, circleColour = CLUSTER_COUNT_COLOUR) => ({
2
3
  id: `${sourceId}-clusters`,
3
4
  type: "circle",
4
5
  source: sourceId,
5
6
  filter: ["has", "point_count"],
6
7
  paint: {
7
- "circle-color": ["step", ["get", "point_count"], "#51bbd6", 100, "#f1f075", 750, "#f28cb1"],
8
+ // Cast at the one point where a structurally-typed expression meets the style spec's
9
+ // generated union, rather than at every call site.
10
+ "circle-color": circleColour,
8
11
  "circle-radius": ["step", ["get", "point_count"], 20, 100, 30, 750, 40]
9
12
  }
10
13
  });
@@ -41,6 +44,7 @@ const createUnclusteredPointLayer = (sourceId) => ({
41
44
  }
42
45
  });
43
46
  export {
47
+ CLUSTER_COUNT_COLOUR,
44
48
  createClusterCountLayer,
45
49
  createClusterLayer,
46
50
  createUnclusteredPointLayer
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/mapLayersUtils.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport type { LayerProps } from 'react-map-gl/maplibre'\r\n\r\n export const createClusterLayer = (sourceId: string): LayerProps => ({\r\n id: `${sourceId}-clusters`,\r\n type: 'circle',\r\n source: sourceId,\r\n filter: ['has', 'point_count'],\r\n paint: {\r\n 'circle-color': ['step', ['get', 'point_count'], '#51bbd6', 100, '#f1f075', 750, '#f28cb1'],\r\n 'circle-radius': ['step', ['get', 'point_count'], 20, 100, 30, 750, 40],\r\n },\r\n})\r\n\r\nexport const createClusterCountLayer = (sourceId: string): LayerProps => ({\r\n id: `${sourceId}-cluster-count`,\r\n type: 'symbol',\r\n source: sourceId,\r\n filter: ['has', 'point_count'],\r\n layout: {\r\n 'text-field': '{point_count_abbreviated}',\r\n 'text-font': ['DIN Offc Pro Medium', 'Arial Unicode MS Bold'],\r\n 'text-size': 12,\r\n },\r\n paint: {\r\n 'text-color': '#000',\r\n 'text-halo-color': '#fff',\r\n 'text-halo-width': 1,\r\n },\r\n})\r\n\r\nexport const createUnclusteredPointLayer = (sourceId: string): LayerProps => ({\r\n id: `${sourceId}-unclustered-points`,\r\n type: 'circle',\r\n source: sourceId,\r\n filter: ['!', ['has', 'point_count']],\r\n paint: {\r\n 'circle-color': '#11b4da',\r\n 'circle-radius': 20,\r\n 'circle-stroke-width': 1,\r\n 'circle-stroke-color': '#fff',\r\n 'circle-opacity': 0, // fully transparent to hide circle but allow clickable\r\n 'circle-stroke-opacity': 0, // makes stroke invisible too\r\n },\r\n})\r\n"],"mappings":"AAKQ,MAAM,qBAAqB,CAAC,cAAkC;AAAA,EACpE,IAAI,GAAG,QAAQ;AAAA,EACf,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ,CAAC,OAAO,aAAa;AAAA,EAC7B,OAAO;AAAA,IACL,gBAAgB,CAAC,QAAQ,CAAC,OAAO,aAAa,GAAG,WAAW,KAAK,WAAW,KAAK,SAAS;AAAA,IAC1F,iBAAiB,CAAC,QAAQ,CAAC,OAAO,aAAa,GAAG,IAAI,KAAK,IAAI,KAAK,EAAE;AAAA,EACxE;AACF;AAEO,MAAM,0BAA0B,CAAC,cAAkC;AAAA,EACxE,IAAI,GAAG,QAAQ;AAAA,EACf,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ,CAAC,OAAO,aAAa;AAAA,EAC7B,QAAQ;AAAA,IACN,cAAc;AAAA,IACd,aAAa,CAAC,uBAAuB,uBAAuB;AAAA,IAC5D,aAAa;AAAA,EACf;AAAA,EACA,OAAO;AAAA,IACL,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,EACrB;AACF;AAEO,MAAM,8BAA8B,CAAC,cAAkC;AAAA,EAC5E,IAAI,GAAG,QAAQ;AAAA,EACf,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC;AAAA,EACpC,OAAO;AAAA,IACL,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,IACvB,kBAAkB;AAAA;AAAA,IAClB,yBAAyB;AAAA;AAAA,EAC3B;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/mapLayersUtils.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport type { LayerProps } from 'react-map-gl/maplibre'\r\n\r\n/** JSON form of a MapLibre paint value: a literal colour or an expression. */\r\nexport type PaintValue = string | (string | number | boolean | null | PaintValue)[]\r\n\r\n/** Cluster bubbles keyed on how many points they hide. The default when nothing else applies. */\r\nexport const CLUSTER_COUNT_COLOUR: PaintValue\r\n = ['step', ['get', 'point_count'], '#51bbd6', 100, '#f1f075', 750, '#f28cb1']\r\n\r\n export const createClusterLayer = (\r\n sourceId: string,\r\n circleColour: PaintValue = CLUSTER_COUNT_COLOUR,\r\n): LayerProps => ({\r\n id: `${sourceId}-clusters`,\r\n type: 'circle',\r\n source: sourceId,\r\n filter: ['has', 'point_count'],\r\n paint: {\r\n // Cast at the one point where a structurally-typed expression meets the style spec's\r\n // generated union, rather than at every call site.\r\n 'circle-color': circleColour as string,\r\n 'circle-radius': ['step', ['get', 'point_count'], 20, 100, 30, 750, 40],\r\n },\r\n})\r\n\r\nexport const createClusterCountLayer = (sourceId: string): LayerProps => ({\r\n id: `${sourceId}-cluster-count`,\r\n type: 'symbol',\r\n source: sourceId,\r\n filter: ['has', 'point_count'],\r\n layout: {\r\n 'text-field': '{point_count_abbreviated}',\r\n 'text-font': ['DIN Offc Pro Medium', 'Arial Unicode MS Bold'],\r\n 'text-size': 12,\r\n },\r\n paint: {\r\n 'text-color': '#000',\r\n 'text-halo-color': '#fff',\r\n 'text-halo-width': 1,\r\n },\r\n})\r\n\r\nexport const createUnclusteredPointLayer = (sourceId: string): LayerProps => ({\r\n id: `${sourceId}-unclustered-points`,\r\n type: 'circle',\r\n source: sourceId,\r\n filter: ['!', ['has', 'point_count']],\r\n paint: {\r\n 'circle-color': '#11b4da',\r\n 'circle-radius': 20,\r\n 'circle-stroke-width': 1,\r\n 'circle-stroke-color': '#fff',\r\n 'circle-opacity': 0, // fully transparent to hide circle but allow clickable\r\n 'circle-stroke-opacity': 0, // makes stroke invisible too\r\n },\r\n})\r\n"],"mappings":"AASO,MAAM,uBACT,CAAC,QAAQ,CAAC,OAAO,aAAa,GAAG,WAAW,KAAK,WAAW,KAAK,SAAS;AAEtE,MAAM,qBAAqB,CACjC,UACA,eAA2B,0BACX;AAAA,EAChB,IAAI,GAAG,QAAQ;AAAA,EACf,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ,CAAC,OAAO,aAAa;AAAA,EAC7B,OAAO;AAAA;AAAA;AAAA,IAGL,gBAAgB;AAAA,IAChB,iBAAiB,CAAC,QAAQ,CAAC,OAAO,aAAa,GAAG,IAAI,KAAK,IAAI,KAAK,EAAE;AAAA,EACxE;AACF;AAEO,MAAM,0BAA0B,CAAC,cAAkC;AAAA,EACxE,IAAI,GAAG,QAAQ;AAAA,EACf,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ,CAAC,OAAO,aAAa;AAAA,EAC7B,QAAQ;AAAA,IACN,cAAc;AAAA,IACd,aAAa,CAAC,uBAAuB,uBAAuB;AAAA,IAC5D,aAAa;AAAA,EACf;AAAA,EACA,OAAO;AAAA,IACL,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,EACrB;AACF;AAEO,MAAM,8BAA8B,CAAC,cAAkC;AAAA,EAC5E,IAAI,GAAG,QAAQ;AAAA,EACf,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC;AAAA,EACpC,OAAO;AAAA,IACL,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,IACvB,kBAAkB;AAAA;AAAA,IAClB,yBAAyB;AAAA;AAAA,EAC3B;AACF;","names":[]}
@@ -1076,6 +1076,7 @@
1076
1076
  "newTagPlaceholder": "Tag name...",
1077
1077
  "cancel": "Cancel",
1078
1078
  "filters": "Filters",
1079
+ "toggleLegend": "Show or hide the colour legend",
1079
1080
  "groupBy": "Group by",
1080
1081
  "groupByType": "Type",
1081
1082
  "groupByTag": "Tag",
@@ -1884,8 +1885,17 @@
1884
1885
  "uploadError": "Error uploading file:",
1885
1886
  "unknownError": "Unknown error occurred"
1886
1887
  },
1888
+ "BuildingSensors": {
1889
+ "average": "average",
1890
+ "reporting": "{reporting} of {total} reporting",
1891
+ "updated": "Updated {time}",
1892
+ "noReading": "No reading"
1893
+ },
1887
1894
  "SensorLegend": {
1888
- "noReading": "No reading yet"
1895
+ "noReading": "No reading yet",
1896
+ "selectType": "Change sensor type",
1897
+ "close": "Hide legend",
1898
+ "noRange": "No colour range configured for this type"
1889
1899
  },
1890
1900
  "SensorDetail": {
1891
1901
  "value": "Value",
@@ -1076,6 +1076,7 @@
1076
1076
  "newTagPlaceholder": "Nombre de la etiqueta...",
1077
1077
  "cancel": "Cancelar",
1078
1078
  "filters": "Filtros",
1079
+ "toggleLegend": "Mostrar u ocultar la leyenda de colores",
1079
1080
  "groupBy": "Agrupar por",
1080
1081
  "groupByType": "Tipo",
1081
1082
  "groupByTag": "Etiqueta",
@@ -1881,8 +1882,17 @@
1881
1882
  "uploadError": "Error al subir el archivo:",
1882
1883
  "unknownError": "Ocurrió un error desconocido"
1883
1884
  },
1885
+ "BuildingSensors": {
1886
+ "average": "promedio",
1887
+ "reporting": "{reporting} de {total} activos",
1888
+ "updated": "Actualizado a las {time}",
1889
+ "noReading": "Sin lectura"
1890
+ },
1884
1891
  "SensorLegend": {
1885
- "noReading": "Sin lectura todavía"
1892
+ "noReading": "Sin lectura todavía",
1893
+ "selectType": "Cambiar el tipo de sensor",
1894
+ "close": "Ocultar la leyenda",
1895
+ "noRange": "No hay rango de colores configurado para este tipo"
1886
1896
  },
1887
1897
  "SensorDetail": {
1888
1898
  "value": "Valor",
@@ -1076,6 +1076,7 @@
1076
1076
  "newTagPlaceholder": "Nom de l'étiquette...",
1077
1077
  "cancel": "Annuler",
1078
1078
  "filters": "Filtres",
1079
+ "toggleLegend": "Afficher ou masquer la légende des couleurs",
1079
1080
  "groupBy": "Grouper par",
1080
1081
  "groupByType": "Type",
1081
1082
  "groupByTag": "Étiquette",
@@ -1881,8 +1882,17 @@
1881
1882
  "uploadError": "Erreur lors du téléversement du fichier :",
1882
1883
  "unknownError": "Erreur inconnue s'est produite"
1883
1884
  },
1885
+ "BuildingSensors": {
1886
+ "average": "moyenne",
1887
+ "reporting": "{reporting} sur {total} en service",
1888
+ "updated": "Mis à jour à {time}",
1889
+ "noReading": "Aucune mesure"
1890
+ },
1884
1891
  "SensorLegend": {
1885
- "noReading": "Aucune mesure pour le moment"
1892
+ "noReading": "Aucune mesure pour le moment",
1893
+ "selectType": "Changer le type de capteur",
1894
+ "close": "Masquer la légende",
1895
+ "noRange": "Aucune plage de couleurs configurée pour ce type"
1886
1896
  },
1887
1897
  "SensorDetail": {
1888
1898
  "value": "Valeur",
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/core/store/Menus/context.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU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
31
+ pendingSensorAction: null,
32
+ sensorLegendVisible: {},
33
+ sensorLegendTypeId: {}
32
34
  }
33
35
  };
34
36
  };
@@ -36,7 +38,7 @@ const reducer = ({ menus }, action) => ({
36
38
  menus: MenusReducer(menus, action)
37
39
  });
38
40
  const MenusContext = React.createContext({
39
- state: { menus: { currentViewer: ViewerNames.map, rowsPerPage: 10, selectedTab: "file", commentsVisibleInViewer: [], currentCommentId: null, focusedCommentId: null, focusRequestId: 0, pendingCommentAction: null, sensorsVisibleInViewer: [], visibleSensorTypes: {}, visibleSensorTags: {}, currentSensorId: null, currentSensorTypeId: null, focusedSensorId: null, sensorFocusRequestId: 0, pendingSensorAction: null } },
41
+ state: { menus: { currentViewer: ViewerNames.map, rowsPerPage: 10, selectedTab: "file", commentsVisibleInViewer: [], currentCommentId: null, focusedCommentId: null, focusRequestId: 0, pendingCommentAction: null, sensorsVisibleInViewer: [], visibleSensorTypes: {}, visibleSensorTags: {}, currentSensorId: null, currentSensorTypeId: null, focusedSensorId: null, sensorFocusRequestId: 0, pendingSensorAction: null, sensorLegendVisible: {}, sensorLegendTypeId: {} } },
40
42
  dispatch: () => null,
41
43
  isSidebarOpen: false,
42
44
  setIsSidebarOpen: () => null,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/store/Menus/context.tsx"],"sourcesContent":["\"use client\"\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { usePathname } from 'next/navigation'\r\nimport * as React from \"react\";\r\n\r\nimport { ViewerNames } from '../../types/dbTypes'\r\n\r\nimport { MenusReducer } from './reducer'\r\n\r\nimport type { MenusActions, MenusState } from './reducer';\r\nimport type { Building, Site, User, Infrastructure } from '../../types/dbTypes'\r\nimport type { FileRow } from '../../types/files'\r\n\r\ntype InitialStateType = {\r\n menus: MenusState\r\n}\r\n\r\n// Function to determine if path is an auth page\r\nconst isAuthPath = (pathname?: string): boolean => {\r\n if (!pathname) return false\r\n return pathname.includes('/auth/')\r\n}\r\n\r\n// Get initial state based on current path\r\nconst getInitialState = (pathname?: string): InitialStateType => {\r\n const isAuth = isAuthPath(pathname)\r\n return {\r\n menus: {\r\n currentViewer: isAuth ? ViewerNames.auth : ViewerNames.map,\r\n rowsPerPage: 10, // Default rows per page\r\n selectedTab: 'file',\r\n commentsVisibleInViewer: [],\r\n currentCommentId: null,\r\n focusedCommentId: null,\r\n focusRequestId: 0,\r\n pendingCommentAction: null,\r\n sensorsVisibleInViewer: [],\r\n visibleSensorTypes: {},\r\n visibleSensorTags: {},\r\n currentSensorId: null,\r\n currentSensorTypeId: null,\r\n focusedSensorId: null,\r\n sensorFocusRequestId: 0,\r\n pendingSensorAction: null,\r\n },\r\n }\r\n}\r\n\r\nconst reducer = ({ menus }: InitialStateType, action: MenusActions) => ({\r\n menus: MenusReducer(menus, action),\r\n})\r\n\r\nexport const MenusContext = React.createContext<{\r\n state: InitialStateType\r\n dispatch: React.Dispatch<MenusActions>\r\n isSidebarOpen: boolean\r\n setIsSidebarOpen: React.Dispatch<React.SetStateAction<boolean>>\r\n view: 'table' | 'detail'\r\n setView: React.Dispatch<React.SetStateAction<'table' | 'detail'>>\r\n selectedItem: Building | null\r\n setSelectedItem: React.Dispatch<React.SetStateAction<Building | null>>\r\n selectedSite: Site | null\r\n setSelectedSite: React.Dispatch<React.SetStateAction<Site | null>>\r\n selectedInfrastructure: Infrastructure | null\r\n setSelectedInfrastructure: React.Dispatch<React.SetStateAction<Infrastructure | null>>\r\n selectedFile: FileRow | null\r\n setSelectedFile: React.Dispatch<React.SetStateAction<FileRow | null>>\r\n selectedUser: Partial<User> | null\r\n setSelectedUser: React.Dispatch<React.SetStateAction<Partial<User> | null>>\r\n isDatasetMenuOpen: boolean\r\n setIsDatasetMenuOpen: React.Dispatch<React.SetStateAction<boolean>>\r\n isAuthPage?: boolean\r\n}>({\r\n state: { menus: { currentViewer: ViewerNames.map, rowsPerPage: 10, selectedTab: 'file', commentsVisibleInViewer: [], currentCommentId: null, focusedCommentId: null, focusRequestId: 0, pendingCommentAction: null, sensorsVisibleInViewer: [], visibleSensorTypes: {}, visibleSensorTags: {}, currentSensorId: null, currentSensorTypeId: null, focusedSensorId: null, sensorFocusRequestId: 0, pendingSensorAction: null } },\r\n dispatch: () => null,\r\n isSidebarOpen: false,\r\n setIsSidebarOpen: () => null,\r\n view: 'table',\r\n setView: () => null,\r\n selectedItem: null,\r\n setSelectedItem: () => null,\r\n selectedSite: null,\r\n setSelectedSite: () => null,\r\n selectedInfrastructure: null,\r\n setSelectedInfrastructure: () => null,\r\n selectedFile: null,\r\n setSelectedFile: () => null,\r\n selectedUser: null,\r\n setSelectedUser: () => null,\r\n isDatasetMenuOpen: false,\r\n setIsDatasetMenuOpen: () => null,\r\n isAuthPage: true,\r\n})\r\n\r\nexport const MenusProvider: React.FC<React.PropsWithChildren> = ({ children }) => {\r\n const pathname = usePathname()\r\n const [state, dispatch] = React.useReducer(reducer, getInitialState(pathname))\r\n\r\n const [isSidebarOpen, setIsSidebarOpen] = React.useState(false)\r\n const [view, setView] = React.useState<'table' | 'detail'>('table')\r\n const [selectedItem, setSelectedItem] = React.useState<Building | null>(null)\r\n const [selectedSite, setSelectedSite] = React.useState<Site | null>(null)\r\n const [selectedInfrastructure, setSelectedInfrastructure] = React.useState<Infrastructure | null>(null)\r\n const [selectedFile, setSelectedFile] = React.useState<FileRow | null>(null)\r\n const [selectedUser, setSelectedUser] = React.useState<Partial<User> | null>(null)\r\n const [isDatasetMenuOpen, setIsDatasetMenuOpen] = React.useState(false)\r\n // Check if current path is an authentication page\r\n const isAuthPage = isAuthPath(pathname)\r\n\r\n // Update state if pathname changes and auth state changes\r\n React.useEffect(() => {\r\n if (isAuthPage && state.menus.currentViewer !== ViewerNames.auth) {\r\n dispatch({\r\n type: 'SET_VIEWER',\r\n payload: { currentViewer: ViewerNames.auth },\r\n })\r\n setIsSidebarOpen(false)\r\n }\r\n else if (!isAuthPage && state.menus.currentViewer === ViewerNames.auth) {\r\n dispatch({\r\n type: 'SET_VIEWER',\r\n payload: { currentViewer: ViewerNames.map },\r\n })\r\n }\r\n }, [pathname, isAuthPage, state.menus.currentViewer])\r\n\r\n const value = React.useMemo(() => ({\r\n state,\r\n dispatch,\r\n isSidebarOpen,\r\n setIsSidebarOpen,\r\n view,\r\n setView,\r\n selectedItem,\r\n setSelectedItem,\r\n selectedSite,\r\n setSelectedSite,\r\n selectedInfrastructure,\r\n setSelectedInfrastructure,\r\n selectedFile,\r\n setSelectedFile,\r\n selectedUser,\r\n setSelectedUser,\r\n isDatasetMenuOpen,\r\n setIsDatasetMenuOpen,\r\n }), [\r\n state, isSidebarOpen, view, selectedItem, selectedSite,\r\n selectedInfrastructure, selectedFile, selectedUser, isDatasetMenuOpen,\r\n ])\r\n\r\n return (\r\n <MenusContext.Provider value={value}>\r\n { children }\r\n </MenusContext.Provider>\r\n )\r\n}\r\n\r\nexport const useMenusContext = () => React.useContext(MenusContext)\r\n"],"mappings":";AA0JQ;AArJR,SAAS,mBAAmB;AAC5B,YAAY,WAAW;AAEvB,SAAS,mBAAmB;AAE5B,SAAS,oBAAoB;AAW7B,MAAM,aAAa,CAAC,aAA+B;AAC/C,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO,SAAS,SAAS,QAAQ;AACrC;AAGA,MAAM,kBAAkB,CAAC,aAAwC;AAC7D,QAAM,SAAS,WAAW,QAAQ;AAClC,SAAO;AAAA,IACH,OAAO;AAAA,MACH,eAAe,SAAS,YAAY,OAAO,YAAY;AAAA,MACvD,aAAa;AAAA;AAAA,MACb,aAAa;AAAA,MACb,yBAAyB,CAAC;AAAA,MAC1B,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,MAChB,sBAAsB;AAAA,MACtB,wBAAwB,CAAC;AAAA,MACzB,oBAAoB,CAAC;AAAA,MACrB,mBAAmB,CAAC;AAAA,MACpB,iBAAiB;AAAA,MACjB,qBAAqB;AAAA,MACrB,iBAAiB;A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Menus/context.tsx"],"sourcesContent":["\"use client\"\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { usePathname } from 'next/navigation'\r\nimport * as React from \"react\";\r\n\r\nimport { ViewerNames } from '../../types/dbTypes'\r\n\r\nimport { MenusReducer } from './reducer'\r\n\r\nimport type { MenusActions, MenusState } from './reducer';\r\nimport type { Building, Site, User, Infrastructure } from '../../types/dbTypes'\r\nimport type { FileRow } from '../../types/files'\r\n\r\ntype InitialStateType = {\r\n menus: MenusState\r\n}\r\n\r\n// Function to determine if path is an auth page\r\nconst isAuthPath = (pathname?: string): boolean => {\r\n if (!pathname) return false\r\n return pathname.includes('/auth/')\r\n}\r\n\r\n// Get initial state based on current path\r\nconst getInitialState = (pathname?: string): InitialStateType => {\r\n const isAuth = isAuthPath(pathname)\r\n return {\r\n menus: {\r\n currentViewer: isAuth ? ViewerNames.auth : ViewerNames.map,\r\n rowsPerPage: 10, // Default rows per page\r\n selectedTab: 'file',\r\n commentsVisibleInViewer: [],\r\n currentCommentId: null,\r\n focusedCommentId: null,\r\n focusRequestId: 0,\r\n pendingCommentAction: null,\r\n sensorsVisibleInViewer: [],\r\n visibleSensorTypes: {},\r\n visibleSensorTags: {},\r\n currentSensorId: null,\r\n currentSensorTypeId: null,\r\n focusedSensorId: null,\r\n sensorFocusRequestId: 0,\r\n pendingSensorAction: null,\r\n sensorLegendVisible: {},\r\n sensorLegendTypeId: {},\r\n },\r\n }\r\n}\r\n\r\nconst reducer = ({ menus }: InitialStateType, action: MenusActions) => ({\r\n menus: MenusReducer(menus, action),\r\n})\r\n\r\nexport const MenusContext = React.createContext<{\r\n state: InitialStateType\r\n dispatch: React.Dispatch<MenusActions>\r\n isSidebarOpen: boolean\r\n setIsSidebarOpen: React.Dispatch<React.SetStateAction<boolean>>\r\n view: 'table' | 'detail'\r\n setView: React.Dispatch<React.SetStateAction<'table' | 'detail'>>\r\n selectedItem: Building | null\r\n setSelectedItem: React.Dispatch<React.SetStateAction<Building | null>>\r\n selectedSite: Site | null\r\n setSelectedSite: React.Dispatch<React.SetStateAction<Site | null>>\r\n selectedInfrastructure: Infrastructure | null\r\n setSelectedInfrastructure: React.Dispatch<React.SetStateAction<Infrastructure | null>>\r\n selectedFile: FileRow | null\r\n setSelectedFile: React.Dispatch<React.SetStateAction<FileRow | null>>\r\n selectedUser: Partial<User> | null\r\n setSelectedUser: React.Dispatch<React.SetStateAction<Partial<User> | null>>\r\n isDatasetMenuOpen: boolean\r\n setIsDatasetMenuOpen: React.Dispatch<React.SetStateAction<boolean>>\r\n isAuthPage?: boolean\r\n}>({\r\n state: { menus: { currentViewer: ViewerNames.map, rowsPerPage: 10, selectedTab: 'file', commentsVisibleInViewer: [], currentCommentId: null, focusedCommentId: null, focusRequestId: 0, pendingCommentAction: null, sensorsVisibleInViewer: [], visibleSensorTypes: {}, visibleSensorTags: {}, currentSensorId: null, currentSensorTypeId: null, focusedSensorId: null, sensorFocusRequestId: 0, pendingSensorAction: null, sensorLegendVisible: {}, sensorLegendTypeId: {} } },\r\n dispatch: () => null,\r\n isSidebarOpen: false,\r\n setIsSidebarOpen: () => null,\r\n view: 'table',\r\n setView: () => null,\r\n selectedItem: null,\r\n setSelectedItem: () => null,\r\n selectedSite: null,\r\n setSelectedSite: () => null,\r\n selectedInfrastructure: null,\r\n setSelectedInfrastructure: () => null,\r\n selectedFile: null,\r\n setSelectedFile: () => null,\r\n selectedUser: null,\r\n setSelectedUser: () => null,\r\n isDatasetMenuOpen: false,\r\n setIsDatasetMenuOpen: () => null,\r\n isAuthPage: true,\r\n})\r\n\r\nexport const MenusProvider: React.FC<React.PropsWithChildren> = ({ children }) => {\r\n const pathname = usePathname()\r\n const [state, dispatch] = React.useReducer(reducer, getInitialState(pathname))\r\n\r\n const [isSidebarOpen, setIsSidebarOpen] = React.useState(false)\r\n const [view, setView] = React.useState<'table' | 'detail'>('table')\r\n const [selectedItem, setSelectedItem] = React.useState<Building | null>(null)\r\n const [selectedSite, setSelectedSite] = React.useState<Site | null>(null)\r\n const [selectedInfrastructure, setSelectedInfrastructure] = React.useState<Infrastructure | null>(null)\r\n const [selectedFile, setSelectedFile] = React.useState<FileRow | null>(null)\r\n const [selectedUser, setSelectedUser] = React.useState<Partial<User> | null>(null)\r\n const [isDatasetMenuOpen, setIsDatasetMenuOpen] = React.useState(false)\r\n // Check if current path is an authentication page\r\n const isAuthPage = isAuthPath(pathname)\r\n\r\n // Update state if pathname changes and auth state changes\r\n React.useEffect(() => {\r\n if (isAuthPage && state.menus.currentViewer !== ViewerNames.auth) {\r\n dispatch({\r\n type: 'SET_VIEWER',\r\n payload: { currentViewer: ViewerNames.auth },\r\n })\r\n setIsSidebarOpen(false)\r\n }\r\n else if (!isAuthPage && state.menus.currentViewer === ViewerNames.auth) {\r\n dispatch({\r\n type: 'SET_VIEWER',\r\n payload: { currentViewer: ViewerNames.map },\r\n })\r\n }\r\n }, [pathname, isAuthPage, state.menus.currentViewer])\r\n\r\n const value = React.useMemo(() => ({\r\n state,\r\n dispatch,\r\n isSidebarOpen,\r\n setIsSidebarOpen,\r\n view,\r\n setView,\r\n selectedItem,\r\n setSelectedItem,\r\n selectedSite,\r\n setSelectedSite,\r\n selectedInfrastructure,\r\n setSelectedInfrastructure,\r\n selectedFile,\r\n setSelectedFile,\r\n selectedUser,\r\n setSelectedUser,\r\n isDatasetMenuOpen,\r\n setIsDatasetMenuOpen,\r\n }), [\r\n state, isSidebarOpen, view, selectedItem, selectedSite,\r\n selectedInfrastructure, selectedFile, selectedUser, isDatasetMenuOpen,\r\n ])\r\n\r\n return (\r\n <MenusContext.Provider value={value}>\r\n { children }\r\n </MenusContext.Provider>\r\n )\r\n}\r\n\r\nexport const useMenusContext = () => React.useContext(MenusContext)\r\n"],"mappings":";AA4JQ;AAvJR,SAAS,mBAAmB;AAC5B,YAAY,WAAW;AAEvB,SAAS,mBAAmB;AAE5B,SAAS,oBAAoB;AAW7B,MAAM,aAAa,CAA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