From 6ae4efd3aa82eaf08c106e8b76f51d5f11e9f2fc Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 30 Mar 2022 15:24:57 -0400 Subject: [PATCH] Catalog updates --- src/api/catalog/ProductTypeEnum.ts | 11 +++++++++++ src/api/catalog/index.ts | 1 + src/api/index.ts | 1 + .../widgets/handlers/FurniturePresentWidgetHandler.ts | 2 +- src/api/nitro/session/GetFurnitureData.ts | 2 +- src/common/layout/LayoutFurniIconImageView.tsx | 3 +-- src/common/layout/LayoutFurniImageView.tsx | 3 +-- src/components/catalog/CatalogMessageHandler.tsx | 3 +-- .../catalog/common/AttemptCatalogPlacement.ts | 3 +-- .../catalog/common/IsCatalogOfferDraggable.ts | 3 +-- src/components/catalog/common/Offer.ts | 3 +-- src/components/catalog/common/Product.ts | 3 +-- src/components/catalog/common/ProductTypeEnum.ts | 11 ----------- src/components/catalog/views/gift/CatalogGiftView.tsx | 3 +-- .../views/page/common/CatalogGridOfferView.tsx | 10 ++++++++-- .../views/page/layout/CatalogLayoutDefaultView.tsx | 6 +----- .../marketplace/CatalogLayoutMarketplaceItemView.tsx | 9 ++------- .../layout/marketplace/MarketplacePostOfferView.tsx | 3 +-- .../views/page/widgets/CatalogItemGridWidgetView.tsx | 4 ++-- .../views/page/widgets/CatalogSpacesWidgetView.tsx | 7 ++----- .../page/widgets/CatalogViewProductWidgetView.tsx | 3 +-- .../gift-opening/FurnitureGiftOpeningView.tsx | 3 +-- 22 files changed, 41 insertions(+), 56 deletions(-) create mode 100644 src/api/catalog/ProductTypeEnum.ts create mode 100644 src/api/catalog/index.ts delete mode 100644 src/components/catalog/common/ProductTypeEnum.ts diff --git a/src/api/catalog/ProductTypeEnum.ts b/src/api/catalog/ProductTypeEnum.ts new file mode 100644 index 00000000..f2490816 --- /dev/null +++ b/src/api/catalog/ProductTypeEnum.ts @@ -0,0 +1,11 @@ +export class ProductTypeEnum +{ + public static WALL: string = 'i'; + public static FLOOR: string = 's'; + public static EFFECT: string = 'e'; + public static HABBO_CLUB: string = 'h'; + public static BADGE: string = 'b'; + public static GAME_TOKEN: string = 'GAME_TOKEN'; + public static PET: string = 'p'; + public static ROBOT: string = 'r'; +} diff --git a/src/api/catalog/index.ts b/src/api/catalog/index.ts new file mode 100644 index 00000000..9b5a552f --- /dev/null +++ b/src/api/catalog/index.ts @@ -0,0 +1 @@ +export * from './ProductTypeEnum'; diff --git a/src/api/index.ts b/src/api/index.ts index 9ec673e9..4c1e6d90 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,5 +1,6 @@ export * from './achievements'; export * from './campaign'; +export * from './catalog'; export * from './common'; export * from './core'; export * from './friends'; diff --git a/src/api/nitro/room/widgets/handlers/FurniturePresentWidgetHandler.ts b/src/api/nitro/room/widgets/handlers/FurniturePresentWidgetHandler.ts index 2b1f3ed2..42405054 100644 --- a/src/api/nitro/room/widgets/handlers/FurniturePresentWidgetHandler.ts +++ b/src/api/nitro/room/widgets/handlers/FurniturePresentWidgetHandler.ts @@ -1,7 +1,7 @@ import { IFurnitureData, IGetImageListener, NitroEvent, NitroRenderTexture, PetFigureData, RoomObjectCategory, RoomObjectVariable, RoomSessionPresentEvent, RoomWidgetEnum, TextureUtils, Vector3d } from '@nitrots/nitro-renderer'; import { GetSessionDataManager, IsOwnerOfFurniture } from '../../..'; import { GetRoomEngine, LocalizeText } from '../../../..'; -import { ProductTypeEnum } from '../../../../../components/catalog/common/ProductTypeEnum'; +import { ProductTypeEnum } from '../../../../catalog'; import { RoomWidgetUpdateEvent, RoomWidgetUpdatePresentDataEvent } from '../events'; import { RoomWidgetFurniToWidgetMessage, RoomWidgetPresentOpenMessage } from '../messages'; import { RoomWidgetMessage } from '../messages/RoomWidgetMessage'; diff --git a/src/api/nitro/session/GetFurnitureData.ts b/src/api/nitro/session/GetFurnitureData.ts index 4272dbd3..71afef86 100644 --- a/src/api/nitro/session/GetFurnitureData.ts +++ b/src/api/nitro/session/GetFurnitureData.ts @@ -1,6 +1,6 @@ import { IFurnitureData } from '@nitrots/nitro-renderer'; import { GetSessionDataManager } from '.'; -import { ProductTypeEnum } from '../../../components/catalog/common/ProductTypeEnum'; +import { ProductTypeEnum } from '../../catalog'; export function GetFurnitureData(furniClassId: number, productType: string): IFurnitureData { diff --git a/src/common/layout/LayoutFurniIconImageView.tsx b/src/common/layout/LayoutFurniIconImageView.tsx index c961d66f..0329d43f 100644 --- a/src/common/layout/LayoutFurniIconImageView.tsx +++ b/src/common/layout/LayoutFurniIconImageView.tsx @@ -1,7 +1,6 @@ import { FC } from 'react'; import { LayoutImage, LayoutImageProps } from '.'; -import { GetRoomEngine } from '../../api'; -import { ProductTypeEnum } from '../../components/catalog/common/ProductTypeEnum'; +import { GetRoomEngine, ProductTypeEnum } from '../../api'; interface LayoutFurniIconImageViewProps extends LayoutImageProps { diff --git a/src/common/layout/LayoutFurniImageView.tsx b/src/common/layout/LayoutFurniImageView.tsx index a9d81772..b39fec23 100644 --- a/src/common/layout/LayoutFurniImageView.tsx +++ b/src/common/layout/LayoutFurniImageView.tsx @@ -1,7 +1,6 @@ import { IGetImageListener, ImageResult, TextureUtils, Vector3d } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; -import { GetRoomEngine } from '../../api'; -import { ProductTypeEnum } from '../../components/catalog/common/ProductTypeEnum'; +import { GetRoomEngine, ProductTypeEnum } from '../../api'; import { Base } from '../Base'; interface LayoutFurniImageViewProps diff --git a/src/components/catalog/CatalogMessageHandler.tsx b/src/components/catalog/CatalogMessageHandler.tsx index 3e3e2552..b149befa 100644 --- a/src/components/catalog/CatalogMessageHandler.tsx +++ b/src/components/catalog/CatalogMessageHandler.tsx @@ -1,7 +1,7 @@ import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, ClubGiftInfoEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, MarketplaceMakeOfferResult, NodeData, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, SellablePetPalettesMessageEvent, UserSubscriptionEvent } from '@nitrots/nitro-renderer'; import { GuildMembershipsMessageEvent } from '@nitrots/nitro-renderer/src/nitro/communication/messages/incoming/user/GuildMembershipsMessageEvent'; import { FC, useCallback } from 'react'; -import { GetFurnitureData, GetProductDataForLocalization, LocalizeText, NotificationAlertType, NotificationUtilities } from '../../api'; +import { GetFurnitureData, GetProductDataForLocalization, LocalizeText, NotificationAlertType, NotificationUtilities, ProductTypeEnum } from '../../api'; import { CatalogGiftReceiverNotFoundEvent, CatalogNameResultEvent, CatalogPurchasedEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent } from '../../events'; import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../hooks'; import { useCatalogContext } from './CatalogContext'; @@ -15,7 +15,6 @@ import { IPurchasableOffer } from './common/IPurchasableOffer'; import { Offer } from './common/Offer'; import { PageLocalization } from './common/PageLocalization'; import { Product } from './common/Product'; -import { ProductTypeEnum } from './common/ProductTypeEnum'; import { SubscriptionInfo } from './common/SubscriptionInfo'; export const CatalogMessageHandler: FC<{}> = props => diff --git a/src/components/catalog/common/AttemptCatalogPlacement.ts b/src/components/catalog/common/AttemptCatalogPlacement.ts index af342ee3..2eb418a3 100644 --- a/src/components/catalog/common/AttemptCatalogPlacement.ts +++ b/src/components/catalog/common/AttemptCatalogPlacement.ts @@ -1,7 +1,6 @@ import { CatalogPageMessageOfferData, RoomObjectCategory, RoomObjectPlacementSource } from '@nitrots/nitro-renderer'; -import { GetRoomEngine } from '../../../api'; +import { GetRoomEngine, ProductTypeEnum } from '../../../api'; import { IsCatalogOfferDraggable } from './IsCatalogOfferDraggable'; -import { ProductTypeEnum } from './ProductTypeEnum'; export const AttemptCatalogPlacement = (offer: CatalogPageMessageOfferData) => { diff --git a/src/components/catalog/common/IsCatalogOfferDraggable.ts b/src/components/catalog/common/IsCatalogOfferDraggable.ts index 174ce4d0..976bd2e1 100644 --- a/src/components/catalog/common/IsCatalogOfferDraggable.ts +++ b/src/components/catalog/common/IsCatalogOfferDraggable.ts @@ -1,6 +1,5 @@ import { CatalogPageMessageOfferData, RoomControllerLevel } from '@nitrots/nitro-renderer'; -import { GetRoomSession } from '../../../api'; -import { ProductTypeEnum } from './ProductTypeEnum'; +import { GetRoomSession, ProductTypeEnum } from '../../../api'; export const IsCatalogOfferDraggable = (offer: CatalogPageMessageOfferData) => { diff --git a/src/components/catalog/common/Offer.ts b/src/components/catalog/common/Offer.ts index b39ed48f..4b6f4f4e 100644 --- a/src/components/catalog/common/Offer.ts +++ b/src/components/catalog/common/Offer.ts @@ -1,9 +1,8 @@ -import { GetFurnitureData, GetProductDataForLocalization, LocalizeText } from '../../../api'; +import { GetFurnitureData, GetProductDataForLocalization, LocalizeText, ProductTypeEnum } from '../../../api'; import { ICatalogPage } from './ICatalogPage'; import { IProduct } from './IProduct'; import { IPurchasableOffer } from './IPurchasableOffer'; import { Product } from './Product'; -import { ProductTypeEnum } from './ProductTypeEnum'; export class Offer implements IPurchasableOffer { diff --git a/src/components/catalog/common/Product.ts b/src/components/catalog/common/Product.ts index e0e8f079..52c7136c 100644 --- a/src/components/catalog/common/Product.ts +++ b/src/components/catalog/common/Product.ts @@ -1,9 +1,8 @@ import { IFurnitureData, IObjectData, IProductData } from '@nitrots/nitro-renderer'; -import { GetConfiguration, GetRoomEngine, GetSessionDataManager } from '../../../api'; +import { GetConfiguration, GetRoomEngine, GetSessionDataManager, ProductTypeEnum } from '../../../api'; import { GetPixelEffectIcon, GetSubscriptionProductIcon } from './CatalogUtilities'; import { IProduct } from './IProduct'; import { IPurchasableOffer } from './IPurchasableOffer'; -import { ProductTypeEnum } from './ProductTypeEnum'; export class Product implements IProduct { diff --git a/src/components/catalog/common/ProductTypeEnum.ts b/src/components/catalog/common/ProductTypeEnum.ts deleted file mode 100644 index 75257e55..00000000 --- a/src/components/catalog/common/ProductTypeEnum.ts +++ /dev/null @@ -1,11 +0,0 @@ -export class ProductTypeEnum -{ - public static WALL: string = 'i'; - public static FLOOR: string = 's'; - public static EFFECT: string = 'e'; - public static HABBO_CLUB: string = 'h'; - public static BADGE: string = 'b'; - public static GAME_TOKEN: string = 'GAME_TOKEN'; - public static PET: string = 'p'; - public static ROBOT: string = 'r'; -} \ No newline at end of file diff --git a/src/components/catalog/views/gift/CatalogGiftView.tsx b/src/components/catalog/views/gift/CatalogGiftView.tsx index 2da5ee13..60450658 100644 --- a/src/components/catalog/views/gift/CatalogGiftView.tsx +++ b/src/components/catalog/views/gift/CatalogGiftView.tsx @@ -2,12 +2,11 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { PurchaseFromCatalogAsGiftComposer } from '@nitrots/nitro-renderer'; import classNames from 'classnames'; import { FC, useCallback, useEffect, useMemo, useState } from 'react'; -import { GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../../api'; +import { GetSessionDataManager, LocalizeText, ProductTypeEnum, SendMessageComposer } from '../../../../api'; import { Base, Button, ButtonGroup, Column, Flex, FormGroup, LayoutCurrencyIcon, LayoutFurniImageView, LayoutGiftTagView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { CatalogEvent, CatalogInitGiftEvent, CatalogPurchasedEvent } from '../../../../events'; import { BatchUpdates, UseUiEvent } from '../../../../hooks'; import { useCatalogContext } from '../../CatalogContext'; -import { ProductTypeEnum } from '../../common/ProductTypeEnum'; export const CatalogGiftView: FC<{}> = props => { diff --git a/src/components/catalog/views/page/common/CatalogGridOfferView.tsx b/src/components/catalog/views/page/common/CatalogGridOfferView.tsx index e912d06e..fa8d3e28 100644 --- a/src/components/catalog/views/page/common/CatalogGridOfferView.tsx +++ b/src/components/catalog/views/page/common/CatalogGridOfferView.tsx @@ -1,5 +1,6 @@ import { FC, useMemo } from 'react'; -import { LayoutGridItem, LayoutGridItemProps } from '../../../../../common/layout/LayoutGridItem'; +import { ProductTypeEnum } from '../../../../../api'; +import { LayoutAvatarImageView, LayoutGridItem, LayoutGridItemProps } from '../../../../../common'; import { IPurchasableOffer } from '../../../common/IPurchasableOffer'; import { Offer } from '../../../common/Offer'; @@ -26,5 +27,10 @@ export const CatalogGridOfferView: FC = props => if(!product) return null; - return ; + return ( + + { (offer.product.productType === ProductTypeEnum.ROBOT) && + } + + ); } diff --git a/src/components/catalog/views/page/layout/CatalogLayoutDefaultView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutDefaultView.tsx index c47584d1..8aa7a913 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutDefaultView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutDefaultView.tsx @@ -1,9 +1,5 @@ import { FC } from 'react'; -import { Base } from '../../../../../common/Base'; -import { Column } from '../../../../../common/Column'; -import { Flex } from '../../../../../common/Flex'; -import { Grid } from '../../../../../common/Grid'; -import { Text } from '../../../../../common/Text'; +import { Base, Column, Flex, Grid, Text } from '../../../../../common'; import { useCatalogContext } from '../../../CatalogContext'; import { CatalogAddOnBadgeWidgetView } from '../widgets/CatalogAddOnBadgeWidgetView'; import { CatalogItemGridWidgetView } from '../widgets/CatalogItemGridWidgetView'; diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx index 3e2719a4..77baecf2 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx @@ -1,11 +1,6 @@ import { FC, useCallback, useMemo } from 'react'; -import { LocalizeText } from '../../../../../../api'; -import { LayoutFurniIconImageView } from '../../../../../../common'; -import { Button } from '../../../../../../common/Button'; -import { Column } from '../../../../../../common/Column'; -import { LayoutGridItem } from '../../../../../../common/layout/LayoutGridItem'; -import { Text } from '../../../../../../common/Text'; -import { ProductTypeEnum } from '../../../../common/ProductTypeEnum'; +import { LocalizeText, ProductTypeEnum } from '../../../../../../api'; +import { Button, Column, LayoutFurniIconImageView, LayoutGridItem, Text } from '../../../../../../common'; import { MarketplaceOfferData } from './common/MarketplaceOfferData'; import { MarketPlaceOfferState } from './common/MarketplaceOfferState'; diff --git a/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx b/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx index 1e6475e7..4eedab20 100644 --- a/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx @@ -1,12 +1,11 @@ import { GetMarketplaceConfigurationMessageComposer, MakeOfferMessageComposer, MarketplaceConfigurationEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../../../api'; +import { LocalizeText, NotificationUtilities, ProductTypeEnum, SendMessageComposer } from '../../../../../../api'; import { Base, Button, Column, Grid, LayoutFurniImageView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../../common'; import { CatalogPostMarketplaceOfferEvent } from '../../../../../../events'; import { UseMessageEventHook, UseUiEvent } from '../../../../../../hooks'; import { FurnitureItem } from '../../../../../inventory/common/FurnitureItem'; import { useCatalogContext } from '../../../../CatalogContext'; -import { ProductTypeEnum } from '../../../../common/ProductTypeEnum'; export const MarketplacePostOfferView : FC<{}> = props => { diff --git a/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx index 93ae4540..a042853b 100644 --- a/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx @@ -1,8 +1,8 @@ import { FC } from 'react'; -import { AutoGrid, AutoGridProps } from '../../../../../common/AutoGrid'; +import { ProductTypeEnum } from '../../../../../api'; +import { AutoGrid, AutoGridProps } from '../../../../../common'; import { useCatalogContext } from '../../../CatalogContext'; import { IPurchasableOffer } from '../../../common/IPurchasableOffer'; -import { ProductTypeEnum } from '../../../common/ProductTypeEnum'; import { CatalogGridOfferView } from '../common/CatalogGridOfferView'; interface CatalogItemGridWidgetViewProps extends AutoGridProps diff --git a/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx index 8ade2a26..eb6ae3eb 100644 --- a/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx @@ -1,13 +1,10 @@ import { FC, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../../api'; -import { AutoGrid, AutoGridProps } from '../../../../../common/AutoGrid'; -import { Button } from '../../../../../common/Button'; -import { ButtonGroup } from '../../../../../common/ButtonGroup'; +import { LocalizeText, ProductTypeEnum } from '../../../../../api'; +import { AutoGrid, AutoGridProps, Button, ButtonGroup } from '../../../../../common'; import { BatchUpdates } from '../../../../../hooks'; import { useCatalogContext } from '../../../CatalogContext'; import { IPurchasableOffer } from '../../../common/IPurchasableOffer'; import { Offer } from '../../../common/Offer'; -import { ProductTypeEnum } from '../../../common/ProductTypeEnum'; import { CatalogGridOfferView } from '../common/CatalogGridOfferView'; interface CatalogSpacesWidgetViewProps extends AutoGridProps diff --git a/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx index f6a709af..27e21c23 100644 --- a/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx @@ -1,11 +1,10 @@ import { Vector3d } from '@nitrots/nitro-renderer'; import { FC, useEffect } from 'react'; -import { GetAvatarRenderManager, GetSessionDataManager } from '../../../../../api'; +import { GetAvatarRenderManager, GetSessionDataManager, ProductTypeEnum } from '../../../../../api'; import { AutoGrid, Column, LayoutGridItem, LayoutRoomPreviewerView } from '../../../../../common'; import { useCatalogContext } from '../../../CatalogContext'; import { FurniCategory } from '../../../common/FurniCategory'; import { Offer } from '../../../common/Offer'; -import { ProductTypeEnum } from '../../../common/ProductTypeEnum'; export const CatalogViewProductWidgetView: FC<{}> = props => { diff --git a/src/components/room/widgets/furniture/gift-opening/FurnitureGiftOpeningView.tsx b/src/components/room/widgets/furniture/gift-opening/FurnitureGiftOpeningView.tsx index 2cd425a7..da7792cf 100644 --- a/src/components/room/widgets/furniture/gift-opening/FurnitureGiftOpeningView.tsx +++ b/src/components/room/widgets/furniture/gift-opening/FurnitureGiftOpeningView.tsx @@ -1,10 +1,9 @@ import { RoomObjectCategory, RoomObjectOperationType } from '@nitrots/nitro-renderer'; import { FC, useCallback, useMemo, useState } from 'react'; -import { CreateLinkEvent, GetRoomEngine, GetSessionDataManager, LocalizeText, RoomWidgetPresentOpenMessage, RoomWidgetUpdatePresentDataEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api'; +import { CreateLinkEvent, GetRoomEngine, GetSessionDataManager, LocalizeText, ProductTypeEnum, RoomWidgetPresentOpenMessage, RoomWidgetUpdatePresentDataEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api'; import { Button, Column, Flex, LayoutGiftTagView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../common'; import { BatchUpdates } from '../../../../../hooks'; import { UseEventDispatcherHook } from '../../../../../hooks/events/UseEventDispatcherHook'; -import { ProductTypeEnum } from '../../../../catalog/common/ProductTypeEnum'; import { useRoomContext } from '../../../RoomContext'; const FLOOR: string = 'floor';