@collabdt/core 0.3.1 → 0.3.2

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 (196) hide show
  1. package/dist/core/components/authentication/ForgotPassword.d.ts.map +1 -1
  2. package/dist/core/components/authentication/ForgotPassword.js +0 -1
  3. package/dist/core/components/authentication/ForgotPassword.js.map +1 -1
  4. package/dist/core/components/ui/Comments/CollapsibleCommentItem.d.ts +12 -2
  5. package/dist/core/components/ui/Comments/CollapsibleCommentItem.d.ts.map +1 -1
  6. package/dist/core/components/ui/Comments/CollapsibleCommentItem.js +137 -139
  7. package/dist/core/components/ui/Comments/CollapsibleCommentItem.js.map +1 -1
  8. package/dist/core/components/ui/Comments/Comment.d.ts +18 -1
  9. package/dist/core/components/ui/Comments/Comment.d.ts.map +1 -1
  10. package/dist/core/components/ui/Comments/Comment.js +94 -23
  11. package/dist/core/components/ui/Comments/Comment.js.map +1 -1
  12. package/dist/core/components/ui/Comments/CommentActionButtons.d.ts +34 -0
  13. package/dist/core/components/ui/Comments/CommentActionButtons.d.ts.map +1 -0
  14. package/dist/core/components/ui/Comments/CommentActionButtons.js +106 -0
  15. package/dist/core/components/ui/Comments/CommentActionButtons.js.map +1 -0
  16. package/dist/core/components/ui/Comments/CommentInput.d.ts.map +1 -1
  17. package/dist/core/components/ui/Comments/CommentInput.js +5 -2
  18. package/dist/core/components/ui/Comments/CommentInput.js.map +1 -1
  19. package/dist/core/components/ui/Comments/CommentsSection.d.ts.map +1 -1
  20. package/dist/core/components/ui/Comments/CommentsSection.js +86 -42
  21. package/dist/core/components/ui/Comments/CommentsSection.js.map +1 -1
  22. package/dist/core/components/ui/Comments/commentUtils.d.ts.map +1 -1
  23. package/dist/core/components/ui/Comments/commentUtils.js +2 -1
  24. package/dist/core/components/ui/Comments/commentUtils.js.map +1 -1
  25. package/dist/core/components/ui/FilesManager/src/useFileUploadWithProgress.d.ts.map +1 -1
  26. package/dist/core/components/ui/FilesManager/src/useFileUploadWithProgress.js +0 -1
  27. package/dist/core/components/ui/FilesManager/src/useFileUploadWithProgress.js.map +1 -1
  28. package/dist/core/components/ui/InfoSidebar/Container.d.ts.map +1 -1
  29. package/dist/core/components/ui/InfoSidebar/Container.js +16 -12
  30. package/dist/core/components/ui/InfoSidebar/Container.js.map +1 -1
  31. package/dist/core/components/ui/Sensors/SensorInput.d.ts.map +1 -1
  32. package/dist/core/components/ui/Sensors/SensorInput.js +0 -1
  33. package/dist/core/components/ui/Sensors/SensorInput.js.map +1 -1
  34. package/dist/core/components/ui/Sensors/SensorsSection.js +0 -2
  35. package/dist/core/components/ui/Sensors/SensorsSection.js.map +1 -1
  36. package/dist/core/components/ui/Sidebar.d.ts.map +1 -1
  37. package/dist/core/components/ui/Sidebar.js +27 -4
  38. package/dist/core/components/ui/Sidebar.js.map +1 -1
  39. package/dist/core/components/ui/ToolbarButton.d.ts.map +1 -1
  40. package/dist/core/components/ui/ToolbarButton.js +0 -1
  41. package/dist/core/components/ui/ToolbarButton.js.map +1 -1
  42. package/dist/core/components/viewers/Data/advancedFilter/FiltersDialog.d.ts.map +1 -1
  43. package/dist/core/components/viewers/Data/advancedFilter/FiltersDialog.js +0 -2
  44. package/dist/core/components/viewers/Data/advancedFilter/FiltersDialog.js.map +1 -1
  45. package/dist/core/components/viewers/Data/details/EnergySourcesGrid.d.ts.map +1 -1
  46. package/dist/core/components/viewers/Data/details/EnergySourcesGrid.js +0 -10
  47. package/dist/core/components/viewers/Data/details/EnergySourcesGrid.js.map +1 -1
  48. package/dist/core/components/viewers/Data/files/DatatableFileAdder.d.ts.map +1 -1
  49. package/dist/core/components/viewers/Data/files/DatatableFileAdder.js +0 -1
  50. package/dist/core/components/viewers/Data/files/DatatableFileAdder.js.map +1 -1
  51. package/dist/core/components/viewers/Data/files/utils/fuzzySearch.d.ts.map +1 -1
  52. package/dist/core/components/viewers/Data/files/utils/fuzzySearch.js +0 -1
  53. package/dist/core/components/viewers/Data/files/utils/fuzzySearch.js.map +1 -1
  54. package/dist/core/components/viewers/Data/userDetails/UserMoreOptions.d.ts.map +1 -1
  55. package/dist/core/components/viewers/Data/userDetails/UserMoreOptions.js +0 -1
  56. package/dist/core/components/viewers/Data/userDetails/UserMoreOptions.js.map +1 -1
  57. package/dist/core/components/viewers/Data/utils/filterHelper.d.ts.map +1 -1
  58. package/dist/core/components/viewers/Data/utils/filterHelper.js +0 -2
  59. package/dist/core/components/viewers/Data/utils/filterHelper.js.map +1 -1
  60. package/dist/core/components/viewers/bim/src/BimSidebar/src/CommunicationTab/src/TopicsSection.d.ts.map +1 -1
  61. package/dist/core/components/viewers/bim/src/BimSidebar/src/CommunicationTab/src/TopicsSection.js +0 -3
  62. package/dist/core/components/viewers/bim/src/BimSidebar/src/CommunicationTab/src/TopicsSection.js.map +1 -1
  63. package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/FilesSection.d.ts.map +1 -1
  64. package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/FilesSection.js +1 -7
  65. package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/FilesSection.js.map +1 -1
  66. package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/ModelsSection.d.ts.map +1 -1
  67. package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/ModelsSection.js +1 -9
  68. package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/ModelsSection.js.map +1 -1
  69. package/dist/core/components/viewers/bim/src/BimSidebar/src/TabSelector.d.ts.map +1 -1
  70. package/dist/core/components/viewers/bim/src/BimSidebar/src/TabSelector.js +4 -3
  71. package/dist/core/components/viewers/bim/src/BimSidebar/src/TabSelector.js.map +1 -1
  72. package/dist/core/components/viewers/bim/src/ClippingPlane.d.ts.map +1 -1
  73. package/dist/core/components/viewers/bim/src/ClippingPlane.js +0 -1
  74. package/dist/core/components/viewers/bim/src/ClippingPlane.js.map +1 -1
  75. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/BimComment.d.ts +16 -10
  76. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/BimComment.d.ts.map +1 -1
  77. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/BimComment.js +26 -6
  78. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/BimComment.js.map +1 -1
  79. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/BimCommentCluster.d.ts +23 -0
  80. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/BimCommentCluster.d.ts.map +1 -0
  81. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/BimCommentCluster.js +108 -0
  82. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/BimCommentCluster.js.map +1 -0
  83. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/clusterMarkersByScreenSpace.d.ts +44 -0
  84. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/clusterMarkersByScreenSpace.d.ts.map +1 -0
  85. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/clusterMarkersByScreenSpace.js +77 -0
  86. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/clusterMarkersByScreenSpace.js.map +1 -0
  87. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/commentCameraUtils.d.ts +24 -0
  88. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/commentCameraUtils.d.ts.map +1 -0
  89. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/commentCameraUtils.js +27 -0
  90. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/commentCameraUtils.js.map +1 -0
  91. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/renderCSS2DMarkers.d.ts.map +1 -1
  92. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/renderCSS2DMarkers.js +2 -2
  93. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/renderCSS2DMarkers.js.map +1 -1
  94. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useCommentMarkers.d.ts.map +1 -1
  95. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useCommentMarkers.js +242 -61
  96. package/dist/core/components/viewers/bim/src/tools/AddToBim/src/useCommentMarkers.js.map +1 -1
  97. package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingTool.d.ts.map +1 -1
  98. package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingTool.js +1 -5
  99. package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingTool.js.map +1 -1
  100. package/dist/core/components/viewers/bim/src/tools/ExplodeByLevelTool.d.ts.map +1 -1
  101. package/dist/core/components/viewers/bim/src/tools/ExplodeByLevelTool.js +0 -1
  102. package/dist/core/components/viewers/bim/src/tools/ExplodeByLevelTool.js.map +1 -1
  103. package/dist/core/components/viewers/bim/src/tools/measureBimTool.d.ts.map +1 -1
  104. package/dist/core/components/viewers/bim/src/tools/measureBimTool.js +1 -2
  105. package/dist/core/components/viewers/bim/src/tools/measureBimTool.js.map +1 -1
  106. package/dist/core/components/viewers/map/MapViewer.d.ts.map +1 -1
  107. package/dist/core/components/viewers/map/MapViewer.js.map +1 -1
  108. package/dist/core/components/viewers/map/datasets/src/arcGISDatasets.d.ts.map +1 -1
  109. package/dist/core/components/viewers/map/datasets/src/arcGISDatasets.js +11 -14
  110. package/dist/core/components/viewers/map/datasets/src/arcGISDatasets.js.map +1 -1
  111. package/dist/core/components/viewers/map/datasets/src/ckanDatasets.d.ts.map +1 -1
  112. package/dist/core/components/viewers/map/datasets/src/ckanDatasets.js +2 -5
  113. package/dist/core/components/viewers/map/datasets/src/ckanDatasets.js.map +1 -1
  114. package/dist/core/components/viewers/map/datasets/src/localDatasets.d.ts.map +1 -1
  115. package/dist/core/components/viewers/map/datasets/src/localDatasets.js +0 -3
  116. package/dist/core/components/viewers/map/datasets/src/localDatasets.js.map +1 -1
  117. package/dist/core/components/viewers/map/datasets/src/opendatasoftDatasets.d.ts.map +1 -1
  118. package/dist/core/components/viewers/map/datasets/src/opendatasoftDatasets.js +0 -11
  119. package/dist/core/components/viewers/map/datasets/src/opendatasoftDatasets.js.map +1 -1
  120. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/src/BuildingsTools.d.ts.map +1 -1
  121. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/src/BuildingsTools.js +0 -1
  122. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/DatabaseBuildingPopover/src/BuildingsTools.js.map +1 -1
  123. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.d.ts.map +1 -1
  124. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.js +0 -1
  125. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/NonDatabaseBuildingPopover.js.map +1 -1
  126. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.d.ts.map +1 -1
  127. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.js +0 -1
  128. package/dist/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.js.map +1 -1
  129. package/dist/core/components/viewers/map/src/MapLayers/src/CommentLayer/index.d.ts.map +1 -1
  130. package/dist/core/components/viewers/map/src/MapLayers/src/CommentLayer/index.js +174 -53
  131. package/dist/core/components/viewers/map/src/MapLayers/src/CommentLayer/index.js.map +1 -1
  132. package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/components/MapFileManager.d.ts.map +1 -1
  133. package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/components/MapFileManager.js +2 -1
  134. package/dist/core/components/viewers/map/src/MapLayers/src/FileLayer/components/MapFileManager.js.map +1 -1
  135. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.d.ts.map +1 -1
  136. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.js +0 -3
  137. package/dist/core/components/viewers/map/src/MapLayers/src/SensorsLayer/index.js.map +1 -1
  138. package/dist/core/components/viewers/map/src/MapSidebar/TabSelector.d.ts.map +1 -1
  139. package/dist/core/components/viewers/map/src/MapSidebar/TabSelector.js +4 -3
  140. package/dist/core/components/viewers/map/src/MapSidebar/TabSelector.js.map +1 -1
  141. package/dist/core/components/viewers/map/src/MapSidebar/src/FileTab/src/FilesSection.d.ts.map +1 -1
  142. package/dist/core/components/viewers/map/src/MapSidebar/src/FileTab/src/FilesSection.js +0 -1
  143. package/dist/core/components/viewers/map/src/MapSidebar/src/FileTab/src/FilesSection.js.map +1 -1
  144. package/dist/core/components/viewers/map/src/MapSidebar/src/FileTab/src/ModelsSection.d.ts.map +1 -1
  145. package/dist/core/components/viewers/map/src/MapSidebar/src/FileTab/src/ModelsSection.js +1 -5
  146. package/dist/core/components/viewers/map/src/MapSidebar/src/FileTab/src/ModelsSection.js.map +1 -1
  147. package/dist/core/components/viewers/map/src/tools/AddTools/AddFile/utils/uploadToPresignedURLS.d.ts.map +1 -1
  148. package/dist/core/components/viewers/map/src/tools/AddTools/AddFile/utils/uploadToPresignedURLS.js +1 -3
  149. package/dist/core/components/viewers/map/src/tools/AddTools/AddFile/utils/uploadToPresignedURLS.js.map +1 -1
  150. package/dist/core/components/viewers/map/utils/MapEventManager/MapClickManager.d.ts.map +1 -1
  151. package/dist/core/components/viewers/map/utils/MapEventManager/MapClickManager.js +0 -1
  152. package/dist/core/components/viewers/map/utils/MapEventManager/MapClickManager.js.map +1 -1
  153. package/dist/core/components/viewers/map/utils/flyToEach.d.ts.map +1 -1
  154. package/dist/core/components/viewers/map/utils/flyToEach.js +0 -1
  155. package/dist/core/components/viewers/map/utils/flyToEach.js.map +1 -1
  156. package/dist/core/components/viewers/map/utils/getOsmIdbyCoordinates.d.ts.map +1 -1
  157. package/dist/core/components/viewers/map/utils/getOsmIdbyCoordinates.js +0 -2
  158. package/dist/core/components/viewers/map/utils/getOsmIdbyCoordinates.js.map +1 -1
  159. package/dist/core/hooks/comments/comments.d.ts +11 -0
  160. package/dist/core/hooks/comments/comments.d.ts.map +1 -1
  161. package/dist/core/hooks/comments/comments.js +3 -1
  162. package/dist/core/hooks/comments/comments.js.map +1 -1
  163. package/dist/core/hooks/comments/createCommentHooks.d.ts +11 -0
  164. package/dist/core/hooks/comments/createCommentHooks.d.ts.map +1 -1
  165. package/dist/core/hooks/comments/createCommentHooks.js +30 -1
  166. package/dist/core/hooks/comments/createCommentHooks.js.map +1 -1
  167. package/dist/core/hooks/files/files.d.ts.map +1 -1
  168. package/dist/core/hooks/files/files.js +0 -1
  169. package/dist/core/hooks/files/files.js.map +1 -1
  170. package/dist/core/hooks/ui/useResizableSidebarWidth.d.ts +30 -0
  171. package/dist/core/hooks/ui/useResizableSidebarWidth.d.ts.map +1 -0
  172. package/dist/core/hooks/ui/useResizableSidebarWidth.js +75 -0
  173. package/dist/core/hooks/ui/useResizableSidebarWidth.js.map +1 -0
  174. package/dist/core/i18n/messages/en.json +5 -0
  175. package/dist/core/i18n/messages/es.json +6 -1
  176. package/dist/core/i18n/messages/fr.json +6 -1
  177. package/dist/core/store/Datasets/reducer.d.ts.map +1 -1
  178. package/dist/core/store/Datasets/reducer.js +0 -2
  179. package/dist/core/store/Datasets/reducer.js.map +1 -1
  180. package/dist/core/store/Files/reducer.js +0 -1
  181. package/dist/core/store/Files/reducer.js.map +1 -1
  182. package/dist/core/store/Menus/context.d.ts.map +1 -1
  183. package/dist/core/store/Menus/context.js +4 -1
  184. package/dist/core/store/Menus/context.js.map +1 -1
  185. package/dist/core/store/Menus/reducer.d.ts +20 -0
  186. package/dist/core/store/Menus/reducer.d.ts.map +1 -1
  187. package/dist/core/store/Menus/reducer.js +21 -3
  188. package/dist/core/store/Menus/reducer.js.map +1 -1
  189. package/dist/core/utils/markerUtils.d.ts +10 -0
  190. package/dist/core/utils/markerUtils.d.ts.map +1 -1
  191. package/dist/core/utils/markerUtils.js +9 -1
  192. package/dist/core/utils/markerUtils.js.map +1 -1
  193. package/dist/core/utils/memcache.d.ts.map +1 -1
  194. package/dist/core/utils/memcache.js +0 -7
  195. package/dist/core/utils/memcache.js.map +1 -1
  196. package/package.json +4 -1
