From 969d9f0c4e92e4577eea7c2b8ffbcee00400c809 Mon Sep 17 00:00:00 2001 From: Bill Date: Mon, 3 Jan 2022 00:09:02 -0500 Subject: [PATCH] Update inventory --- .../inventory/InventoryMessageHandler.tsx | 5 +- src/components/inventory/InventoryView.scss | 6 +++ .../views/badge/InventoryBadgeItemView.tsx | 6 +-- .../views/bot/InventoryBotItemView.tsx | 6 +-- .../InventoryCategoryEmptyView.tsx | 2 +- .../furniture/InventoryFurnitureItemView.tsx | 2 +- .../views/pet/InventoryPetItemView.tsx | 10 ++-- .../views/trade/InventoryTradeView.tsx | 53 ++++++++++--------- 8 files changed, 51 insertions(+), 39 deletions(-) diff --git a/src/components/inventory/InventoryMessageHandler.tsx b/src/components/inventory/InventoryMessageHandler.tsx index fb7a539f..0dafc71d 100644 --- a/src/components/inventory/InventoryMessageHandler.tsx +++ b/src/components/inventory/InventoryMessageHandler.tsx @@ -1,10 +1,11 @@ import { AdvancedMap, BadgePointLimitsEvent, BadgeReceivedEvent, BadgesEvent, BotAddedToInventoryEvent, BotInventoryMessageEvent, BotRemovedFromInventoryEvent, FurnitureListAddOrUpdateEvent, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListItemParser, FurnitureListRemovedEvent, FurniturePostItPlacedEvent, PetAddedToInventoryEvent, PetData, PetInventoryEvent, PetRemovedFromInventory, RequestBadgesComposer, TradingAcceptEvent, TradingCloseEvent, TradingCompletedEvent, TradingConfirmationEvent, TradingListItemEvent, TradingNotOpenEvent, TradingOpenEvent, TradingOpenFailedEvent, TradingOtherNotAllowedEvent, TradingYouAreNotAllowedEvent, UnseenItemsEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; -import { GetLocalization, GetRoomSession, GetSessionDataManager } from '../../api'; +import { GetLocalization, GetRoomSession, GetSessionDataManager, LocalizeText } from '../../api'; import { InventoryBadgesUpdatedEvent } from '../../events'; import { InventoryBadgesRequestEvent } from '../../events/inventory/InventoryBadgesRequestEvent'; import { dispatchUiEvent, useUiEvent } from '../../hooks'; import { CreateMessageHook, SendMessageHook } from '../../hooks/messages/message-event'; +import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities'; import { mergeFurniFragments } from './common/FurnitureUtilities'; import { mergePetFragments } from './common/PetUtilities'; import { TradeState } from './common/TradeState'; @@ -292,6 +293,8 @@ export const InventoryMessageHandler: FC<{}> = props => const parser = event.getParser(); console.log(parser); + + NotificationUtilities.simpleAlert(LocalizeText(`inventory.trading.openfail.${ parser.reason }`, [ 'otherusername' ], [ parser.otherUserName ]), null, null, null, LocalizeText('inventory.trading.openfail.title')); }, []); const onTradingOtherNotAllowedEvent = useCallback((event: TradingOtherNotAllowedEvent) => diff --git a/src/components/inventory/InventoryView.scss b/src/components/inventory/InventoryView.scss index e01335a2..2cb695c0 100644 --- a/src/components/inventory/InventoryView.scss +++ b/src/components/inventory/InventoryView.scss @@ -7,4 +7,10 @@ width: 129px; height: 181px; } + + .trade-button { + min-height: 0; + font-size: 8px; + padding: 1px 2px; + } } diff --git a/src/components/inventory/views/badge/InventoryBadgeItemView.tsx b/src/components/inventory/views/badge/InventoryBadgeItemView.tsx index 29e347cf..a4f45692 100644 --- a/src/components/inventory/views/badge/InventoryBadgeItemView.tsx +++ b/src/components/inventory/views/badge/InventoryBadgeItemView.tsx @@ -1,6 +1,6 @@ import { MouseEventType } from '@nitrots/nitro-renderer'; import { FC, MouseEvent, useCallback } from 'react'; -import { NitroCardGridItemView } from '../../../../layout/card/grid/item/NitroCardGridItemView'; +import { LayoutGridItem } from '../../../../common/layout/LayoutGridItem'; import { BadgeImageView } from '../../../../views/shared/badge-image/BadgeImageView'; import { useInventoryContext } from '../../context/InventoryContext'; import { InventoryBadgeActions } from '../../reducers/InventoryBadgeReducer'; @@ -28,8 +28,8 @@ export const InventoryBadgeItemView: FC = props => }, [ badgeCode, dispatchBadgeState ]); return ( - + - + ); } diff --git a/src/components/inventory/views/bot/InventoryBotItemView.tsx b/src/components/inventory/views/bot/InventoryBotItemView.tsx index e5f3247e..caef8594 100644 --- a/src/components/inventory/views/bot/InventoryBotItemView.tsx +++ b/src/components/inventory/views/bot/InventoryBotItemView.tsx @@ -1,6 +1,6 @@ import { MouseEventType } from '@nitrots/nitro-renderer'; import { FC, MouseEvent, useCallback, useEffect, useState } from 'react'; -import { NitroCardGridItemView } from '../../../../layout/card/grid/item/NitroCardGridItemView'; +import { LayoutGridItem } from '../../../../common/layout/LayoutGridItem'; import { AvatarImageView } from '../../../../views/shared/avatar-image/AvatarImageView'; import { BotItem } from '../../common/BotItem'; import { attemptBotPlacement } from '../../common/BotUtilities'; @@ -50,8 +50,8 @@ export const InventoryBotItemView: FC = props => }, [ isActive, botItem ]); return ( - + - + ); } diff --git a/src/components/inventory/views/category-empty/InventoryCategoryEmptyView.tsx b/src/components/inventory/views/category-empty/InventoryCategoryEmptyView.tsx index 5c2cfd26..8460d97e 100644 --- a/src/components/inventory/views/category-empty/InventoryCategoryEmptyView.tsx +++ b/src/components/inventory/views/category-empty/InventoryCategoryEmptyView.tsx @@ -19,7 +19,7 @@ export const InventoryCategoryEmptyView: FC = p
- { title } + { title } { desc } { children } diff --git a/src/components/inventory/views/furniture/InventoryFurnitureItemView.tsx b/src/components/inventory/views/furniture/InventoryFurnitureItemView.tsx index 8a428146..9b458566 100644 --- a/src/components/inventory/views/furniture/InventoryFurnitureItemView.tsx +++ b/src/components/inventory/views/furniture/InventoryFurnitureItemView.tsx @@ -14,8 +14,8 @@ export interface InventoryFurnitureItemViewProps export const InventoryFurnitureItemView: FC = props => { const { groupItem } = props; - const { furnitureState, dispatchFurnitureState } = useInventoryContext(); const [ isMouseDown, setMouseDown ] = useState(false); + const { furnitureState, dispatchFurnitureState } = useInventoryContext(); const isActive = (furnitureState.groupItem === groupItem); const onMouseEvent = useCallback((event: MouseEvent) => diff --git a/src/components/inventory/views/pet/InventoryPetItemView.tsx b/src/components/inventory/views/pet/InventoryPetItemView.tsx index b5f0f2d2..5bcd7b06 100644 --- a/src/components/inventory/views/pet/InventoryPetItemView.tsx +++ b/src/components/inventory/views/pet/InventoryPetItemView.tsx @@ -1,6 +1,6 @@ import { MouseEventType } from '@nitrots/nitro-renderer'; import { FC, MouseEvent, useCallback, useEffect, useState } from 'react'; -import { NitroCardGridItemView } from '../../../../layout/card/grid/item/NitroCardGridItemView'; +import { LayoutGridItem } from '../../../../common/layout/LayoutGridItem'; import { PetImageView } from '../../../../views/shared/pet-image/PetImageView'; import { PetItem } from '../../common/PetItem'; import { attemptPetPlacement } from '../../common/PetUtilities'; @@ -15,8 +15,8 @@ export interface InventoryPetItemViewProps export const InventoryPetItemView: FC = props => { const { petItem } = props; - const { petState = null, dispatchPetState = null } = useInventoryContext(); const [ isMouseDown, setMouseDown ] = useState(false); + const { petState = null, dispatchPetState = null } = useInventoryContext(); const isActive = (petState.petItem === petItem); const onMouseEvent = useCallback((event: MouseEvent) => @@ -50,8 +50,8 @@ export const InventoryPetItemView: FC = props => }, [ isActive, petItem ]); return ( - - - + + + ); } diff --git a/src/components/inventory/views/trade/InventoryTradeView.tsx b/src/components/inventory/views/trade/InventoryTradeView.tsx index b667e586..73ad1642 100644 --- a/src/components/inventory/views/trade/InventoryTradeView.tsx +++ b/src/components/inventory/views/trade/InventoryTradeView.tsx @@ -7,9 +7,10 @@ import { Button } from '../../../../common/Button'; import { Column } from '../../../../common/Column'; import { Flex } from '../../../../common/Flex'; import { Grid } from '../../../../common/Grid'; +import { LayoutGridItem } from '../../../../common/layout/LayoutGridItem'; import { Text } from '../../../../common/Text'; import { SendMessageHook } from '../../../../hooks/messages'; -import { NitroCardGridItemView } from '../../../../layout/card/grid/item/NitroCardGridItemView'; +import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities'; import { FurniCategory } from '../../common/FurniCategory'; import { GroupItem } from '../../common/GroupItem'; import { IFurnitureItem } from '../../common/IFurnitureItem'; @@ -156,7 +157,7 @@ export const InventoryTradeView: FC = props => case TradeState.TRADING_STATE_RUNNING: if(!tradeData.otherUser.itemCount && !tradeData.ownUser.accepts) { - //this._notificationService.alert('${inventory.trading.warning.other_not_offering}'); + NotificationUtilities.simpleAlert(LocalizeText('${inventory.trading.warning.other_not_offering}'), null, null, null); } if(tradeData.ownUser.accepts) @@ -246,24 +247,26 @@ export const InventoryTradeView: FC = props => - - { filteredGroupItems && (filteredGroupItems.length > 0) && filteredGroupItems.map((item, index) => - { - const count = item.getUnlockedCount(); + + + { filteredGroupItems && (filteredGroupItems.length > 0) && filteredGroupItems.map((item, index) => + { + const count = item.getUnlockedCount(); - return ( - (count && setGroupItem(item)) }> - { ((count > 0) && (groupItem === item)) && - } - - ); - }) } - - - { groupItem ? groupItem.name : LocalizeText('catalog_selectproduct') } - + return ( + (count && setGroupItem(item)) }> + { ((count > 0) && (groupItem === item)) && + } + + ); + }) } + + + { groupItem ? groupItem.name : LocalizeText('catalog_selectproduct') } + + @@ -277,15 +280,15 @@ export const InventoryTradeView: FC = props => { const item = (tradeData.ownUser.items.getWithIndex(i) || null); - if(!item) return ; + if(!item) return ; return ( - setOwnGroupItem(item) }> + setOwnGroupItem(item) }> { (ownGroupItem === item) && - } - + ); }) } @@ -303,9 +306,9 @@ export const InventoryTradeView: FC = props => { const item = (tradeData.otherUser.items.getWithIndex(i) || null); - if(!item) return ; + if(!item) return ; - return setOtherGroupItem(item) } />; + return setOtherGroupItem(item) } />; }) }