mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
Marketplace updates
This commit is contained in:
parent
2b9f6b5634
commit
548c6528b4
19
src/api/catalog/GetImageIconUrlForProduct.ts
Normal file
19
src/api/catalog/GetImageIconUrlForProduct.ts
Normal file
@ -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;
|
||||
}
|
@ -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';
|
||||
|
@ -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<LayoutFurniIconImageViewProps> = 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 <LayoutImage imageUrl={ getImageIconUrl() } className="furni-image" { ...rest } />;
|
||||
return <LayoutImage imageUrl={ GetImageIconUrlForProduct(productType, productClassId, extraData) } className="furni-image" { ...rest } />;
|
||||
}
|
||||
|
@ -49,14 +49,14 @@ export const LayoutGridItem: FC<LayoutGridItemProps> = 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 (
|
||||
<Column center={ center } pointer position={ position } overflow={ overflow } column={ column } classNames={ getClassNames } style={ getStyle } { ...rest }>
|
||||
|
@ -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<MarketplaceItemViewProps> = pr
|
||||
|
||||
return (
|
||||
<LayoutGridItem shrink center={ false } column={ false } alignItems="center" className="p-1">
|
||||
<LayoutFurniIconImageView productType={ offerData.furniType === MarketplaceOfferData.TYPE_FLOOR ? ProductTypeEnum.FLOOR : ProductTypeEnum.WALL } productClassId={ offerData.furniId } extraData={ offerData.extraData } style={ { width: 50, height: 50 } } />
|
||||
<Column style={ { width: 40, height: 40 } }>
|
||||
<LayoutGridItem column={ false } itemImage={ GetImageIconUrlForProduct(((offerData.furniType === MarketplaceOfferData.TYPE_FLOOR) ? ProductTypeEnum.FLOOR : ProductTypeEnum.WALL), offerData.furniId, offerData.extraData) } itemUniqueNumber={ offerData.stuffData.uniqueNumber } />
|
||||
</Column>
|
||||
<Column grow gap={ 0 }>
|
||||
<Text fontWeight="bold">{ getMarketplaceOfferTitle }</Text>
|
||||
{ (type === OWN_OFFER) &&
|
||||
@ -59,7 +61,7 @@ export const CatalogLayoutMarketplaceItemView: FC<MarketplaceItemViewProps> = pr
|
||||
</> }
|
||||
{ (type === PUBLIC_OFFER) &&
|
||||
<>
|
||||
<Text>{ LocalizeText('catalog.marketplace.offer.price_public_item', [ 'price', 'average' ], [ offerData.price.toString(), offerData.averagePrice.toString() ]) }</Text>
|
||||
<Text>{ LocalizeText('catalog.marketplace.offer.price_public_item', [ 'price', 'average' ], [ offerData.price.toString(), ((offerData.averagePrice > 0) ? offerData.averagePrice.toString() : '-') ]) }</Text>
|
||||
<Text>{ LocalizeText('catalog.marketplace.offer_count', [ 'count' ], [ offerData.offerCount.toString() ]) }</Text>
|
||||
</> }
|
||||
</Column>
|
||||
|
@ -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<NavigatorRoomLinkViewProps> = props =>
|
||||
<Column>
|
||||
<Text bold fontSize={ 5 }>{ LocalizeText('navigator.embed.headline') }</Text>
|
||||
<Text>{ LocalizeText('navigator.embed.info') }</Text>
|
||||
<input type="text" readOnly className="form-control form-control-sm" value={ LocalizeText('navigator.embed.src', [ 'roomId' ], [ navigatorData.enteredGuestRoom.roomId.toString() ]) } />
|
||||
<input type="text" readOnly className="form-control form-control-sm" value={ LocalizeText('navigator.embed.src', [ 'roomId' ], [ navigatorData.enteredGuestRoom.roomId.toString() ]).replace('${url.prefix}', GetConfiguration<string>('url.prefix', '')) } />
|
||||
</Column>
|
||||
</Flex>
|
||||
</NitroCardContentView>
|
||||
|
Loading…
Reference in New Issue
Block a user