@@ -1 +1 @@
1
- {"version":3,"file":"OpenDataFeaturePopover.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAqB9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAEpD,UAAU,2BAA2B;IACnC,OAAO,EAAE,iBAAiB,CAAA;IAC1B,MAAM,EAAE,OAAO,CAAA;IACf,aAAa,EAAE,MAAM,IAAI,CAAA;CAC1B;AAED,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,OAAO,EACP,MAAM,EACN,aAAa,GACd,EAAE,2BAA2B,qBAqL7B"}
1
+ {"version":3,"file":"OpenDataFeaturePopover.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAqB9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAEpD,UAAU,2BAA2B;IACnC,OAAO,EAAE,iBAAiB,CAAA;IAC1B,MAAM,EAAE,OAAO,CAAA;IACf,aAAa,EAAE,MAAM,IAAI,CAAA;CAC1B;AAED,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,OAAO,EACP,MAAM,EACN,aAAa,GACd,EAAE,2BAA2B,qBAmL7B"}
@@ -82,7 +82,6 @@ function OpenDataFeaturePopover({
82
82
  const isUrl = (value) => {
83
83
  return value.startsWith("http://") || value.startsWith("https://");
84
84
  };
85
- console.log("Feature Properties:", featureProps);
86
85
  const datasetName = featureProps.datasetName ? featureProps.datasetName.replaceAll("_", " ") : t("unknownDataset");
87
86
  const dataset = addedDatasets.find((d) => d.name === featureProps.datasetName);
88
87
  const datasetColor = dataset ? dataset.layerColor.color : stringToColour(datasetName);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.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\n// Dependencies\r\nimport * as LR from 'lucide-react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\n// Shadcn Components\r\nimport { DatasetsContext } from '../../../../../../store/Datasets/context'\r\nimport { Button } from '../../../../../ui/Button'\r\nimport ColorCircle from '../../../../../ui/ColorCircle'\r\nimport { PopoverContent } from '../../../../../ui/Popover'\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHead,\r\n TableHeader,\r\n TableRow,\r\n} from '../../../../../ui/Table'\r\n\r\n// Icons\r\n\r\n// Types / Utilities\r\nimport { stringToColour } from '../../../utils/stringToColour'\r\n\r\nimport type { MapGeoJSONFeature } from 'maplibre-gl'\r\n\r\ninterface OpenDataFeaturePopoverProps {\r\n feature: MapGeoJSONFeature\r\n isOpen: boolean\r\n onCloseAction: () => void\r\n}\r\n\r\nexport default function OpenDataFeaturePopover({\r\n feature,\r\n isOpen,\r\n onCloseAction,\r\n}: OpenDataFeaturePopoverProps) {\r\n // Translation\r\n const t = useTranslations('OpenDataFeaturePopover')\r\n\r\n const {state: datasetsState} = React.useContext(DatasetsContext)\r\n const {addedDatasets} = datasetsState.datasets\r\n\r\n const featureProps = feature?.properties || {}\r\n // Filter out properties that are null, undefined, empty strings, or coordinate-related\r\n const validProperties = Object.entries(featureProps)\r\n .filter(([key, value]) => {\r\n // Check for null, undefined, or empty string values\r\n const lowValue = String(value).toLowerCase()\r\n if (\r\n value === null\r\n || value === undefined\r\n || value === ''\r\n || lowValue === 'null'\r\n || lowValue === 'undefined'\r\n || lowValue === 'none'\r\n ) {\r\n return false\r\n }\r\n\r\n // Filter out coordinate-related properties\r\n const lowerKey = key.toLowerCase()\r\n const excludingKeys = [\r\n 'globalid',\r\n 'latitude',\r\n 'lat',\r\n 'longitude',\r\n 'lng',\r\n 'lon',\r\n 'coordinates',\r\n 'coordina',\r\n 'x',\r\n 'y',\r\n 'z',\r\n 'geometry',\r\n 'cluster',\r\n 'cluster_id',\r\n 'point_count_abbreviated',\r\n 'datasetName',\r\n 'datasetColor',\r\n ]\r\n return !excludingKeys.includes(lowerKey)\r\n })\r\n .sort(([keyA], [keyB]) => {\r\n const aHasName = keyA.toLowerCase().includes('name')\r\n const bHasName = keyB.toLowerCase().includes('name')\r\n if (aHasName && !bHasName) return -1\r\n if (!aHasName && bHasName) return 1\r\n return 0\r\n })\r\n\r\n // Function to format property names (convert snake_case to readable format)\r\n const formatPropertyName = (key: string): string => {\r\n return key\r\n .replaceAll('_', ' ')\r\n .replaceAll(/\\b\\w/g, l => l.toUpperCase())\r\n }\r\n\r\n // Function to format property values\r\n const formatPropertyValue = (value: any, key?: string): string => {\r\n if (typeof value === 'boolean') {\r\n return value ? 'Yes' : 'No'\r\n }\r\n if (typeof value === 'number') {\r\n // Don't add commas for year-like fields\r\n if (key && key.toLowerCase().includes('year')) {\r\n return value.toString()\r\n }\r\n return value.toLocaleString()\r\n }\r\n if (typeof value === 'string') {\r\n // Handle URLs\r\n if (value.startsWith('http://') || value.startsWith('https://')) {\r\n return value\r\n }\r\n return value\r\n }\r\n return String(value)\r\n }\r\n\r\n // Function to check if value is a URL\r\n const isUrl = (value: string): boolean => {\r\n return value.startsWith('http://') || value.startsWith('https://')\r\n }\r\n\r\n console.log('Feature Properties:', featureProps)\r\n\r\n const datasetName = (featureProps.datasetName ? featureProps.datasetName.replaceAll('_', ' ') : t('unknownDataset'))\r\n const dataset = addedDatasets.find(d => d.name === featureProps.datasetName)\r\n const datasetColor = dataset ? dataset.layerColor.color : stringToColour(datasetName)\r\n\r\n return (\r\n <PopoverContent className=\"w-80 -m-1\" side=\"top\">\r\n <div className=\"grid gap-4\">\r\n <Button\r\n onClick={onCloseAction}\r\n variant=\"ghost\"\r\n className=\"absolute top-1 right-2 p-1 text-muted-foreground hover:text-foreground\"\r\n aria-label=\"Close\"\r\n >\r\n <LR.X className=\"w-4 h-4\" />\r\n </Button>\r\n <div className=\"space-y-2\">\r\n <div className=\"flex items-center gap-2\">\r\n <LR.Database className=\"w-4 h-4\" />\r\n <h4 className=\"font-medium leading-none\">{t('propertiesHeader')}</h4>\r\n </div>\r\n {/* Circle with the dataset color */}\r\n <div className=\"flex items-center gap-2 pl-[2px]\">\r\n <ColorCircle color={datasetColor} size={14} />\r\n <p className=\"text-xs text-muted-foreground\">\r\n {datasetName}\r\n </p>\r\n </div>\r\n </div>\r\n\r\n {validProperties.length > 0\r\n ? (\r\n <div className=\"max-h-64 overflow-auto\">\r\n <Table>\r\n <TableHeader>\r\n <TableRow>\r\n <TableHead className=\"w-1/3 text-xs\">{t('propertyTableHead')}</TableHead>\r\n <TableHead className=\"text-xs\">{t('valueTableHead')}</TableHead>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {validProperties.map(([key, value]) => (\r\n <TableRow key={key}>\r\n <TableCell className=\"font-medium text-xs py-2\">\r\n {formatPropertyName(key)}\r\n </TableCell>\r\n <TableCell className=\"text-xs py-2\">\r\n {isUrl(String(value))\r\n ? (\r\n <a\r\n href={String(value)}\r\n target=\"_blank\"\r\n rel=\"noopener noreferrer\"\r\n className=\"text-blue-600 hover:text-blue-800 underline break-all\"\r\n >\r\n {formatPropertyValue(value, key)}\r\n </a>\r\n )\r\n : (\r\n <span className=\"break-words\">\r\n {formatPropertyValue(value, key)}\r\n </span>\r\n )}\r\n </TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n </div>\r\n )\r\n : (\r\n <div className=\"text-center py-4\">\r\n <LR.FileX className=\"w-8 h-8 text-muted-foreground mx-auto mb-2\" />\r\n <p className=\"text-sm text-muted-foreground\">\r\n {t('noPropertyAvail')}\r\n </p>\r\n </div>\r\n )}\r\n\r\n {validProperties.length > 10 && (\r\n <div className=\"text-xs text-muted-foreground text-center\">\r\n {t('showing')}\r\n {' '}\r\n {validProperties.length}\r\n {' '}\r\n {t('properties')}\r\n </div>\r\n )}\r\n </div>\r\n </PopoverContent>\r\n )\r\n}\r\n"],"mappings":";AAiJU,cAGA,YAHA;AA3IV,YAAY,QAAQ;AACpB,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAGvB,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,OAAO,iBAAiB;AACxB,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,sBAAsB;AAUhB,SAAR,uBAAwC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAE9B,QAAM,IAAI,gBAAgB,wBAAwB;AAElD,QAAM,EAAC,OAAO,cAAa,IAAI,MAAM,WAAW,eAAe;AAC/D,QAAM,EAAC,cAAa,IAAI,cAAc;AAEtC,QAAM,gBAAe,mCAAS,eAAc,CAAC;AAE7C,QAAM,kBAAkB,OAAO,QAAQ,YAAY,EAChD,OAAO,CAAC,CAAC,KAAK,KAAK,MAAM;AAExB,UAAM,WAAW,OAAO,KAAK,EAAE,YAAY;AAC3C,QACE,UAAU,QACP,UAAU,UACV,UAAU,MACV,aAAa,UACb,aAAa,eACb,aAAa,QAChB;AACA,aAAO;AAAA,IACT;AAGA,UAAM,WAAW,IAAI,YAAY;AACjC,UAAM,gBAAgB;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,WAAO,CAAC,cAAc,SAA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BAAC,GAAG,OAAH,EAAS,WAAU,8CAA6C;AAAA,MACjE,oBAAC,OAAE,WAAU,iCACV,YAAE,iBAAiB,GACtB;AAAA,OACF;AAAA,IAGL,gBAAgB,SAAS,MACxB,qBAAC,SAAI,WAAU,6CACZ;AAAA,QAAE,SAAS;AAAA,MACX;AAAA,MACA,gBAAgB;AAAA,MAChB;AAAA,MACA,EAAE,YAAY;AAAA,OACjB;AAAA,KAEJ,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../../../../src/core/components/viewers/map/src/MapFeaturePopoverMenu/src/OpenDataFeaturePopover.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\n// Dependencies\r\nimport * as LR from 'lucide-react'\r\nimport { useTranslations } from 'next-intl'\r\nimport * as React from 'react'\r\n\r\n// Shadcn Components\r\nimport { DatasetsContext } from '../../../../../../store/Datasets/context'\r\nimport { Button } from '../../../../../ui/Button'\r\nimport ColorCircle from '../../../../../ui/ColorCircle'\r\nimport { PopoverContent } from '../../../../../ui/Popover'\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHead,\r\n TableHeader,\r\n TableRow,\r\n} from '../../../../../ui/Table'\r\n\r\n// Icons\r\n\r\n// Types / Utilities\r\nimport { stringToColour } from '../../../utils/stringToColour'\r\n\r\nimport type { MapGeoJSONFeature } from 'maplibre-gl'\r\n\r\ninterface OpenDataFeaturePopoverProps {\r\n feature: MapGeoJSONFeature\r\n isOpen: boolean\r\n onCloseAction: () => void\r\n}\r\n\r\nexport default function OpenDataFeaturePopover({\r\n feature,\r\n isOpen,\r\n onCloseAction,\r\n}: OpenDataFeaturePopoverProps) {\r\n // Translation\r\n const t = useTranslations('OpenDataFeaturePopover')\r\n\r\n const {state: datasetsState} = React.useContext(DatasetsContext)\r\n const {addedDatasets} = datasetsState.datasets\r\n\r\n const featureProps = feature?.properties || {}\r\n // Filter out properties that are null, undefined, empty strings, or coordinate-related\r\n const validProperties = Object.entries(featureProps)\r\n .filter(([key, value]) => {\r\n // Check for null, undefined, or empty string values\r\n const lowValue = String(value).toLowerCase()\r\n if (\r\n value === null\r\n || value === undefined\r\n || value === ''\r\n || lowValue === 'null'\r\n || lowValue === 'undefined'\r\n || lowValue === 'none'\r\n ) {\r\n return false\r\n }\r\n\r\n // Filter out coordinate-related properties\r\n const lowerKey = key.toLowerCase()\r\n const excludingKeys = [\r\n 'globalid',\r\n 'latitude',\r\n 'lat',\r\n 'longitude',\r\n 'lng',\r\n 'lon',\r\n 'coordinates',\r\n 'coordina',\r\n 'x',\r\n 'y',\r\n 'z',\r\n 'geometry',\r\n 'cluster',\r\n 'cluster_id',\r\n 'point_count_abbreviated',\r\n 'datasetName',\r\n 'datasetColor',\r\n ]\r\n return !excludingKeys.includes(lowerKey)\r\n })\r\n .sort(([keyA], [keyB]) => {\r\n const aHasName = keyA.toLowerCase().includes('name')\r\n const bHasName = keyB.toLowerCase().includes('name')\r\n if (aHasName && !bHasName) return -1\r\n if (!aHasName && bHasName) return 1\r\n return 0\r\n })\r\n\r\n // Function to format property names (convert snake_case to readable format)\r\n const formatPropertyName = (key: string): string => {\r\n return key\r\n .replaceAll('_', ' ')\r\n .replaceAll(/\\b\\w/g, l => l.toUpperCase())\r\n }\r\n\r\n // Function to format property values\r\n const formatPropertyValue = (value: any, key?: string): string => {\r\n if (typeof value === 'boolean') {\r\n return value ? 'Yes' : 'No'\r\n }\r\n if (typeof value === 'number') {\r\n // Don't add commas for year-like fields\r\n if (key && key.toLowerCase().includes('year')) {\r\n return value.toString()\r\n }\r\n return value.toLocaleString()\r\n }\r\n if (typeof value === 'string') {\r\n // Handle URLs\r\n if (value.startsWith('http://') || value.startsWith('https://')) {\r\n return value\r\n }\r\n return value\r\n }\r\n return String(value)\r\n }\r\n\r\n // Function to check if value is a URL\r\n const isUrl = (value: string): boolean => {\r\n return value.startsWith('http://') || value.startsWith('https://')\r\n }\r\n\r\n const datasetName = (featureProps.datasetName ? featureProps.datasetName.replaceAll('_', ' ') : t('unknownDataset'))\r\n const dataset = addedDatasets.find(d => d.name === featureProps.datasetName)\r\n const datasetColor = dataset ? dataset.layerColor.color : stringToColour(datasetName)\r\n\r\n return (\r\n <PopoverContent className=\"w-80 -m-1\" side=\"top\">\r\n <div className=\"grid gap-4\">\r\n <Button\r\n onClick={onCloseAction}\r\n variant=\"ghost\"\r\n className=\"absolute top-1 right-2 p-1 text-muted-foreground hover:text-foreground\"\r\n aria-label=\"Close\"\r\n >\r\n <LR.X className=\"w-4 h-4\" />\r\n </Button>\r\n <div className=\"space-y-2\">\r\n <div className=\"flex items-center gap-2\">\r\n <LR.Database className=\"w-4 h-4\" />\r\n <h4 className=\"font-medium leading-none\">{t('propertiesHeader')}</h4>\r\n </div>\r\n {/* Circle with the dataset color */}\r\n <div className=\"flex items-center gap-2 pl-[2px]\">\r\n <ColorCircle color={datasetColor} size={14} />\r\n <p className=\"text-xs text-muted-foreground\">\r\n {datasetName}\r\n </p>\r\n </div>\r\n </div>\r\n\r\n {validProperties.length > 0\r\n ? (\r\n <div className=\"max-h-64 overflow-auto\">\r\n <Table>\r\n <TableHeader>\r\n <TableRow>\r\n <TableHead className=\"w-1/3 text-xs\">{t('propertyTableHead')}</TableHead>\r\n <TableHead className=\"text-xs\">{t('valueTableHead')}</TableHead>\r\n </TableRow>\r\n </TableHeader>\r\n <TableBody>\r\n {validProperties.map(([key, value]) => (\r\n <TableRow key={key}>\r\n <TableCell className=\"font-medium text-xs py-2\">\r\n {formatPropertyName(key)}\r\n </TableCell>\r\n <TableCell className=\"text-xs py-2\">\r\n {isUrl(String(value))\r\n ? (\r\n <a\r\n href={String(value)}\r\n target=\"_blank\"\r\n rel=\"noopener noreferrer\"\r\n className=\"text-blue-600 hover:text-blue-800 underline break-all\"\r\n >\r\n {formatPropertyValue(value, key)}\r\n </a>\r\n )\r\n : (\r\n <span className=\"break-words\">\r\n {formatPropertyValue(value, key)}\r\n </span>\r\n )}\r\n </TableCell>\r\n </TableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n </div>\r\n )\r\n : (\r\n <div className=\"text-center py-4\">\r\n <LR.FileX className=\"w-8 h-8 text-muted-foreground mx-auto mb-2\" />\r\n <p className=\"text-sm text-muted-foreground\">\r\n {t('noPropertyAvail')}\r\n </p>\r\n </div>\r\n )}\r\n\r\n {validProperties.length > 10 && (\r\n <div className=\"text-xs text-muted-foreground text-center\">\r\n {t('showing')}\r\n {' '}\r\n {validProperties.length}\r\n {' '}\r\n {t('properties')}\r\n </div>\r\n )}\r\n </div>\r\n </PopoverContent>\r\n )\r\n}\r\n"],"mappings":";AA+IU,cAGA,YAHA;AAzIV,YAAY,QAAQ;AACpB,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAGvB,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,OAAO,iBAAiB;AACxB,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,sBAAsB;AAUhB,SAAR,uBAAwC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAE9B,QAAM,IAAI,gBAAgB,wBAAwB;AAElD,QAAM,EAAC,OAAO,cAAa,IAAI,MAAM,WAAW,eAAe;AAC/D,QAAM,EAAC,cAAa,IAAI,cAAc;AAEtC,QAAM,gBAAe,mCAAS,eAAc,CAAC;AAE7C,QAAM,kBAAkB,OAAO,QAAQ,YAAY,EAChD,OAAO,CAAC,CAAC,KAAK,KAAK,MAAM;AAExB,UAAM,WAAW,OAAO,KAAK,EAAE,YAAY;AAC3C,QACE,UAAU,QACP,UAAU,UACV,UAAU,MACV,aAAa,UACb,aAAa,eACb,aAAa,QAChB;AACA,aAAO;AAAA,IACT;AAGA,UAAM,WAAW,IAAI,YAAY;AACjC,UAAM,gBAAgB;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AA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,QACjC,IAGA,oBAAC,UAAK,WAAU,eACb,8BAAoB,OAAO,GAAG,GACjC,GAER;AAAA,WArBa,GAsBf,CACD,GACH;AAAA,OACF,GACF,IAGA,qBAAC,SAAI,WAAU,oBACb;AAAA,0BAAC,GAAG,OAAH,EAAS,WAAU,8CAA6C;AAAA,MACjE,oBAAC,OAAE,WAAU,iCACV,YAAE,iBAAiB,GACtB;AAAA,OACF;AAAA,IAGL,gBAAgB,SAAS,MACxB,qBAAC,SAAI,WAAU,6CACZ;AAAA,QAAE,SAAS;AAAA,MACX;AAAA,MACA,gBAAgB;AAAA,MAChB;AAAA,MACA,EAAE,YAAY;AAAA,OACjB;AAAA,KAEJ,GACF;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/CommentLayer/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA8D9B,eAAO,MAAM,YAAY,yBAmRxB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/CommentLayer/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAqE9B,eAAO,MAAM,YAAY,yBA6YxB,CAAA"}
@@ -24,39 +24,45 @@ import { useTranslations } from "next-intl";
24
24
  import * as React from "react";
25
25
  import { Source, Layer, Popup, Marker } from "react-map-gl/maplibre";
26
26
  import { toast } from "sonner";
27
- import { useComment, useComments } from "../../../../../../../hooks/comments/comments";
27
+ import { useComments, useDeleteComments } from "../../../../../../../hooks/comments/comments";
28
28
  import { useUser, useUsers } from "../../../../../../../hooks/users/users";
29
29
  import { MapContext, MenusContext } from "../../../../../../../store";
30
30
  import { ViewerNames } from "../../../../../../../types/dbTypes";
31
+ import { commentRingShadow } from "../../../../../../../utils/markerUtils";
31
32
  import { Avatar } from "../../../../../../ui/Avatar";
32
33
  import Comment from "../../../../../../ui/Comments/Comment";
33
34
  import { UserAvatar } from "../../../../../../ui/UserAvatar";
34
35
  import { extractCoordinatesFromFeature } from "../../../../utils/extractCoordinates";
35
36
  import { MapLayerClickPriority } from "../../../../utils/MapEventManager/MapClickManager";
36
37
  import { createClusterLayer, createClusterCountLayer, createUnclusteredPointLayer } from "../mapLayersUtils";
37
- const CommentAvatarMarker = ({ feature, isHighlighted, onMouseEnter, onMouseLeave }) => {
38
+ const CommentAvatarMarker = ({ feature, isHighlighted, isFocused, onMouseEnter, onMouseLeave, onClick, onDoubleClick, center, offset }) => {
38
39
  var _a, _b, _c, _d, _e, _f, _g;
39
40
  const authorId = (_a = feature.properties) == null ? void 0 : _a.authorId;
40
41
  const { user: author } = useUser(authorId != null ? String(authorId) : "");
41
42
  const userName = (_b = feature.properties) == null ? void 0 : _b.authorName;
42
43
  const userImageFileId = (_c = feature.properties) == null ? void 0 : _c.imageFileId;
43
44
  const resolvedImageFileId = (_e = (_d = author == null ? void 0 : author.imageFileId) != null ? _d : userImageFileId) != null ? _e : null;
44
- const coords = extractCoordinatesFromFeature(feature);
45
+ const coords = center ? { lng: center[0], lat: center[1] } : extractCoordinatesFromFeature(feature);
45
46
  if (!coords) return null;
46
- return /* @__PURE__ */ jsx(Marker, { longitude: coords.lng, latitude: coords.lat, anchor: "center", children: /* @__PURE__ */ jsx(
47
+ const scale = isFocused ? 1.25 : isHighlighted ? 1.2 : 1;
48
+ return /* @__PURE__ */ jsx(Marker, { longitude: coords.lng, latitude: coords.lat, anchor: "center", offset, children: /* @__PURE__ */ jsx(
47
49
  "div",
48
50
  {
51
+ title: onDoubleClick ? "Double click to zoom" : void 0,
49
52
  style: {
50
53
  width: "36px",
51
54
  height: "36px",
52
55
  borderRadius: "50%",
53
- boxShadow: isHighlighted ? "0 0 0 3px #73cee2, 0 0 8px rgba(115, 206, 226, 0.5)" : "0 0 0 2px white ",
56
+ boxShadow: commentRingShadow({ highlight: isHighlighted, focused: isFocused }),
54
57
  transition: "all 0.2s ease-in-out",
55
- transform: isHighlighted ? "scale(1.2)" : "scale(1)",
56
- overflow: "hidden"
58
+ transform: `scale(${scale})`,
59
+ overflow: "hidden",
60
+ cursor: onClick || onDoubleClick ? "pointer" : void 0
57
61
  },
58
62
  onMouseEnter,
59
63
  onMouseLeave,
64
+ onClick,
65
+ onDoubleClick,
60
66
  children: /* @__PURE__ */ jsx(Avatar, { className: "h-full w-full", children: /* @__PURE__ */ jsx(
61
67
  UserAvatar,
62
68
  {
@@ -69,7 +75,7 @@ const CommentAvatarMarker = ({ feature, isHighlighted, onMouseEnter, onMouseLeav
69
75
  ) }, String((_g = (_f = feature.properties) == null ? void 0 : _f.id) != null ? _g : `${coords.lng},${coords.lat}`));
70
76
  };
71
77
  const CommentLayer = () => {
72
- var _a, _b;
78
+ var _a;
73
79
  const [hoveredCommentId, setHoveredCommentId] = React.useState(null);
74
80
  const clusterLayer = createClusterLayer("comments");
75
81
  const clusterCountLayer = createClusterCountLayer("comments");
@@ -82,22 +88,87 @@ const CommentLayer = () => {
82
88
  const user = (_a = useSession().data) == null ? void 0 : _a.user;
83
89
  const [popupInfo, setPopUpInfo] = React.useState(null);
84
90
  const { user: popupAuthor } = useUser((popupInfo == null ? void 0 : popupInfo.authorId) != null ? String(popupInfo.authorId) : "");
85
- const { deleteComment } = useComment((_b = popupInfo == null ? void 0 : popupInfo.id) != null ? _b : null);
86
- const { state: menusState } = React.useContext(MenusContext);
87
- const { commentsVisibleInViewer, currentCommentId } = menusState.menus;
91
+ const { deleteComments } = useDeleteComments();
92
+ const { state: menusState, dispatch: menusDispatch, setIsSidebarOpen } = React.useContext(MenusContext);
93
+ const { commentsVisibleInViewer, currentCommentId, focusedCommentId, focusRequestId } = menusState.menus;
94
+ const focusComment = React.useCallback((commentId) => {
95
+ if (commentId == null) return;
96
+ menusDispatch({ type: "SET_CURRENT_COMMENT_ID", payload: { commentId } });
97
+ menusDispatch({ type: "SET_FOCUSED_COMMENT_ID", payload: { commentId } });
98
+ }, [menusDispatch]);
99
+ const requestSidebarAction = React.useCallback((commentId, action) => {
100
+ if (commentId == null) return;
101
+ setIsSidebarOpen(true);
102
+ menusDispatch({ type: "SET_SIDEBAR_SELECTED_TAB", payload: { selectedTab: "communication" } });
103
+ menusDispatch({ type: "SET_CURRENT_COMMENT_ID", payload: { commentId } });
104
+ menusDispatch({ type: "REQUEST_COMMENT_ACTION", payload: { commentId, action } });
105
+ }, [menusDispatch, setIsSidebarOpen]);
106
+ const [spider, setSpider] = React.useState(null);
107
+ const spiderCloseTimer = React.useRef(null);
108
+ const cancelSpiderClose = React.useCallback(() => {
109
+ if (spiderCloseTimer.current) {
110
+ clearTimeout(spiderCloseTimer.current);
111
+ spiderCloseTimer.current = null;
112
+ }
113
+ }, []);
114
+ const scheduleSpiderClose = React.useCallback(() => {
115
+ cancelSpiderClose();
116
+ spiderCloseTimer.current = setTimeout(() => setSpider(null), 150);
117
+ }, [cancelSpiderClose]);
118
+ const openPopupFromFeature = React.useCallback((feature) => {
119
+ var _a2, _b;
120
+ if (!feature || feature.properties.point_count) return;
121
+ if (feature.geometry.type !== "Point") return;
122
+ const [longitude, latitude] = feature.geometry.coordinates;
123
+ const p = feature.properties;
124
+ setPopUpInfo({
125
+ id: Number(p.id),
126
+ authorId: Number(p.authorId),
127
+ organizationId: (_a2 = feature.properties) == null ? void 0 : _a2.organizationId,
128
+ visible: (_b = feature.properties) == null ? void 0 : _b.visible,
129
+ longitude,
130
+ latitude,
131
+ text: p.text,
132
+ createdAt: p.createdAt,
133
+ authorName: p.authorName,
134
+ imageFileId: p.imageFileId,
135
+ viewer: ViewerNames.map
136
+ });
137
+ }, []);
88
138
  const eligibleComments = comments.filter((comment) => comment.viewer === ViewerNames.map).map((comment) => {
89
- var _a2, _b2;
139
+ var _a2, _b;
90
140
  const user2 = users.find((u) => u.id === comment.authorId);
91
141
  return __spreadProps(__spreadValues({}, comment), {
92
142
  authorName: (_a2 = user2 == null ? void 0 : user2.name) != null ? _a2 : "Unknown User",
93
- imageFileId: (_b2 = user2 == null ? void 0 : user2.imageFileId) != null ? _b2 : null
143
+ imageFileId: (_b = user2 == null ? void 0 : user2.imageFileId) != null ? _b : null
94
144
  });
95
145
  });
146
+ const eligibleCommentsRef = React.useRef(eligibleComments);
147
+ eligibleCommentsRef.current = eligibleComments;
96
148
  React.useEffect(() => {
97
149
  if (popupInfo && !comments.find((c) => c.id === popupInfo.id)) {
98
150
  setPopUpInfo(null);
99
151
  }
100
152
  }, [comments, popupInfo]);
153
+ React.useEffect(() => {
154
+ if (focusedCommentId == null || !map) return;
155
+ const target = eligibleCommentsRef.current.find((c) => c.id === focusedCommentId);
156
+ if (!target || target.longitude == null || target.latitude == null) return;
157
+ map.flyTo({ center: [target.longitude, target.latitude], zoom: Math.max(map.getZoom(), 17), duration: 800 });
158
+ setPopUpInfo({
159
+ id: target.id,
160
+ authorId: target.authorId,
161
+ organizationId: target.organizationId,
162
+ visible: target.visible,
163
+ longitude: target.longitude,
164
+ latitude: target.latitude,
165
+ text: target.text,
166
+ createdAt: target.createdAt,
167
+ authorName: target.authorName,
168
+ imageFileId: target.imageFileId,
169
+ viewer: ViewerNames.map
170
+ });
171
+ }, [focusRequestId, map]);
101
172
  const geojsonCommentData = React.useMemo(() => {
102
173
  const convertDataToGeojson = (commentData) => {
103
174
  const commentFeatures = commentData.map((comment) => {
@@ -134,26 +205,7 @@ const CommentLayer = () => {
134
205
  React.useEffect(() => {
135
206
  if (!map) return;
136
207
  const showCommentPopUp = (e, features) => {
137
- var _a2, _b2;
138
- const feature = features == null ? void 0 : features[0];
139
- if (!feature || feature.properties.point_count) return;
140
- if (feature.geometry.type != "Point") return;
141
- const [longitude, latitude] = feature.geometry.coordinates;
142
- const featureProperties = feature.properties;
143
- const { id, authorId, text, createdAt, authorName, imageFileId } = featureProperties;
144
- setPopUpInfo({
145
- id: Number(id),
146
- authorId: Number(authorId),
147
- organizationId: (_a2 = feature.properties) == null ? void 0 : _a2.organizationId,
148
- visible: (_b2 = feature.properties) == null ? void 0 : _b2.visible,
149
- longitude,
150
- latitude,
151
- text,
152
- createdAt,
153
- authorName,
154
- imageFileId,
155
- viewer: ViewerNames.map
156
- });
208
+ openPopupFromFeature(features == null ? void 0 : features[0]);
157
209
  };
158
210
  const mouseEnterChangeCursor = () => {
159
211
  map.getCanvas().style.cursor = "pointer";
@@ -169,12 +221,25 @@ const CommentLayer = () => {
169
221
  map.off("mouseenter", "comments-unclustered-points", mouseEnterChangeCursor);
170
222
  map.off("mouseleave", "comments-unclustered-points", mouseLeaveChangeCursor);
171
223
  };
172
- }, [map, mapClickManager]);
224
+ }, [map, mapClickManager, openPopupFromFeature]);
173
225
  const handleRemoveComment = () => {
226
+ if ((popupInfo == null ? void 0 : popupInfo.id) == null) return;
174
227
  toast.success(t("commentDeleted"));
175
- deleteComment();
228
+ const id = popupInfo.id;
229
+ const replyIds = comments.filter((c) => c.replyToId === id).map((c) => c.id);
230
+ void deleteComments({ ids: [id, ...replyIds] });
176
231
  setPopUpInfo(null);
177
232
  };
233
+ React.useEffect(() => {
234
+ if (!map) return;
235
+ const close = () => setSpider(null);
236
+ map.on("movestart", close);
237
+ map.on("zoomstart", close);
238
+ return () => {
239
+ map.off("movestart", close);
240
+ map.off("zoomstart", close);
241
+ };
242
+ }, [map]);
178
243
  React.useEffect(() => {
179
244
  if (!map) return;
180
245
  const zoomInToDecluster = (e) => {
@@ -185,34 +250,45 @@ const CommentLayer = () => {
185
250
  if (!("coordinates" in feature.geometry)) return;
186
251
  const [lng, lat] = feature.geometry.coordinates;
187
252
  const source = map.getSource("comments");
188
- console.log(source);
189
- console.log(clusterId);
190
253
  source.getClusterExpansionZoom(clusterId).then(
191
254
  (zoom) => {
192
- console.log("easing to");
193
255
  map.easeTo({ center: [lng, lat], zoom });
194
256
  }
195
257
  ).catch((error) => {
196
258
  console.error(error);
197
259
  });
198
260
  };
199
- const mouseEnterChangeCursor = () => {
261
+ const expandClusterOnHover = (e) => {
262
+ var _a2;
200
263
  map.getCanvas().style.cursor = "pointer";
264
+ const feature = (_a2 = e.features) == null ? void 0 : _a2[0];
265
+ if (!feature || !feature.properties.cluster_id) return;
266
+ if (!("coordinates" in feature.geometry)) return;
267
+ const center = feature.geometry.coordinates;
268
+ const clusterId = feature.properties.cluster_id;
269
+ const source = map.getSource("comments");
270
+ source.getClusterLeaves(clusterId, Infinity, 0).then((leaves) => {
271
+ cancelSpiderClose();
272
+ setSpider({ center, features: leaves });
273
+ }).catch((error) => {
274
+ console.error(error);
275
+ });
201
276
  };
202
- const mouseLeaveChangeCursor = () => {
277
+ const mouseLeaveCluster = () => {
203
278
  map.getCanvas().style.cursor = "";
279
+ scheduleSpiderClose();
204
280
  };
205
281
  map.on("click", "comments-clusters", zoomInToDecluster);
206
- map.on("mouseenter", "comments-clusters", mouseEnterChangeCursor);
207
- map.on("mouseleave", "comments-clusters", mouseLeaveChangeCursor);
282
+ map.on("mouseenter", "comments-clusters", expandClusterOnHover);
283
+ map.on("mouseleave", "comments-clusters", mouseLeaveCluster);
208
284
  return () => {
209
285
  map.off("click", "comments-clusters", zoomInToDecluster);
210
- map.off("mouseenter", "comments-clusters", mouseEnterChangeCursor);
211
- map.off("mouseleave", "comments-clusters", mouseLeaveChangeCursor);
286
+ map.off("mouseenter", "comments-clusters", expandClusterOnHover);
287
+ map.off("mouseleave", "comments-clusters", mouseLeaveCluster);
212
288
  };
213
- }, [map]);
289
+ }, [map, cancelSpiderClose, scheduleSpiderClose]);
214
290
  const renderPopup = () => {
215
- var _a2, _b2, _c, _d;
291
+ var _a2, _b, _c, _d;
216
292
  if (!popupInfo) return null;
217
293
  return /* @__PURE__ */ jsxs(
218
294
  Popup,
@@ -230,11 +306,16 @@ const CommentLayer = () => {
230
306
  Comment,
231
307
  {
232
308
  userName: popupInfo.authorName || "",
233
- userImage: (_b2 = (_a2 = popupAuthor == null ? void 0 : popupAuthor.imageFileId) != null ? _a2 : popupInfo.imageFileId) != null ? _b2 : null,
309
+ userImage: (_b = (_a2 = popupAuthor == null ? void 0 : popupAuthor.imageFileId) != null ? _a2 : popupInfo.imageFileId) != null ? _b : null,
234
310
  userImageFileId: (_d = (_c = popupAuthor == null ? void 0 : popupAuthor.imageFileId) != null ? _c : popupInfo.imageFileId) != null ? _d : null,
235
311
  text: popupInfo.text,
236
312
  createdAt: popupInfo.createdAt,
237
- onRemove: user.id === String(popupInfo.authorId) ? handleRemoveComment : null,
313
+ showActions: true,
314
+ canEdit: user.id === String(popupInfo.authorId),
315
+ canDelete: user.id === String(popupInfo.authorId),
316
+ onEdit: user.id === String(popupInfo.authorId) ? () => requestSidebarAction(popupInfo.id, "edit") : void 0,
317
+ onReply: () => requestSidebarAction(popupInfo.id, "reply"),
318
+ onRemove: user.id === String(popupInfo.authorId) ? handleRemoveComment : void 0,
238
319
  onClose: () => setPopUpInfo(null)
239
320
  }
240
321
  ),
@@ -259,8 +340,8 @@ const CommentLayer = () => {
259
340
  const allFeatures = map.querySourceFeatures("comments");
260
341
  const unclusteredOnly = allFeatures.filter(
261
342
  (f) => {
262
- var _a2, _b2;
263
- return !((_a2 = f.properties) == null ? void 0 : _a2.cluster) && !((_b2 = f.properties) == null ? void 0 : _b2.point_count);
343
+ var _a2, _b;
344
+ return !((_a2 = f.properties) == null ? void 0 : _a2.cluster) && !((_b = f.properties) == null ? void 0 : _b.point_count);
264
345
  }
265
346
  );
266
347
  const uniqueFeatures = /* @__PURE__ */ new Map();
@@ -298,20 +379,60 @@ const CommentLayer = () => {
298
379
  var _a2;
299
380
  return ((_a2 = feature.properties) == null ? void 0 : _a2.id) !== (popupInfo == null ? void 0 : popupInfo.id);
300
381
  }).map((feature) => {
301
- var _a2, _b2, _c;
382
+ var _a2, _b, _c, _d;
302
383
  return /* @__PURE__ */ jsx(
303
384
  CommentAvatarMarker,
304
385
  {
305
386
  feature,
306
- isHighlighted: currentCommentId === ((_b2 = feature.properties) == null ? void 0 : _b2.id) || hoveredCommentId === ((_c = feature.properties) == null ? void 0 : _c.id),
387
+ isHighlighted: currentCommentId === ((_b = feature.properties) == null ? void 0 : _b.id) || hoveredCommentId === ((_c = feature.properties) == null ? void 0 : _c.id),
388
+ isFocused: focusedCommentId === ((_d = feature.properties) == null ? void 0 : _d.id),
307
389
  onMouseEnter: () => {
308
390
  var _a3;
309
391
  return setHoveredCommentId((_a3 = feature.properties) == null ? void 0 : _a3.id);
310
392
  },
311
- onMouseLeave: () => setHoveredCommentId(null)
393
+ onMouseLeave: () => setHoveredCommentId(null),
394
+ onDoubleClick: () => {
395
+ var _a3;
396
+ return focusComment((_a3 = feature.properties) == null ? void 0 : _a3.id);
397
+ }
312
398
  },
313
399
  String((_a2 = feature.properties) == null ? void 0 : _a2.id)
314
400
  );
401
+ }),
402
+ spider && spider.features.map((feature, i) => {
403
+ var _a2;
404
+ const n = spider.features.length;
405
+ const angle = 2 * Math.PI * i / n - Math.PI / 2;
406
+ const radius = Math.min(60, 24 + n * 4);
407
+ const offset = [Math.cos(angle) * radius, Math.sin(angle) * radius];
408
+ const id = (_a2 = feature.properties) == null ? void 0 : _a2.id;
409
+ return /* @__PURE__ */ jsx(
410
+ CommentAvatarMarker,
411
+ {
412
+ feature,
413
+ center: spider.center,
414
+ offset,
415
+ isHighlighted: currentCommentId === id || hoveredCommentId === id,
416
+ isFocused: focusedCommentId === id,
417
+ onMouseEnter: () => {
418
+ cancelSpiderClose();
419
+ setHoveredCommentId(id);
420
+ },
421
+ onMouseLeave: () => {
422
+ scheduleSpiderClose();
423
+ setHoveredCommentId(null);
424
+ },
425
+ onClick: () => {
426
+ openPopupFromFeature(feature);
427
+ setSpider(null);
428
+ },
429
+ onDoubleClick: () => {
430
+ focusComment(id);
431
+ setSpider(null);
432
+ }
433
+ },
434
+ `spider-${String(id)}`
435
+ );
315
436
  })
316
437
  ]
317
438
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/CommentLayer/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 { 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 { useComment, useComments } from '../../../../../../../hooks/comments/comments'\r\nimport { useUser, useUsers } from '../../../../../../../hooks/users/users'\r\nimport { MapContext, MenusContext } from '../../../../../../../store'\r\nimport { ViewerNames, type Comment as IComment } from '../../../../../../../types/dbTypes'\r\nimport { Avatar } from '../../../../../../ui/Avatar'\r\nimport Comment from '../../../../../../ui/Comments/Comment'\r\nimport { UserAvatar } from '../../../../../../ui/UserAvatar'\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 { ClickCallback } from '../../../../utils/MapEventManager/MapClickManager';\r\nimport type { MapGeoJSONFeature, MapLayerMouseEvent } from 'maplibre-gl'\r\n\r\ntype MapComment = IComment & {\r\n authorName?: string\r\n imageFileId?: number | null\r\n}\r\n\r\nconst CommentAvatarMarker = ({ feature, isHighlighted, onMouseEnter, onMouseLeave }: { feature: MapGeoJSONFeature; isHighlighted?: boolean; onMouseEnter?: () => void; onMouseLeave?: () => void }) => {\r\n const authorId = feature.properties?.authorId\r\n const { user: author } = useUser(authorId != null ? String(authorId) : '')\r\n const userName = feature.properties?.authorName\r\n const userImageFileId = feature.properties?.imageFileId\r\n const resolvedImageFileId = author?.imageFileId ?? userImageFileId ?? null\r\n\r\n const coords = extractCoordinatesFromFeature(feature)\r\n if (!coords) return null\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 boxShadow: isHighlighted\r\n ? '0 0 0 3px #73cee2, 0 0 8px rgba(115, 206, 226, 0.5)'\r\n : '0 0 0 2px white ',\r\n transition: 'all 0.2s ease-in-out',\r\n transform: isHighlighted ? 'scale(1.2)' : 'scale(1)',\r\n overflow: 'hidden',\r\n }}\r\n onMouseEnter={onMouseEnter}\r\n onMouseLeave={onMouseLeave}\r\n >\r\n <Avatar className=\"h-full w-full\">\r\n <UserAvatar\r\n imageFileId={resolvedImageFileId}\r\n name={userName}\r\n className=\"h-full w-full rounded-full object-cover\"\r\n />\r\n </Avatar>\r\n </div>\r\n </Marker>\r\n )\r\n}\r\n\r\nexport const CommentLayer = () => {\r\n const [hoveredCommentId, setHoveredCommentId] = React.useState<number | null>(null)\r\n const clusterLayer = createClusterLayer('comments')\r\n const clusterCountLayer = createClusterCountLayer('comments')\r\n const unclusteredPointLayer = createUnclusteredPointLayer('comments')\r\n\r\n // global map state\r\n\r\n const t = useTranslations('CommentLayers')\r\n\r\n const { state: mapState } = React.useContext(MapContext)\r\n const { map, mapClickManager } = mapState.map\r\n const { comments } = useComments()\r\n const { users } = useUsers()\r\n const user = useSession().data?.user\r\n\r\n const [popupInfo, setPopUpInfo] = React.useState<(Partial<IComment> & { authorName?: string; imageFileId?: number | null }) | null>(null)\r\n const { user: popupAuthor } = useUser(popupInfo?.authorId != null ? String(popupInfo.authorId) : '')\r\n const { deleteComment } = useComment(popupInfo?.id ?? null)\r\n const { state: menusState } = React.useContext(MenusContext)\r\n const { commentsVisibleInViewer, currentCommentId } = menusState.menus\r\n\r\n const eligibleComments = comments\r\n .filter((comment) => comment.viewer === ViewerNames.map)\r\n .map((comment) => {\r\n const user = users.find(u => u.id === comment.authorId)\r\n return {\r\n ...comment,\r\n authorName: user?.name ?? 'Unknown User',\r\n imageFileId: user?.imageFileId ?? null,\r\n }\r\n })\r\n\r\n // Close popup if the comment was deleted\r\n React.useEffect(() => {\r\n if (popupInfo && !comments.find((c) => c.id === popupInfo.id)) {\r\n setPopUpInfo(null)\r\n }\r\n }, [comments, popupInfo])\r\n\r\n const geojsonCommentData = React.useMemo(() => {\r\n const convertDataToGeojson = (commentData: MapComment[]): GeoJSON.FeatureCollection<GeoJSON.Point, { [key: string]: any }> => {\r\n const commentFeatures: GeoJSON.Feature<GeoJSON.Point, { [key: string]: any }>[] = commentData\r\n .map((comment: MapComment) => {\r\n const { longitude, latitude, id, text, createdAt, authorId, organizationId, visible, authorName, imageFileId } = comment\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 imageFileId,\r\n text,\r\n createdAt,\r\n viewer: ViewerNames.map,\r\n },\r\n }\r\n })\r\n\r\n const commentFC: GeoJSON.FeatureCollection<GeoJSON.Point, { [key: string]: any }> = {\r\n type: 'FeatureCollection',\r\n features: commentFeatures,\r\n }\r\n return commentFC\r\n }\r\n return convertDataToGeojson(eligibleComments)\r\n }, [eligibleComments])\r\n\r\n // event listeners for comment unclustered points\r\n React.useEffect(() => {\r\n if (!map) return\r\n const showCommentPopUp: 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 featureProperties = feature.properties as MapComment\r\n const { id, authorId, text, createdAt, authorName, imageFileId } = featureProperties\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 text,\r\n createdAt,\r\n authorName,\r\n imageFileId,\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 comment, hover to change cursor\r\n mapClickManager.register('comments-unclustered-points', MapLayerClickPriority.CommentLayersClickPriority, showCommentPopUp)\r\n\r\n map.on('mouseenter', 'comments-unclustered-points', mouseEnterChangeCursor)\r\n map.on('mouseleave', 'comments-unclustered-points', mouseLeaveChangeCursor)\r\n return () => {\r\n mapClickManager.unregister('comments-unclustered-points')\r\n map.off('mouseenter', 'comments-unclustered-points', mouseEnterChangeCursor)\r\n map.off('mouseleave', 'comments-unclustered-points', mouseLeaveChangeCursor)\r\n }\r\n }, [map, mapClickManager])\r\n\r\n const handleRemoveComment = () => {\r\n toast.success(t('commentDeleted'))\r\n deleteComment()\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('comments') as any\r\n console.log(source)\r\n console.log(clusterId)\r\n source.getClusterExpansionZoom(clusterId).then(\r\n (zoom: number) => {\r\n console.log('easing to')\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', 'comments-clusters', zoomInToDecluster)\r\n map.on('mouseenter', 'comments-clusters', mouseEnterChangeCursor)\r\n map.on('mouseleave', 'comments-clusters', mouseLeaveChangeCursor)\r\n return () => {\r\n map.off('click', 'comments-clusters', zoomInToDecluster)\r\n map.off('mouseenter', 'comments-clusters', mouseEnterChangeCursor)\r\n map.off('mouseleave', 'comments-clusters', mouseLeaveChangeCursor)\r\n }\r\n }, [map])\r\n\r\n const renderPopup = () => {\r\n if (!popupInfo) return null\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 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 <Comment\r\n userName={popupInfo.authorName || ''}\r\n userImage={popupAuthor?.imageFileId ?? popupInfo.imageFileId ?? null}\r\n userImageFileId={popupAuthor?.imageFileId ?? popupInfo.imageFileId ?? null}\r\n text={popupInfo.text}\r\n createdAt={popupInfo.createdAt}\r\n onRemove={user.id === String(popupInfo.authorId) ? handleRemoveComment : null}\r\n onClose={() => setPopUpInfo(null)}\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 comments to display avatars\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('comments')\r\n const unclusteredOnly = allFeatures.filter(\r\n (f) => !f.properties?.cluster && !f.properties?.point_count\r\n )\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 === 'comments') 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 {commentsVisibleInViewer.includes(ViewerNames.map) &&\r\n <Source\r\n id=\"comments\"\r\n type=\"geojson\"\r\n data={geojsonCommentData}\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 <CommentAvatarMarker\r\n key={String(feature.properties?.id)}\r\n feature={feature}\r\n isHighlighted={currentCommentId === feature.properties?.id || hoveredCommentId === feature.properties?.id}\r\n onMouseEnter={() => setHoveredCommentId(feature.properties?.id)}\r\n onMouseLeave={() => setHoveredCommentId(null)}\r\n />\r\n ))}\r\n </Source>}\r\n </>\r\n )\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0DU,SAiQN,UAjQM,KAyLJ,YAzLI;AArDV,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,YAAY,WAAW;AACvB,SAAS,QAAQ,OAAO,OAAO,cAAc;AAC7C,SAAS,aAAa;AAEtB,SAAS,YAAY,mBAAmB;AACxC,SAAS,SAAS,gBAAgB;AAClC,SAAS,YAAY,oBAAoB;AACzC,SAAS,mBAA6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eAAe;AAAA,MAEf;AAAA,4BAAC,0BAAU,aAAc;AAAA,QACzB,oBAAC,0BAAU,kBAAmB;AAAA,QAC9B,oBAAC,0BAAU,sBAAuB;AAAA,QAEjC,YAAY;AAAA,QACZ,oBACE,OAAO,CAAC,YAAS;AA3U1B,cAAAD;AA2U6B,mBAAAA,MAAA,QAAQ,eAAR,gBAAAA,IAAoB,SAAO,uCAAW;AAAA,SAAE,EAC5D,IAAI,CAAC,YAAS;AA5UvB,cAAAA,KAAAC,KAAA;AA6UU;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA,cACA,eAAe,uBAAqBA,MAAA,QAAQ,eAAR,gBAAAA,IAAoB,OAAM,uBAAqB,aAAQ,eAAR,mBAAoB;AAAA,cACvG,cAAc,MAAG;AAjV7B,oBAAAD;AAiVgC,4CAAoBA,MAAA,QAAQ,eAAR,gBAAAA,IAAoB,EAAE;AAAA;AAAA,cAC9D,cAAc,MAAM,oBAAoB,IAAI;AAAA;AAAA,YAJvC,QAAOA,MAAA,QAAQ,eAAR,gBAAAA,IAAoB,EAAE;AAAA,UAKpC;AAAA,SACD;AAAA;AAAA;AAAA,EACL,GACA;AAEJ;","names":["_a","_b","user"]}
1
+ {"version":3,"sources":["../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/CommentLayer/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 { 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 { useComments, useDeleteComments } from '../../../../../../../hooks/comments/comments'\r\nimport { useUser, useUsers } from '../../../../../../../hooks/users/users'\r\nimport { MapContext, MenusContext } from '../../../../../../../store'\r\nimport { ViewerNames, type Comment as IComment } from '../../../../../../../types/dbTypes'\r\nimport { commentRingShadow } from '../../../../../../../utils/markerUtils'\r\nimport { Avatar } from '../../../../../../ui/Avatar'\r\nimport Comment from '../../../../../../ui/Comments/Comment'\r\nimport { UserAvatar } from '../../../../../../ui/UserAvatar'\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 { ClickCallback } from '../../../../utils/MapEventManager/MapClickManager';\r\nimport type { MapGeoJSONFeature, MapLayerMouseEvent } from 'maplibre-gl'\r\n\r\ntype MapComment = IComment & {\r\n authorName?: string\r\n imageFileId?: number | null\r\n}\r\n\r\nconst CommentAvatarMarker = ({ feature, isHighlighted, isFocused, onMouseEnter, onMouseLeave, onClick, onDoubleClick, center, offset }: { feature: MapGeoJSONFeature; isHighlighted?: boolean; isFocused?: boolean; onMouseEnter?: () => void; onMouseLeave?: () => void; onClick?: () => void; onDoubleClick?: () => void; center?: [number, number]; offset?: [number, number] }) => {\r\n const authorId = feature.properties?.authorId\r\n const { user: author } = useUser(authorId != null ? String(authorId) : '')\r\n const userName = feature.properties?.authorName\r\n const userImageFileId = feature.properties?.imageFileId\r\n const resolvedImageFileId = author?.imageFileId ?? userImageFileId ?? null\r\n\r\n // When part of an expanded (spiderfied) cluster, position at the cluster\r\n // center and fan out with a pixel offset instead of the feature's own coords.\r\n const coords = center ? { lng: center[0], lat: center[1] } : extractCoordinatesFromFeature(feature)\r\n if (!coords) return null\r\n\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\" offset={offset}>\r\n <div\r\n title={onDoubleClick ? 'Double click to zoom' : undefined}\r\n style={{\r\n width: '36px',\r\n height: '36px',\r\n borderRadius: '50%',\r\n boxShadow: commentRingShadow({ highlight: isHighlighted, focused: isFocused }),\r\n transition: 'all 0.2s ease-in-out',\r\n transform: `scale(${scale})`,\r\n overflow: 'hidden',\r\n cursor: onClick || onDoubleClick ? 'pointer' : undefined,\r\n }}\r\n onMouseEnter={onMouseEnter}\r\n onMouseLeave={onMouseLeave}\r\n onClick={onClick}\r\n onDoubleClick={onDoubleClick}\r\n >\r\n <Avatar className=\"h-full w-full\">\r\n <UserAvatar\r\n imageFileId={resolvedImageFileId}\r\n name={userName}\r\n className=\"h-full w-full rounded-full object-cover\"\r\n />\r\n </Avatar>\r\n </div>\r\n </Marker>\r\n )\r\n}\r\n\r\nexport const CommentLayer = () => {\r\n const [hoveredCommentId, setHoveredCommentId] = React.useState<number | null>(null)\r\n const clusterLayer = createClusterLayer('comments')\r\n const clusterCountLayer = createClusterCountLayer('comments')\r\n const unclusteredPointLayer = createUnclusteredPointLayer('comments')\r\n\r\n // global map state\r\n\r\n const t = useTranslations('CommentLayers')\r\n\r\n const { state: mapState } = React.useContext(MapContext)\r\n const { map, mapClickManager } = mapState.map\r\n const { comments } = useComments()\r\n const { users } = useUsers()\r\n const user = useSession().data?.user\r\n\r\n const [popupInfo, setPopUpInfo] = React.useState<(Partial<IComment> & { authorName?: string; imageFileId?: number | null }) | null>(null)\r\n const { user: popupAuthor } = useUser(popupInfo?.authorId != null ? String(popupInfo.authorId) : '')\r\n const { deleteComments } = useDeleteComments()\r\n const { state: menusState, dispatch: menusDispatch, setIsSidebarOpen } = React.useContext(MenusContext)\r\n const { commentsVisibleInViewer, currentCommentId, focusedCommentId, focusRequestId } = menusState.menus\r\n\r\n const focusComment = React.useCallback((commentId?: number) => {\r\n if (commentId == null) return\r\n menusDispatch({ type: 'SET_CURRENT_COMMENT_ID', payload: { commentId } })\r\n menusDispatch({ type: 'SET_FOCUSED_COMMENT_ID', payload: { commentId } })\r\n }, [menusDispatch])\r\n\r\n // Edit/reply from the popup card open the comment's editor/reply box in the sidebar,\r\n // matching the BIM comment card behaviour.\r\n const requestSidebarAction = React.useCallback((commentId: number | undefined, action: 'edit' | 'reply') => {\r\n if (commentId == null) return\r\n setIsSidebarOpen(true)\r\n menusDispatch({ type: 'SET_SIDEBAR_SELECTED_TAB', payload: { selectedTab: 'communication' } })\r\n menusDispatch({ type: 'SET_CURRENT_COMMENT_ID', payload: { commentId } })\r\n menusDispatch({ type: 'REQUEST_COMMENT_ACTION', payload: { commentId, action } })\r\n }, [menusDispatch, setIsSidebarOpen])\r\n\r\n // Hover-to-expand (spiderfy) state for clusters\r\n const [spider, setSpider] = React.useState<{ center: [number, number]; features: MapGeoJSONFeature[] } | null>(null)\r\n const spiderCloseTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)\r\n\r\n const cancelSpiderClose = React.useCallback(() => {\r\n if (spiderCloseTimer.current) {\r\n clearTimeout(spiderCloseTimer.current)\r\n spiderCloseTimer.current = null\r\n }\r\n }, [])\r\n\r\n const scheduleSpiderClose = React.useCallback(() => {\r\n cancelSpiderClose()\r\n spiderCloseTimer.current = setTimeout(() => setSpider(null), 150)\r\n }, [cancelSpiderClose])\r\n\r\n const openPopupFromFeature = React.useCallback((feature?: MapGeoJSONFeature) => {\r\n if (!feature || feature.properties.point_count) return\r\n if (feature.geometry.type !== 'Point') return\r\n const [longitude, latitude] = feature.geometry.coordinates\r\n const p = feature.properties as MapComment\r\n setPopUpInfo({\r\n id: Number(p.id),\r\n authorId: Number(p.authorId),\r\n organizationId: feature.properties?.organizationId,\r\n visible: feature.properties?.visible,\r\n longitude,\r\n latitude,\r\n text: p.text,\r\n createdAt: p.createdAt,\r\n authorName: p.authorName,\r\n imageFileId: p.imageFileId,\r\n viewer: ViewerNames.map,\r\n })\r\n }, [])\r\n\r\n const eligibleComments = comments\r\n .filter((comment) => comment.viewer === ViewerNames.map)\r\n .map((comment) => {\r\n const user = users.find(u => u.id === comment.authorId)\r\n return {\r\n ...comment,\r\n authorName: user?.name ?? 'Unknown User',\r\n imageFileId: user?.imageFileId ?? null,\r\n }\r\n })\r\n\r\n // Keep the latest comments available to the focus effect without re-running it every render.\r\n const eligibleCommentsRef = React.useRef(eligibleComments)\r\n eligibleCommentsRef.current = eligibleComments\r\n\r\n // Close popup if the comment was deleted\r\n React.useEffect(() => {\r\n if (popupInfo && !comments.find((c) => c.id === popupInfo.id)) {\r\n setPopUpInfo(null)\r\n }\r\n }, [comments, popupInfo])\r\n\r\n // Fly to a comment when it is focused (double-clicked here or in the sidebar) and open its card.\r\n React.useEffect(() => {\r\n if (focusedCommentId == null || !map) return\r\n const target = eligibleCommentsRef.current.find((c) => c.id === focusedCommentId)\r\n if (!target || target.longitude == null || target.latitude == null) return\r\n map.flyTo({ center: [target.longitude, target.latitude], zoom: Math.max(map.getZoom(), 17), duration: 800 })\r\n setPopUpInfo({\r\n id: target.id,\r\n authorId: target.authorId,\r\n organizationId: target.organizationId,\r\n visible: target.visible,\r\n longitude: target.longitude,\r\n latitude: target.latitude,\r\n text: target.text,\r\n createdAt: target.createdAt,\r\n authorName: target.authorName,\r\n imageFileId: target.imageFileId,\r\n viewer: ViewerNames.map,\r\n })\r\n }, [focusRequestId, map])\r\n\r\n const geojsonCommentData = React.useMemo(() => {\r\n const convertDataToGeojson = (commentData: MapComment[]): GeoJSON.FeatureCollection<GeoJSON.Point, { [key: string]: any }> => {\r\n const commentFeatures: GeoJSON.Feature<GeoJSON.Point, { [key: string]: any }>[] = commentData\r\n .map((comment: MapComment) => {\r\n const { longitude, latitude, id, text, createdAt, authorId, organizationId, visible, authorName, imageFileId } = comment\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 imageFileId,\r\n text,\r\n createdAt,\r\n viewer: ViewerNames.map,\r\n },\r\n }\r\n })\r\n\r\n const commentFC: GeoJSON.FeatureCollection<GeoJSON.Point, { [key: string]: any }> = {\r\n type: 'FeatureCollection',\r\n features: commentFeatures,\r\n }\r\n return commentFC\r\n }\r\n return convertDataToGeojson(eligibleComments)\r\n }, [eligibleComments])\r\n\r\n // event listeners for comment unclustered points\r\n React.useEffect(() => {\r\n if (!map) return\r\n const showCommentPopUp: ClickCallback = (e: MapLayerMouseEvent, features: MapGeoJSONFeature[]) => {\r\n openPopupFromFeature(features?.[0])\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 comment, hover to change cursor\r\n mapClickManager.register('comments-unclustered-points', MapLayerClickPriority.CommentLayersClickPriority, showCommentPopUp)\r\n\r\n map.on('mouseenter', 'comments-unclustered-points', mouseEnterChangeCursor)\r\n map.on('mouseleave', 'comments-unclustered-points', mouseLeaveChangeCursor)\r\n return () => {\r\n mapClickManager.unregister('comments-unclustered-points')\r\n map.off('mouseenter', 'comments-unclustered-points', mouseEnterChangeCursor)\r\n map.off('mouseleave', 'comments-unclustered-points', mouseLeaveChangeCursor)\r\n }\r\n }, [map, mapClickManager, openPopupFromFeature])\r\n\r\n const handleRemoveComment = () => {\r\n if (popupInfo?.id == null) return\r\n toast.success(t('commentDeleted'))\r\n // Cascade: delete the comment together with its replies (the DB does not cascade).\r\n const id = popupInfo.id\r\n const replyIds = comments.filter((c) => c.replyToId === id).map((c) => c.id)\r\n void deleteComments({ ids: [id, ...replyIds] })\r\n setPopUpInfo(null)\r\n }\r\n\r\n // Close the spiderfied cluster when the map moves (positions would be stale)\r\n React.useEffect(() => {\r\n if (!map) return\r\n const close = () => setSpider(null)\r\n map.on('movestart', close)\r\n map.on('zoomstart', close)\r\n return () => {\r\n map.off('movestart', close)\r\n map.off('zoomstart', close)\r\n }\r\n }, [map])\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('comments') 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 // Hover a cluster to expand (spiderfy) its members\r\n const expandClusterOnHover = (e: MapLayerMouseEvent) => {\r\n map.getCanvas().style.cursor = 'pointer'\r\n const feature = e.features?.[0]\r\n if (!feature || !feature.properties.cluster_id) return\r\n if (!('coordinates' in feature.geometry)) return\r\n const center = feature.geometry.coordinates as [number, number]\r\n const clusterId = feature.properties.cluster_id as number\r\n\r\n const source = map.getSource('comments') as any\r\n source.getClusterLeaves(clusterId, Infinity, 0)\r\n .then((leaves: MapGeoJSONFeature[]) => {\r\n cancelSpiderClose()\r\n setSpider({ center, features: leaves })\r\n })\r\n .catch((error: unknown) => {\r\n console.error(error)\r\n })\r\n }\r\n\r\n const mouseLeaveCluster = () => {\r\n map.getCanvas().style.cursor = ''\r\n scheduleSpiderClose()\r\n }\r\n\r\n // Hover expands the cluster; click still zooms in to decluster as a fallback\r\n map.on('click', 'comments-clusters', zoomInToDecluster)\r\n map.on('mouseenter', 'comments-clusters', expandClusterOnHover)\r\n map.on('mouseleave', 'comments-clusters', mouseLeaveCluster)\r\n return () => {\r\n map.off('click', 'comments-clusters', zoomInToDecluster)\r\n map.off('mouseenter', 'comments-clusters', expandClusterOnHover)\r\n map.off('mouseleave', 'comments-clusters', mouseLeaveCluster)\r\n }\r\n }, [map, cancelSpiderClose, scheduleSpiderClose])\r\n\r\n const renderPopup = () => {\r\n if (!popupInfo) return null\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 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 <Comment\r\n userName={popupInfo.authorName || ''}\r\n userImage={popupAuthor?.imageFileId ?? popupInfo.imageFileId ?? null}\r\n userImageFileId={popupAuthor?.imageFileId ?? popupInfo.imageFileId ?? null}\r\n text={popupInfo.text}\r\n createdAt={popupInfo.createdAt}\r\n showActions\r\n canEdit={user.id === String(popupInfo.authorId)}\r\n canDelete={user.id === String(popupInfo.authorId)}\r\n onEdit={user.id === String(popupInfo.authorId) ? () => requestSidebarAction(popupInfo.id, 'edit') : undefined}\r\n onReply={() => requestSidebarAction(popupInfo.id, 'reply')}\r\n onRemove={user.id === String(popupInfo.authorId) ? handleRemoveComment : undefined}\r\n onClose={() => setPopUpInfo(null)}\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 comments to display avatars\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('comments')\r\n const unclusteredOnly = allFeatures.filter(\r\n (f) => !f.properties?.cluster && !f.properties?.point_count\r\n )\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 === 'comments') 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 {commentsVisibleInViewer.includes(ViewerNames.map) &&\r\n <Source\r\n id=\"comments\"\r\n type=\"geojson\"\r\n data={geojsonCommentData}\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 <CommentAvatarMarker\r\n key={String(feature.properties?.id)}\r\n feature={feature}\r\n isHighlighted={currentCommentId === feature.properties?.id || hoveredCommentId === feature.properties?.id}\r\n isFocused={focusedCommentId === feature.properties?.id}\r\n onMouseEnter={() => setHoveredCommentId(feature.properties?.id)}\r\n onMouseLeave={() => setHoveredCommentId(null)}\r\n onDoubleClick={() => focusComment(feature.properties?.id)}\r\n />\r\n ))}\r\n\r\n {/* Spiderfied cluster members shown on hover */}\r\n {spider && spider.features.map((feature, i) => {\r\n const n = spider.features.length\r\n const angle = (2 * Math.PI * i) / n - Math.PI / 2\r\n const radius = Math.min(60, 24 + n * 4)\r\n const offset: [number, number] = [Math.cos(angle) * radius, Math.sin(angle) * radius]\r\n const id = feature.properties?.id\r\n return (\r\n <CommentAvatarMarker\r\n key={`spider-${String(id)}`}\r\n feature={feature}\r\n center={spider.center}\r\n offset={offset}\r\n isHighlighted={currentCommentId === id || hoveredCommentId === id}\r\n isFocused={focusedCommentId === id}\r\n onMouseEnter={() => { cancelSpiderClose(); setHoveredCommentId(id) }}\r\n onMouseLeave={() => { scheduleSpiderClose(); setHoveredCommentId(null) }}\r\n onClick={() => { openPopupFromFeature(feature); setSpider(null) }}\r\n onDoubleClick={() => { focusComment(id); setSpider(null) }}\r\n />\r\n )\r\n })}\r\n </Source>}\r\n </>\r\n )\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiEU,SAkWN,UAlWM,KAqRJ,YArRI;AA5DV,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,YAAY,WAAW;AACvB,SAAS,QAAQ,OAAO,OAAO,cAAc;AAC7C,SAAS,aAAa;AAEtB,SAAS,aAAa,yBAAyB;AAC/C,SAAS,SAAS,gBAAgB;AAClC,SAAS,YAAY,oBAAoB;AACzC,SAAS,mBAA6C;AACtD,SAAS,yBAAyB;AAClC,SAAS,cAAc;AACvB,OAAO,aAAa;AACpB,SAAS,kBAAkB;AAC3B,SAAS,qCAAqC;AAC9C,SAAS,6BAA6B;AACtC,SAAS,oBAAoB,yBAAyB,mCAAmC;AAUzF,MAAM,sBAAsB,CAAC,EAAE,SAAS,eAAe,WAAW,cAAc,cAAc,SAAS,eAAe,QAAQ,OAAO,MAAkP;AA/BvX;AAgCE,QAAM,YAAW,aAAQ,eAAR,mBAAoB;AACrC,QAAM,EAAE,MAAM,OAAO,IAAI,QAAQ,YAAY,OAAO,OAAO,QAAQ,IAAI,EAAE;AACzE,QAAM,YAAW,aAAQ,eAAR,mBAAoB;AACrC,QAAM,mBAAkB,aAAQ,eAAR,mBAAoB;AAC5C,QAAM,uBAAsB,4CAAQ,gBAAR,YAAuB,oBAAvB,YAA0C;AAItE,QAAM,SAAS,SAAS,EAAE,KAAK,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,EAAE,IAAI,8BAA8B,OAAO;AAClG,MAAI,CAAC,OAAQ,QAAO;AAEpB,QAAM,QAAQ,YAAY,OAAO,gBAAgB,MAAM;AAEvD,SACE,oBAAC,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A,IAAoB;AAC/B,iBACE;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA,cACA,QAAQ,OAAO;AAAA,cACf;AAAA,cACA,eAAe,qBAAqB,MAAM,qBAAqB;AAAA,cAC/D,WAAW,qBAAqB;AAAA,cAChC,cAAc,MAAM;AAAE,kCAAkB;AAAG,oCAAoB,EAAE;AAAA,cAAE;AAAA,cACnE,cAAc,MAAM;AAAE,oCAAoB;AAAG,oCAAoB,IAAI;AAAA,cAAE;AAAA,cACvE,SAAS,MAAM;AAAE,qCAAqB,OAAO;AAAG,0BAAU,IAAI;AAAA,cAAE;AAAA,cAChE,eAAe,MAAM;AAAE,6BAAa,EAAE;AAAG,0BAAU,IAAI;AAAA,cAAE;AAAA;AAAA,YATpD,UAAU,OAAO,EAAE,CAAC;AAAA,UAU3B;AAAA,QAEJ,CAAC;AAAA;AAAA;AAAA,EACH,GACA;AAEJ;","names":["_a","user"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MapFileManager.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/FileLayer/components/MapFileManager.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA4B9B,KAAK,eAAe,GAAG;IACrB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;CAC9B,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,gBAAgB,EAAE,EAAE,eAAe,qBA0F3E"}
1
+ {"version":3,"file":"MapFileManager.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/core/components/viewers/map/src/MapLayers/src/FileLayer/components/MapFileManager.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA4B9B,KAAK,eAAe,GAAG;IACrB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;CAC9B,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,gBAAgB,EAAE,EAAE,eAAe,qBA4F3E"}
@@ -91,7 +91,8 @@ function MapFileManager({ closeFileManager }) {
91
91
  });
92
92
  },
93
93
  onRemoveFile: () => handleDeleteFile(file),
94
- onEditFile: () => console.log("Editing file with id", file.id)
94
+ onEditFile: () => {
95
+ }
95
96
  },
96
97
  file.id
97
98
  )) }) })