diff --git a/src/api/catalog/GetImageIconUrlForProduct.ts b/src/api/catalog/GetImageIconUrlForProduct.ts new file mode 100644 index 00000000..1e8d8c0b --- /dev/null +++ b/src/api/catalog/GetImageIconUrlForProduct.ts @@ -0,0 +1,19 @@ +import { GetRoomEngine } from '../nitro'; +import { ProductTypeEnum } from './ProductTypeEnum'; + +export const GetImageIconUrlForProduct = (productType: string, productClassId: number, extraData: string = null) => +{ + let imageUrl: string = null; + + switch(productType.toLocaleLowerCase()) + { + case ProductTypeEnum.FLOOR: + imageUrl = GetRoomEngine().getFurnitureFloorIconUrl(productClassId); + break; + case ProductTypeEnum.WALL: + imageUrl = GetRoomEngine().getFurnitureWallIconUrl(productClassId, extraData); + break; + } + + return imageUrl; +} diff --git a/src/api/catalog/index.ts b/src/api/catalog/index.ts index ba084bc8..5b2bde35 100644 --- a/src/api/catalog/index.ts +++ b/src/api/catalog/index.ts @@ -7,6 +7,7 @@ export * from './CatalogPurchaseState'; export * from './CatalogType'; export * from './CatalogUtilities'; export * from './FurnitureOffer'; +export * from './GetImageIconUrlForProduct'; export * from './GiftWrappingConfiguration'; export * from './ICatalogNode'; export * from './ICatalogOptions'; diff --git a/src/common/layout/LayoutFurniIconImageView.tsx b/src/common/layout/LayoutFurniIconImageView.tsx index 21bb7601..b1191dbd 100644 --- a/src/common/layout/LayoutFurniIconImageView.tsx +++ b/src/common/layout/LayoutFurniIconImageView.tsx @@ -1,6 +1,6 @@ import { FC } from 'react'; import { LayoutImage, LayoutImageProps } from '.'; -import { GetRoomEngine, ProductTypeEnum } from '../../api'; +import { GetImageIconUrlForProduct } from '../../api'; interface LayoutFurniIconImageViewProps extends LayoutImageProps { @@ -13,22 +13,5 @@ export const LayoutFurniIconImageView: FC = props { const { productType = 's', productClassId = -1, extraData = '', ...rest } = props; - const getImageIconUrl = () => - { - let imageUrl: string = null; - - switch(productType.toLocaleLowerCase()) - { - case ProductTypeEnum.FLOOR: - imageUrl = GetRoomEngine().getFurnitureFloorIconUrl(productClassId); - break; - case ProductTypeEnum.WALL: - imageUrl = GetRoomEngine().getFurnitureWallIconUrl(productClassId, extraData); - break; - } - - return imageUrl; - } - - return ; + return ; } diff --git a/src/common/layout/LayoutGridItem.tsx b/src/common/layout/LayoutGridItem.tsx index 0a630d00..e1a32e5a 100644 --- a/src/common/layout/LayoutGridItem.tsx +++ b/src/common/layout/LayoutGridItem.tsx @@ -49,14 +49,14 @@ export const LayoutGridItem: FC = props => { let newStyle = { ...style }; - if(itemImage) newStyle.backgroundImage = `url(${ itemImage })`; + if(itemImage && !(itemUniqueSoldout || (itemUniqueNumber > 0))) newStyle.backgroundImage = `url(${ itemImage })`; if(itemColor) newStyle.backgroundColor = itemColor; if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; return newStyle; - }, [ style, itemImage, itemColor ]); + }, [ style, itemImage, itemColor, itemUniqueSoldout, itemUniqueNumber ]); return ( diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx index 22d7dfd9..d5441fbd 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx @@ -1,6 +1,6 @@ import { FC, useCallback, useMemo } from 'react'; -import { LocalizeText, ProductTypeEnum } from '../../../../../../api'; -import { Button, Column, LayoutFurniIconImageView, LayoutGridItem, Text } from '../../../../../../common'; +import { GetImageIconUrlForProduct, LocalizeText, ProductTypeEnum } from '../../../../../../api'; +import { Button, Column, LayoutGridItem, Text } from '../../../../../../common'; import { MarketplaceOfferData } from './common/MarketplaceOfferData'; import { MarketPlaceOfferState } from './common/MarketplaceOfferState'; @@ -49,7 +49,9 @@ export const CatalogLayoutMarketplaceItemView: FC = pr return ( - + + + { getMarketplaceOfferTitle } { (type === OWN_OFFER) && @@ -59,7 +61,7 @@ export const CatalogLayoutMarketplaceItemView: FC = pr } { (type === PUBLIC_OFFER) && <> - { LocalizeText('catalog.marketplace.offer.price_public_item', [ 'price', 'average' ], [ offerData.price.toString(), offerData.averagePrice.toString() ]) } + { LocalizeText('catalog.marketplace.offer.price_public_item', [ 'price', 'average' ], [ offerData.price.toString(), ((offerData.averagePrice > 0) ? offerData.averagePrice.toString() : '-') ]) } { LocalizeText('catalog.marketplace.offer_count', [ 'count' ], [ offerData.offerCount.toString() ]) } } diff --git a/src/components/navigator/views/NavigatorRoomLinkView.tsx b/src/components/navigator/views/NavigatorRoomLinkView.tsx index 62bb619f..a09da832 100644 --- a/src/components/navigator/views/NavigatorRoomLinkView.tsx +++ b/src/components/navigator/views/NavigatorRoomLinkView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { LocalizeText } from '../../../api'; +import { GetConfiguration, LocalizeText } from '../../../api'; import { Column, Flex, LayoutRoomThumbnailView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common'; import { useNavigatorContext } from '../NavigatorContext'; @@ -24,7 +24,7 @@ export const NavigatorRoomLinkView: FC = props => { LocalizeText('navigator.embed.headline') } { LocalizeText('navigator.embed.info') } - + ('url.prefix', '')) } />