From 3eb32abc63cde03d81dc3e415b29c2f7df4274be Mon Sep 17 00:00:00 2001 From: Kim Lan Phan Hoang Date: Wed, 15 May 2024 10:51:24 +0200 Subject: [PATCH] feat: update map, pass parent item (#1234) * feat: update map, pass parent item * refactor: update map --- package.json | 2 +- src/components/item/MapView.tsx | 6 ++++-- yarn.lock | 10 +++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 1e4855830..944dd4097 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@emotion/react": "11.11.4", "@emotion/styled": "11.11.5", "@graasp/chatbox": "3.1.0", - "@graasp/map": "1.11.1", + "@graasp/map": "1.12.1", "@graasp/query-client": "3.8.0", "@graasp/sdk": "4.9.0", "@graasp/translations": "1.28.0", diff --git a/src/components/item/MapView.tsx b/src/components/item/MapView.tsx index 4bc543360..40069801a 100644 --- a/src/components/item/MapView.tsx +++ b/src/components/item/MapView.tsx @@ -69,6 +69,7 @@ const MapView = ({ const [geolocation, setGeolocation] = useState>(); const [open, setOpen] = useState(false); const { hasFetchedCurrentLocation, currentPosition } = useCurrentLocation(); + const { data: parent, isLoading: isLoadingParent } = hooks.useItem(parentId); const handleAddOnClick = (args: { location: Partial }) => { setGeolocation(args.location); @@ -91,7 +92,8 @@ const MapView = ({ )} - {enableGeolocation && !hasFetchedCurrentLocation ? ( + {(parentId && isLoadingParent) || + (enableGeolocation && !hasFetchedCurrentLocation) ? ( ) : (
@@ -105,7 +107,7 @@ const MapView = ({ useItemsInMap={hooks.useItemsInMap} viewItem={viewItem} currentMember={currentMember} - itemId={parentId} + item={parent} // use builder modal to add new item if the screen is big enough // todo: always use builder modal when it is responsive handleAddOnClick={isMobile ? undefined : handleAddOnClick} diff --git a/yarn.lock b/yarn.lock index 601b6179b..59b128689 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1453,9 +1453,9 @@ __metadata: languageName: node linkType: hard -"@graasp/map@npm:1.11.1": - version: 1.11.1 - resolution: "@graasp/map@npm:1.11.1" +"@graasp/map@npm:1.12.1": + version: 1.12.1 + resolution: "@graasp/map@npm:1.12.1" dependencies: "@emotion/react": "npm:11.11.4" "@emotion/styled": "npm:11.11.5" @@ -1490,7 +1490,7 @@ __metadata: react: "*" react-dom: "*" react-i18next: ^14.0.0 - checksum: 10/6c419098bad49a6a805a9ca323d23cf4734f0ff70c58537cadcc73c5e585589da182a6bacb6567fbba45e9a224004c924e577120baef538d1a212e4b6a0ac843 + checksum: 10/4274d83b66105867ddebcb9a515dd528d3aa18b8036461b3e35e90333180e21ea8046f49af15fc54da22b108d34f32be6f9d3e784583cb6be8c1b178357f6b1f languageName: node linkType: hard @@ -7330,7 +7330,7 @@ __metadata: "@emotion/react": "npm:11.11.4" "@emotion/styled": "npm:11.11.5" "@graasp/chatbox": "npm:3.1.0" - "@graasp/map": "npm:1.11.1" + "@graasp/map": "npm:1.12.1" "@graasp/query-client": "npm:3.8.0" "@graasp/sdk": "npm:4.9.0" "@graasp/translations": "npm:1.28.0"