add club gift layout

This commit is contained in:
dank074 2022-01-05 15:12:29 -06:00
parent 59e972ffc9
commit 747a191256
5 changed files with 60 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPublishedMessageEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, SellablePetPalettesMessageEvent, UserSubscriptionEvent } from '@nitrots/nitro-renderer'; import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPublishedMessageEvent, ClubGiftInfoEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, SellablePetPalettesMessageEvent, UserSubscriptionEvent } from '@nitrots/nitro-renderer';
import { GuildMembershipsMessageEvent } from '@nitrots/nitro-renderer/src/nitro/communication/messages/incoming/user/GuildMembershipsMessageEvent'; import { GuildMembershipsMessageEvent } from '@nitrots/nitro-renderer/src/nitro/communication/messages/incoming/user/GuildMembershipsMessageEvent';
import { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import { CatalogNameResultEvent, CatalogPurchaseFailureEvent } from '../../events'; import { CatalogNameResultEvent, CatalogPurchaseFailureEvent } from '../../events';
@ -164,6 +164,20 @@ export const CatalogMessageHandler: FC<CatalogMessageHandlerProps> = props =>
}); });
}, [ dispatchCatalogState ]); }, [ dispatchCatalogState ]);
const onClubGiftInfoEvent = useCallback((event: ClubGiftInfoEvent) =>
{
const parser = event.getParser();
if(!parser) return;
dispatchCatalogState({
type: CatalogActions.SET_CLUB_GIFTS,
payload: {
clubGifts: parser
}
});
}, [dispatchCatalogState]);
CreateMessageHook(CatalogPagesListEvent, onCatalogPagesListEvent); CreateMessageHook(CatalogPagesListEvent, onCatalogPagesListEvent);
CreateMessageHook(CatalogPageMessageEvent, onCatalogPageMessageEvent); CreateMessageHook(CatalogPageMessageEvent, onCatalogPageMessageEvent);
CreateMessageHook(PurchaseOKMessageEvent, onPurchaseOKMessageEvent); CreateMessageHook(PurchaseOKMessageEvent, onPurchaseOKMessageEvent);
@ -179,6 +193,7 @@ export const CatalogMessageHandler: FC<CatalogMessageHandlerProps> = props =>
CreateMessageHook(UserSubscriptionEvent, onUserSubscriptionEvent); CreateMessageHook(UserSubscriptionEvent, onUserSubscriptionEvent);
CreateMessageHook(CatalogPublishedMessageEvent, onCatalogPublishedMessageEvent); CreateMessageHook(CatalogPublishedMessageEvent, onCatalogPublishedMessageEvent);
CreateMessageHook(GiftWrappingConfigurationEvent, onGiftWrappingConfigurationEvent); CreateMessageHook(GiftWrappingConfigurationEvent, onGiftWrappingConfigurationEvent);
CreateMessageHook(ClubGiftInfoEvent, onClubGiftInfoEvent);
return null; return null;
} }

View File

