Merge pull request #52 from billsonnn/feature/vip-gifts

Feature/vip gifts
This commit is contained in:
Bill 2022-01-07 03:10:33 -05:00 committed by GitHub
commit 343600ef93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 90 additions and 13 deletions

View File

@ -1,6 +1,5 @@
import { CatalogPageMessageParser, RoomPreviewer } from '@nitrots/nitro-renderer'; import { CatalogPageMessageParser, RoomPreviewer } from '@nitrots/nitro-renderer';
import { CatalogLayoutBadgeDisplayView } from './badge-display/CatalogLayoutBadgeDisplayView'; import { CatalogLayoutBadgeDisplayView } from './badge-display/CatalogLayoutBadgeDisplayView';
import { CatalogLayoutColorGroupingView } from './color-grouping/CatalogLayoutColorGroupingView';
import { CatalogLayoutDefaultView } from './default/CatalogLayoutDefaultView'; import { CatalogLayoutDefaultView } from './default/CatalogLayoutDefaultView';
import { CatalogLayoutFrontpage4View } from './frontpage4/CatalogLayoutFrontpage4View'; import { CatalogLayoutFrontpage4View } from './frontpage4/CatalogLayoutFrontpage4View';
import { CatalogLayouGuildCustomFurniView } from './guild-custom-furni/CatalogLayoutGuildCustomFurniView'; import { CatalogLayouGuildCustomFurniView } from './guild-custom-furni/CatalogLayoutGuildCustomFurniView';
@ -58,8 +57,8 @@ export const GetCatalogLayout = (pageParser: CatalogPageMessageParser, roomPrevi
return <CatalogLayoutInfoLoyaltyView roomPreviewer={ roomPreviewer } pageParser={ pageParser } />; return <CatalogLayoutInfoLoyaltyView roomPreviewer={ roomPreviewer } pageParser={ pageParser } />;
case 'badge_display': case 'badge_display':
return <CatalogLayoutBadgeDisplayView roomPreviewer={roomPreviewer} pageParser={ pageParser } />; return <CatalogLayoutBadgeDisplayView roomPreviewer={roomPreviewer} pageParser={ pageParser } />;
case 'default_3x3_color_grouping': //case 'default_3x3_color_grouping':
return <CatalogLayoutColorGroupingView roomPreviewer={roomPreviewer} pageParser={ pageParser } />; //return <CatalogLayoutColorGroupingView roomPreviewer={roomPreviewer} pageParser={ pageParser } />;
case 'bots': case 'bots':
case 'default_3x3': case 'default_3x3':
default: default:

View File

@ -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'; import { CatalogLayoutProps } from '../CatalogLayout.types';
export interface CatalogLayoutColorGroupViewProps extends CatalogLayoutProps export interface CatalogLayoutColorGroupViewProps extends CatalogLayoutProps
@ -8,5 +13,79 @@ export interface CatalogLayoutColorGroupViewProps extends CatalogLayoutProps
export const CatalogLayoutColorGroupingView : FC<CatalogLayoutColorGroupViewProps> = props => 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>
);
} }

View File

@ -39,7 +39,7 @@ export const HelpMessageHandler: FC<{}> = props =>
{ {
const parser = event.getParser(); 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')); NotificationUtilities.simpleAlert(message, NotificationAlertType.MODERATION, null, null, LocalizeText('mod.alert.title'));
}, []); }, []);

View File

@ -35,7 +35,7 @@ export const HelpIndexView: FC<{}> = props =>
</div> </div>
<div className="d-grid gap-2 col-8 mx-auto"> <div className="d-grid gap-2 col-8 mx-auto">
<button className="btn btn-link" type="button" onClick={onRequestMySanctionStatusClick}>{LocalizeText('help.main.my.sanction.status')}</button> <button className="btn btn-link text-primary fw-bold" type="button" onClick={onRequestMySanctionStatusClick}>{LocalizeText('help.main.my.sanction.status')}</button>
</div> </div>
</> </>

View File

