mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-18 21:36:27 +01:00
fix issue closed handler
This commit is contained in:
parent
1b4046e493
commit
e8ae9d76ed
@ -1,6 +1,5 @@
|
||||
import { CatalogPageMessageParser, RoomPreviewer } from '@nitrots/nitro-renderer';
|
||||
import { CatalogLayoutBadgeDisplayView } from './badge-display/CatalogLayoutBadgeDisplayView';
|
||||
import { CatalogLayoutColorGroupingView } from './color-grouping/CatalogLayoutColorGroupingView';
|
||||
import { CatalogLayoutDefaultView } from './default/CatalogLayoutDefaultView';
|
||||
import { CatalogLayoutFrontpage4View } from './frontpage4/CatalogLayoutFrontpage4View';
|
||||
import { CatalogLayouGuildCustomFurniView } from './guild-custom-furni/CatalogLayoutGuildCustomFurniView';
|
||||
@ -58,8 +57,8 @@ export const GetCatalogLayout = (pageParser: CatalogPageMessageParser, roomPrevi
|
||||
return <CatalogLayoutInfoLoyaltyView roomPreviewer={ roomPreviewer } pageParser={ pageParser } />;
|
||||
case 'badge_display':
|
||||
return <CatalogLayoutBadgeDisplayView roomPreviewer={roomPreviewer} pageParser={ pageParser } />;
|
||||
case 'default_3x3_color_grouping':
|
||||
return <CatalogLayoutColorGroupingView roomPreviewer={roomPreviewer} pageParser={ pageParser } />;
|
||||
//case 'default_3x3_color_grouping':
|
||||
//return <CatalogLayoutColorGroupingView roomPreviewer={roomPreviewer} pageParser={ pageParser } />;
|
||||
case 'bots':
|
||||
case 'default_3x3':
|
||||
default:
|
||||
|
@ -1,4 +1,9 @@
|
||||
import { FC } from 'react';
|
||||
import { CatalogPageMessageOfferData, IFurnitureData } from '@nitrots/nitro-renderer';
|
||||
import { FC, useMemo, useState } from 'react';
|
||||
import { GetSessionDataManager } from '../../../../../../api';
|
||||
import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout';
|
||||
import { ProductTypeEnum } from '../../../../common/ProductTypeEnum';
|
||||
import { CatalogPageOffersView } from '../../offers/CatalogPageOffersView';
|
||||
import { CatalogLayoutProps } from '../CatalogLayout.types';
|
||||
|
||||
export interface CatalogLayoutColorGroupViewProps extends CatalogLayoutProps
|
||||
@ -8,5 +13,79 @@ export interface CatalogLayoutColorGroupViewProps extends CatalogLayoutProps
|
||||
|
||||
export const CatalogLayoutColorGroupingView : FC<CatalogLayoutColorGroupViewProps> = props =>
|
||||
{
|
||||
return null;
|
||||
const { roomPreviewer = null, pageParser = null } = props;
|
||||
const [ colorableItems, setColorableItems ] = useState<Map<string, number[]>>(new Map<string, number[]>());
|
||||
|
||||
const offers = useMemo(() =>
|
||||
{
|
||||
const offers: CatalogPageMessageOfferData[] = [];
|
||||
const addedColorableItems = new Map<string, boolean>();
|
||||
|
||||
pageParser.offers.forEach(offer =>
|
||||
{
|
||||
const product = offer.products[0];
|
||||
if(!product) return;
|
||||
|
||||
let furniData: IFurnitureData = null;
|
||||
|
||||
if(product.productType === ProductTypeEnum.FLOOR)
|
||||
{
|
||||
furniData = GetSessionDataManager().getFloorItemData(product.furniClassId);
|
||||
}
|
||||
else if(product.productType === ProductTypeEnum.WALL)
|
||||
{
|
||||
furniData = GetSessionDataManager().getWallItemData(product.furniClassId);
|
||||
}
|
||||
|
||||
if(((!(furniData)) || ((furniData.fullName.indexOf('*') === -1))))
|
||||
{
|
||||
offers.push(offer);
|
||||
}
|
||||
else
|
||||
{
|
||||
const name = furniData.fullName.split('*')[0];
|
||||
const colorIndex = parseInt(furniData.fullName.split('*')[1]);
|
||||
|
||||
if(!colorableItems[name])
|
||||
{
|
||||
colorableItems[name] = [];
|
||||
}
|
||||
|
||||
let selectedColor = 0;
|
||||
if(furniData.colors)
|
||||
{
|
||||
for(let color of furniData.colors)
|
||||
{
|
||||
if(color !== 0xFFFFFF)
|
||||
{
|
||||
selectedColor = color;
|
||||
}
|
||||
}
|
||||
if(colorableItems[name].indexOf(selectedColor) === -1)
|
||||
{
|
||||
colorableItems[name][colorIndex] = selectedColor;
|
||||
}
|
||||
}
|
||||
|
||||
if(!addedColorableItems.has(name))
|
||||
{
|
||||
offers.push(offer);
|
||||
addedColorableItems.set(name, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log(colorableItems);
|
||||
return offers;
|
||||
}, [colorableItems, pageParser.offers]);
|
||||
|
||||
return (
|
||||
<NitroLayoutGrid>
|
||||
<NitroLayoutGridColumn size={ 7 }>
|
||||
<CatalogPageOffersView offers={ offers } />
|
||||
</NitroLayoutGridColumn>
|
||||
<NitroLayoutGridColumn size={ 5 }>
|
||||
|
||||
</NitroLayoutGridColumn>
|
||||
</NitroLayoutGrid>
|
||||
);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ export const HelpMessageHandler: FC<{}> = props =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
const message = LocalizeText('help.cfh.closed.' + GetCloseReasonKey(parser.closeReason))
|
||||
const message = parser.messageText.length === 0 ? LocalizeText('help.cfh.closed.' + GetCloseReasonKey(parser.closeReason)) : parser.messageText;
|
||||
|
||||
NotificationUtilities.simpleAlert(message, NotificationAlertType.MODERATION, null, null, LocalizeText('mod.alert.title'));
|
||||
}, []);
|
||||
|
Loading…
Reference in New Issue
Block a user