@ -1,4 +1,4 @@
import { CatalogPageMessageOfferData, CatalogPageMessageParser, ClubOfferData, GiftWrappingConfigurationParser, INodeData } from '@nitrots/nitro-renderer'; import { CatalogPageMessageOfferData, CatalogPageMessageParser, ClubGiftInfoParser, ClubOfferData, GiftWrappingConfigurationParser, INodeData } from '@nitrots/nitro-renderer';
import { HabboGroupEntryData } from '@nitrots/nitro-renderer/src/nitro/communication/messages/parser/user/HabboGroupEntryData'; import { HabboGroupEntryData } from '@nitrots/nitro-renderer/src/nitro/communication/messages/parser/user/HabboGroupEntryData';
import { Reducer } from 'react'; import { Reducer } from 'react';
import { CatalogPetPalette } from '../common/CatalogPetPalette'; import { CatalogPetPalette } from '../common/CatalogPetPalette';
@ -17,6 +17,7 @@ export interface ICatalogState
groups: HabboGroupEntryData[]; groups: HabboGroupEntryData[];
petPalettes: CatalogPetPalette[]; petPalettes: CatalogPetPalette[];
clubOffers: ClubOfferData[]; clubOffers: ClubOfferData[];
clubGifts: ClubGiftInfoParser;
subscriptionInfo: SubscriptionInfo; subscriptionInfo: SubscriptionInfo;
giftConfiguration: GiftWrappingConfiguration; giftConfiguration: GiftWrappingConfiguration;
} }
@ -34,6 +35,7 @@ export interface ICatalogAction
groups?: HabboGroupEntryData[]; groups?: HabboGroupEntryData[];
petPalette?: CatalogPetPalette; petPalette?: CatalogPetPalette;
clubOffers?: ClubOfferData[]; clubOffers?: ClubOfferData[];
clubGifts?: ClubGiftInfoParser;
subscriptionInfo?: SubscriptionInfo; subscriptionInfo?: SubscriptionInfo;
giftConfiguration?: GiftWrappingConfigurationParser; giftConfiguration?: GiftWrappingConfigurationParser;
} }
@ -52,6 +54,7 @@ export class CatalogActions
public static SET_SEARCH_RESULT: string = 'CA_SET_SEARCH_RESULT'; public static SET_SEARCH_RESULT: string = 'CA_SET_SEARCH_RESULT';
public static SET_SUBSCRIPTION_INFO: string = 'CA_SET_SUBSCRIPTION_INFO'; public static SET_SUBSCRIPTION_INFO: string = 'CA_SET_SUBSCRIPTION_INFO';
public static SET_GIFT_CONFIGURATION: string = 'CA_SET_GIFT_CONFIGURATION'; public static SET_GIFT_CONFIGURATION: string = 'CA_SET_GIFT_CONFIGURATION';
public static SET_CLUB_GIFTS: string = 'CA_SET_CLUB_GIFTS';
} }
export const initialCatalog: ICatalogState = { export const initialCatalog: ICatalogState = {
@ -64,6 +67,7 @@ export const initialCatalog: ICatalogState = {
groups: [], groups: [],
petPalettes: [], petPalettes: [],
clubOffers: null, clubOffers: null,
clubGifts: null,
subscriptionInfo: new SubscriptionInfo(), subscriptionInfo: new SubscriptionInfo(),
giftConfiguration: null giftConfiguration: null
} }
@ -160,6 +164,11 @@ export const CatalogReducer: Reducer<ICatalogState, ICatalogAction> = (state, ac
return { ...state, giftConfiguration }; return { ...state, giftConfiguration };
} }
case CatalogActions.SET_CLUB_GIFTS: {
const clubGifts = (action.payload.clubGifts || state.clubGifts || null);
return { ...state, clubGifts };
}
default: default:
return state; return state;
} }

View File

@ -1,5 +1,6 @@
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';
@ -13,6 +14,7 @@ import { CatalogLayoutSingleBundleView } from './single-bundle/CatalogLayoutSing
import { CatalogLayoutSpacesView } from './spaces-new/CatalogLayoutSpacesView'; import { CatalogLayoutSpacesView } from './spaces-new/CatalogLayoutSpacesView';
import { CatalogLayoutTrophiesView } from './trophies/CatalogLayoutTrophiesView'; import { CatalogLayoutTrophiesView } from './trophies/CatalogLayoutTrophiesView';
import { CatalogLayoutVipBuyView } from './vip-buy/CatalogLayoutVipBuyView'; import { CatalogLayoutVipBuyView } from './vip-buy/CatalogLayoutVipBuyView';
import { CatalogLayoutVipGiftsView } from './vip-gifts/CatalogLayoutVipGiftsView';
export const GetCatalogLayout = (pageParser: CatalogPageMessageParser, roomPreviewer: RoomPreviewer) => export const GetCatalogLayout = (pageParser: CatalogPageMessageParser, roomPreviewer: RoomPreviewer) =>
{ {
@ -39,7 +41,7 @@ export const GetCatalogLayout = (pageParser: CatalogPageMessageParser, roomPrevi
case 'search_results': case 'search_results':
return null; return null;
case 'club_gifts': case 'club_gifts':
return null; return <CatalogLayoutVipGiftsView roomPreviewer={ roomPreviewer } pageParser={ pageParser } />;
case 'marketplace_own_items': case 'marketplace_own_items':
return null; return null;
case 'marketplace': case 'marketplace':
@ -54,6 +56,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':
return <CatalogLayoutColorGroupingView roomPreviewer={roomPreviewer} pageParser={ pageParser } />;
case 'bots': case 'bots':
case 'default_3x3': case 'default_3x3':
default: default:

View File

@ -0,0 +1,12 @@
import { FC } from 'react';
import { CatalogLayoutProps } from '../CatalogLayout.types';
export interface CatalogLayoutColorGroupViewProps extends CatalogLayoutProps
{
}
export const CatalogLayoutColorGroupingView : FC<CatalogLayoutColorGroupViewProps> = props =>
{
return null;
}

View File

@ -0,0 +1,17 @@
import { FC } from 'react';
import { NitroCardGridView } from '../../../../../../layout';
import { CatalogLayoutProps } from '../CatalogLayout.types';
export interface CatalogLayoutVipGiftsViewProps extends CatalogLayoutProps
{
}
export const CatalogLayoutVipGiftsView: FC<CatalogLayoutVipGiftsViewProps> = props =>
{
return (
<NitroCardGridView columns={1} className='text-black'>
</NitroCardGridView>
)
}