From a9203550f4613d83f691a6cb7d5572b89af7c472 Mon Sep 17 00:00:00 2001 From: object Date: Wed, 17 Aug 2022 17:59:18 +0000 Subject: [PATCH] Fix placing furni when is a gift --- .../furniture/FurnitureGiftOpeningView.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/room/widgets/furniture/FurnitureGiftOpeningView.tsx b/src/components/room/widgets/furniture/FurnitureGiftOpeningView.tsx index d6a8c001..1478a3bd 100644 --- a/src/components/room/widgets/furniture/FurnitureGiftOpeningView.tsx +++ b/src/components/room/widgets/furniture/FurnitureGiftOpeningView.tsx @@ -1,14 +1,23 @@ import { FC } from 'react'; -import { CreateLinkEvent, LocalizeText } from '../../../../api'; +import { attemptItemPlacement, CreateLinkEvent, LocalizeText } from '../../../../api'; import { Button, Column, Flex, LayoutGiftTagView, LayoutImage, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; -import { useFurniturePresentWidget } from '../../../../hooks'; +import { useFurniturePresentWidget, useInventoryFurni } from '../../../../hooks'; export const FurnitureGiftOpeningView: FC<{}> = props => { const { objectId = -1, classId = -1, itemType = null, text = null, isOwnerOfFurniture = false, senderName = null, senderFigure = null, placedItemId = -1, placedItemType = null, placedInRoom = false, imageUrl = null, openPresent = null, onClose = null } = useFurniturePresentWidget(); + const { groupItems = null } = useInventoryFurni(); if(objectId === -1) return null; + const putFurni = (itemId: number) => + { + const furni = groupItems?.filter(group => group.items[0].ref == itemId); + + attemptItemPlacement(furni[0]); + onClose(); + } + return ( @@ -45,7 +54,7 @@ export const FurnitureGiftOpeningView: FC<{}> = props => } -