From 031d58e27217ae8fc64e7f9f93df21d42ad76b24 Mon Sep 17 00:00:00 2001 From: Mateusz Banaszak Date: Tue, 14 Jan 2025 12:55:20 +0100 Subject: [PATCH 1/8] fix: not using recoil --- package-lock.json | 4 ++-- .../src/components/MapWrapper/MapWrapper.jsx | 13 ++++++++++++- .../src/components/MIMap/MapboxMap/MapboxMap.jsx | 10 ++++------ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 042cf6bdb..31b57a5a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22622,7 +22622,7 @@ }, "packages/components": { "name": "@mapsindoors/components", - "version": "13.24.1", + "version": "13.25.0", "license": "MIT", "dependencies": { "@11ty/eleventy": "^2.0.1", @@ -22662,7 +22662,7 @@ }, "packages/map-template": { "name": "@mapsindoors/map-template", - "version": "1.64.0", + "version": "1.65.2", "devDependencies": { "@googlemaps/js-api-loader": "^1.15.1", "@mapsindoors/components": "*", diff --git a/packages/map-template/src/components/MapWrapper/MapWrapper.jsx b/packages/map-template/src/components/MapWrapper/MapWrapper.jsx index 016a9b51c..541d73a89 100644 --- a/packages/map-template/src/components/MapWrapper/MapWrapper.jsx +++ b/packages/map-template/src/components/MapWrapper/MapWrapper.jsx @@ -1,4 +1,4 @@ -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import { useRecoilState, useRecoilValue } from 'recoil'; import MIMap from '@mapsindoors/react-components/src/components/MIMap/MIMap'; import { mapTypes } from "../../constants/mapTypes"; @@ -20,6 +20,7 @@ import solutionState from '../../atoms/solutionState'; import notificationMessageState from '../../atoms/notificationMessageState'; import useMapBoundsDeterminer from '../../hooks/useMapBoundsDeterminer'; import hideNonMatchesState from "../../atoms/hideNonMatchesState"; +import miTransitionLevelState from "../../atoms/miTransitionLevelState"; /** * Private variable used for storing the tile style. @@ -57,6 +58,8 @@ function MapWrapper({ onLocationClick, onMapPositionKnown, useMapProviderModule, const solution = useRecoilValue(solutionState); const [, setErrorMessage] = useRecoilState(notificationMessageState); const hideNonMatches = useRecoilValue(hideNonMatchesState); + const [mapOptions, setMapOptions] = useState({}); + const miTransitionLevel = useRecoilValue(miTransitionLevelState); useLiveData(apiKey); @@ -274,6 +277,13 @@ function MapWrapper({ onLocationClick, onMapPositionKnown, useMapProviderModule, onTileStyleChanged(mapsIndoorsInstance); }, [tileStyle]); + /** + * React on changes in the miTransitionLevel prop. + */ + useEffect(() => { + setMapOptions({ miTransitionLevel: miTransitionLevel}) + }, [miTransitionLevel]) + return (<> {apiKey && } ) }; diff --git a/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx b/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx index 05c2f2bb6..e38ca81c7 100644 --- a/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx +++ b/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx @@ -6,8 +6,6 @@ import './MapboxMap.scss'; import ViewModeSwitch from './ViewModeSwitch/ViewModeSwitch'; import { useIsDesktop } from '../../../hooks/useIsDesktop'; import isNullOrUndefined from '../../../../../map-template/src/helpers/isNullOrUndefined'; -import { useRecoilValue } from 'recoil'; -import miTransitionLevelState from '../../../../../map-template/src/atoms/miTransitionLevelState'; MapboxMap.propTypes = { accessToken: PropTypes.string.isRequired, @@ -21,7 +19,8 @@ MapboxMap.propTypes = { resetViewMode: PropTypes.number, mapsIndoorsInstance: PropTypes.object, viewModeSwitchVisible: PropTypes.bool, - mapOptions: PropTypes.object + mapOptions: PropTypes.object, + miTransitionLevel: PropTypes.number } /** @@ -46,7 +45,6 @@ function MapboxMap({ accessToken, onInitialized, onPositionControl, center, zoom const [hasPositionControl, setHasPositionControl] = useState(false); const [hasZoomControl, setHasZoomControl] = useState(false); const isDesktop = useIsDesktop(); - const miTransitionLevel = useRecoilValue(miTransitionLevelState); /* * React on any props that are used to control the position of the map. @@ -138,8 +136,8 @@ function MapboxMap({ accessToken, onInitialized, onPositionControl, center, zoom }; // If miTransitionLevel exists and it's a number, set it in the mapViewOptions - if (miTransitionLevel && !isNaN(parseInt(miTransitionLevel))) { - mapViewOptions.mapsIndoorsTransitionLevel = parseInt(miTransitionLevel); + if (mapOptions?.miTransitionLevel && !isNaN(parseInt(mapOptions?.miTransitionLevel))) { + mapViewOptions.mapsIndoorsTransitionLevel = parseInt(mapOptions.miTransitionLevel); } const mapView = new window.mapsindoors.mapView.MapboxV3View(mapViewOptions); From 80e35a38759543c8a848d6a722d1fb69eebbc39c Mon Sep 17 00:00:00 2001 From: Mateusz Banaszak <56337591+matbmapspeople@users.noreply.github.com> Date: Wed, 15 Jan 2025 07:47:53 +0100 Subject: [PATCH 2/8] Update packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx Co-authored-by: Anders Mogensen --- .../src/components/MIMap/MapboxMap/MapboxMap.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx b/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx index e38ca81c7..0dd55d977 100644 --- a/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx +++ b/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx @@ -20,7 +20,6 @@ MapboxMap.propTypes = { mapsIndoorsInstance: PropTypes.object, viewModeSwitchVisible: PropTypes.bool, mapOptions: PropTypes.object, - miTransitionLevel: PropTypes.number } /** From 23dffd7af305cf4d554cd833f343933c6a878919 Mon Sep 17 00:00:00 2001 From: Mateusz Banaszak <56337591+matbmapspeople@users.noreply.github.com> Date: Thu, 16 Jan 2025 14:01:19 +0100 Subject: [PATCH 3/8] Update packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx Co-authored-by: Anders Mogensen --- .../src/components/MIMap/MapboxMap/MapboxMap.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx b/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx index 0dd55d977..8c7d68df7 100644 --- a/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx +++ b/packages/react-components/src/components/MIMap/MapboxMap/MapboxMap.jsx @@ -19,7 +19,7 @@ MapboxMap.propTypes = { resetViewMode: PropTypes.number, mapsIndoorsInstance: PropTypes.object, viewModeSwitchVisible: PropTypes.bool, - mapOptions: PropTypes.object, + mapOptions: PropTypes.object } /** From 00670cc543441d5acbe8fd9e26e91786d964e346 Mon Sep 17 00:00:00 2001 From: Mateusz Banaszak Date: Thu, 16 Jan 2025 14:04:02 +0100 Subject: [PATCH 4/8] add: check if miTransitionLevel is a number --- .../map-template/src/components/MapWrapper/MapWrapper.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/map-template/src/components/MapWrapper/MapWrapper.jsx b/packages/map-template/src/components/MapWrapper/MapWrapper.jsx index 541d73a89..1997d180a 100644 --- a/packages/map-template/src/components/MapWrapper/MapWrapper.jsx +++ b/packages/map-template/src/components/MapWrapper/MapWrapper.jsx @@ -281,7 +281,9 @@ function MapWrapper({ onLocationClick, onMapPositionKnown, useMapProviderModule, * React on changes in the miTransitionLevel prop. */ useEffect(() => { - setMapOptions({ miTransitionLevel: miTransitionLevel}) + if (!isNaN(parseInt(mapOptions?.miTransitionLevel))) { + setMapOptions({ miTransitionLevel: miTransitionLevel}) + } }, [miTransitionLevel]) return (<> From 43446d5f70f1a125b90e643cee08d57b69e6ea95 Mon Sep 17 00:00:00 2001 From: Mateusz Banaszak Date: Mon, 20 Jan 2025 07:59:22 +0100 Subject: [PATCH 5/8] remove: unused import --- packages/react-components/src/main.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-components/src/main.jsx b/packages/react-components/src/main.jsx index 99f21ac9e..4fe035e1e 100644 --- a/packages/react-components/src/main.jsx +++ b/packages/react-components/src/main.jsx @@ -1,4 +1,3 @@ -import React from 'react' import ReactDOM from 'react-dom/client' import App from './App.jsx' import './index.css' From 34151a83e36e9a8e26e296ec0f1ead1faa46a6b6 Mon Sep 17 00:00:00 2001 From: Mateusz Banaszak Date: Tue, 21 Jan 2025 10:55:30 +0100 Subject: [PATCH 6/8] fix: if condition check --- packages/map-template/src/components/MapWrapper/MapWrapper.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/map-template/src/components/MapWrapper/MapWrapper.jsx b/packages/map-template/src/components/MapWrapper/MapWrapper.jsx index 1997d180a..1266128ea 100644 --- a/packages/map-template/src/components/MapWrapper/MapWrapper.jsx +++ b/packages/map-template/src/components/MapWrapper/MapWrapper.jsx @@ -281,7 +281,7 @@ function MapWrapper({ onLocationClick, onMapPositionKnown, useMapProviderModule, * React on changes in the miTransitionLevel prop. */ useEffect(() => { - if (!isNaN(parseInt(mapOptions?.miTransitionLevel))) { + if (!isNaN(parseInt(miTransitionLevel))) { setMapOptions({ miTransitionLevel: miTransitionLevel}) } }, [miTransitionLevel]) From 76d31ac270a21777baacf4c45594b6ddc8642a42 Mon Sep 17 00:00:00 2001 From: Mateusz Banaszak Date: Wed, 22 Jan 2025 16:16:58 +0100 Subject: [PATCH 7/8] merge main and npm i --- package-lock.json | 2 +- packages/midt/build/json/variables.json | 2 +- packages/midt/build/scss/_variables.scss | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9907285c3..3770ba740 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25551,7 +25551,7 @@ }, "packages/map-template": { "name": "@mapsindoors/map-template", - "version": "1.66.1", + "version": "1.66.2", "devDependencies": { "@googlemaps/js-api-loader": "^1.15.1", "@mapsindoors/components": "*", diff --git a/packages/midt/build/json/variables.json b/packages/midt/build/json/variables.json index 5ab02d909..65b489681 100644 --- a/packages/midt/build/json/variables.json +++ b/packages/midt/build/json/variables.json @@ -596,4 +596,4 @@ "popup": "950", "top": "999999" } -} \ No newline at end of file +} diff --git a/packages/midt/build/scss/_variables.scss b/packages/midt/build/scss/_variables.scss index 1af31253c..d49f0cbbd 100644 --- a/packages/midt/build/scss/_variables.scss +++ b/packages/midt/build/scss/_variables.scss @@ -468,4 +468,4 @@ $z-index-overlay: 700; $z-index-spinner: 800; $z-index-modal: 900; $z-index-popup: 950; -$z-index-top: 999999; \ No newline at end of file +$z-index-top: 999999; From 4d6dbe098069c6a72ad4bc06deb99f4ce1df3b4a Mon Sep 17 00:00:00 2001 From: andreeaceachir Date: Thu, 23 Jan 2025 13:22:41 +0100 Subject: [PATCH 8/8] chore: Merge main and update changelog. --- package-lock.json | 2 +- packages/map-template/CHANGELOG.md | 12 ++++++++++++ packages/midt/build/json/variables.json | 2 +- packages/midt/build/scss/_variables.scss | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b1a8116cb..8fdbdcf72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21465,7 +21465,7 @@ }, "packages/map-template": { "name": "@mapsindoors/map-template", - "version": "1.66.2", + "version": "1.66.3", "devDependencies": { "@googlemaps/js-api-loader": "^1.15.1", "@mapsindoors/components": "*", diff --git a/packages/map-template/CHANGELOG.md b/packages/map-template/CHANGELOG.md index b9565fa8f..31f77fa8a 100644 --- a/packages/map-template/CHANGELOG.md +++ b/packages/map-template/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.66.4] - 2025-01-23 + +## Fixed + +- Fix `miTransitionLevel` prop breaking the React Component package. + +## [1.66.3] - 2025-01-23 + +## Fixed + +- Fix package-lock issues. + ## [1.66.2] - 2025-01-21 ## Fixed diff --git a/packages/midt/build/json/variables.json b/packages/midt/build/json/variables.json index 65b489681..5ab02d909 100644 --- a/packages/midt/build/json/variables.json +++ b/packages/midt/build/json/variables.json @@ -596,4 +596,4 @@ "popup": "950", "top": "999999" } -} +} \ No newline at end of file diff --git a/packages/midt/build/scss/_variables.scss b/packages/midt/build/scss/_variables.scss index d49f0cbbd..1af31253c 100644 --- a/packages/midt/build/scss/_variables.scss +++ b/packages/midt/build/scss/_variables.scss @@ -468,4 +468,4 @@ $z-index-overlay: 700; $z-index-spinner: 800; $z-index-modal: 900; $z-index-popup: 950; -$z-index-top: 999999; +$z-index-top: 999999; \ No newline at end of file