@ -88,7 +88,6 @@ export const ModToolsRoomView: FC<ModToolsRoomViewProps> = props =>
<div> <div>
<b>Owner in room:</b> { ownerInRoom ? 'Yes' : 'No' } <b>Owner in room:</b> { ownerInRoom ? 'Yes' : 'No' }
</div> </div>
<button className="btn btn-sm btn-primary">Edit in HK</button>
</div> </div>
<div className="bg-muted rounded py-1 px-2 mb-2"> <div className="bg-muted rounded py-1 px-2 mb-2">
<div className="form-check"> <div className="form-check">

View File

@ -49,8 +49,8 @@ export const IssueInfoView: FC<IssueInfoViewProps> = props =>
<div><span className="fw-bold">Source: </span>{getSourceName(ticket.categoryId)}</div> <div><span className="fw-bold">Source: </span>{getSourceName(ticket.categoryId)}</div>
<div><span className="fw-bold">Category: </span>{LocalizeText('help.cfh.topic.' + ticket.reportedCategoryId)}</div> <div><span className="fw-bold">Category: </span>{LocalizeText('help.cfh.topic.' + ticket.reportedCategoryId)}</div>
<div><span className="fw-bold">Description: </span>{ticket.message}</div> <div><span className="fw-bold">Description: </span>{ticket.message}</div>
<div><span className="fw-bold">Caller: </span><button className="btn btn-link fw-bold" onClick={() => openUserInfo(ticket.reporterUserId)}>{ticket.reporterUserName}</button></div> <div><span className="fw-bold">Caller: </span><button className="btn btn-link fw-bold text-primary" onClick={() => openUserInfo(ticket.reporterUserId)}>{ticket.reporterUserName}</button></div>
<div><span className="fw-bold">Reported User: </span><button className="btn btn-link fw-bold" onClick={() => openUserInfo(ticket.reportedUserId)}>{ticket.reportedUserName}</button></div> <div><span className="fw-bold">Reported User: </span><button className="btn btn-link fw-bold text-danger" onClick={() => openUserInfo(ticket.reportedUserId)}>{ticket.reportedUserName}</button></div>
</div> </div>
<div className="col-4"> <div className="col-4">
<div className="d-grid gap-2 mb-4"> <div className="d-grid gap-2 mb-4">

View File

@ -33,10 +33,10 @@ export const ModToolsUserRoomVisitsView: FC<ModToolsUserRoomVisitsViewProps> = p
const item = roomVisitData.rooms[props.index]; const item = roomVisitData.rooms[props.index];
return ( return (
<div style={props.style} key={props.key} className="row room-visit"> <div style={props.style} key={props.key} className="row room-visit align-items-center">
<div className="col-auto text-center">{item.enterHour.toString().padStart(2, '0')}:{item.enterMinute.toString().padStart(2, '0')}</div> <div className="col-auto text-center">{item.enterHour.toString().padStart(2, '0')}:{item.enterMinute.toString().padStart(2, '0')}</div>
<div className="col-7"><span className="fw-bold">Room: </span>{item.roomName}</div> <div className="col-7"><span className="fw-bold">Room: </span>{item.roomName}</div>
<button className="btn btn-sm btn-link col-auto fw-bold" onClick={() => TryVisitRoom(item.roomId)}>Visit Room</button> <button className="btn btn-sm btn-link col-auto fw-bold text-primary" onClick={() => TryVisitRoom(item.roomId)}>Visit Room</button>
</div>); </div>);
} }

View File

@ -80,7 +80,7 @@ export const NotificationCenterMessageHandler: FC<INotificationCenterMessageHand
break; break;
} }
NotificationUtilities.showSingleBubble(LocalizeText('notifications.text.loyalty.received', [ 'amount' ], [ parser.amountChanged.toString() ]), NotificationBubbleType.INFO, imageUrl); NotificationUtilities.showSingleBubble(LocalizeText('notifications.text.loyalty.received', [ 'AMOUNT' ], [ parser.amountChanged.toString() ]), NotificationBubbleType.INFO, imageUrl);
}, []); }, []);
CreateMessageHook(ActivityPointNotificationMessageEvent, onActivityPointNotificationMessageEvent); CreateMessageHook(ActivityPointNotificationMessageEvent, onActivityPointNotificationMessageEvent);