Skip to content

Commit

Permalink
feat: update map, pass parent item (#1234)
Browse files Browse the repository at this point in the history
* feat: update map, pass parent item

* refactor: update map
  • Loading branch information
pyphilia authored May 15, 2024
1 parent 68ac92d commit 3eb32ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions src/components/item/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const MapView = ({
const [geolocation, setGeolocation] = useState<Partial<ItemGeolocation>>();
const [open, setOpen] = useState(false);
const { hasFetchedCurrentLocation, currentPosition } = useCurrentLocation();
const { data: parent, isLoading: isLoadingParent } = hooks.useItem(parentId);

const handleAddOnClick = (args: { location: Partial<ItemGeolocation> }) => {
setGeolocation(args.location);
Expand All @@ -91,7 +92,8 @@ const MapView = ({
)}
</Stack>
<Stack flex={1}>
{enableGeolocation && !hasFetchedCurrentLocation ? (
{(parentId && isLoadingParent) ||
(enableGeolocation && !hasFetchedCurrentLocation) ? (
<Skeleton width="100%" height="100%" />
) : (
<div style={{ width: '100%', height: '100%' }}>
Expand All @@ -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}
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -1490,7 +1490,7 @@ __metadata:
react: "*"
react-dom: "*"
react-i18next: ^14.0.0
checksum: 10/6c419098bad49a6a805a9ca323d23cf4734f0ff70c58537cadcc73c5e585589da182a6bacb6567fbba45e9a224004c924e577120baef538d1a212e4b6a0ac843
checksum: 10/4274d83b66105867ddebcb9a515dd528d3aa18b8036461b3e35e90333180e21ea8046f49af15fc54da22b108d34f32be6f9d3e784583cb6be8c1b178357f6b1f
languageName: node
linkType: hard

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 3eb32ab

Please sign in to comment.