From f55664c15730f0f73505163f83cf63ecd6e40803 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 25 Aug 2021 23:06:42 -0400 Subject: [PATCH] Update catalog --- src/views/catalog/CatalogView.tsx | 10 +++---- src/views/catalog/common/CatalogUtilities.ts | 26 +++++++++---------- src/views/catalog/reducers/CatalogReducer.tsx | 21 ++++++++------- .../navigation/CatalogNavigationView.tsx | 4 +-- .../navigation/CatalogNavigationView.types.ts | 8 +++--- .../item/CatalogNavigationItemView.tsx | 4 +-- .../item/CatalogNavigationItemView.types.ts | 10 +++---- .../set/CatalogNavigationSetView.tsx | 4 +-- .../set/CatalogNavigationSetView.types.ts | 8 +++--- .../views/page/layout/CatalogLayout.types.ts | 4 +-- .../views/page/layout/GetCatalogLayout.tsx | 4 +-- .../views/search/CatalogSearchView.tsx | 6 ++--- .../views/badge/InventoryBadgeView.tsx | 1 - 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/views/catalog/CatalogView.tsx b/src/views/catalog/CatalogView.tsx index 325adf4d..95a2f1d9 100644 --- a/src/views/catalog/CatalogView.tsx +++ b/src/views/catalog/CatalogView.tsx @@ -1,4 +1,4 @@ -import { GetCatalogIndexComposer, GetCatalogPageComposer, GetGiftWrappingConfigurationComposer, ICatalogPageData, ILinkEventTracker, RoomPreviewer } from '@nitrots/nitro-renderer'; +import { GetCatalogIndexComposer, GetCatalogPageComposer, GetGiftWrappingConfigurationComposer, ILinkEventTracker, INodeData, RoomPreviewer } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useReducer, useState } from 'react'; import { AddEventLinkTracker, GetRoomEngine, LocalizeText, RemoveLinkEventTracker } from '../../api'; import { CatalogEvent } from '../../events'; @@ -18,10 +18,10 @@ export const CatalogView: FC = props => const [ isVisible, setIsVisible ] = useState(false); const [ roomPreviewer, setRoomPreviewer ] = useState(null); const [ pendingPageLookup, setPendingPageLookup ] = useState<{ value: string, isOffer: boolean }>(null); - const [ pendingTree, setPendingTree ] = useState(null); - const [ pendingOpenTree, setPendingOpenTree ] = useState(null); + const [ pendingTree, setPendingTree ] = useState(null); + const [ pendingOpenTree, setPendingOpenTree ] = useState(null); const [ catalogState, dispatchCatalogState ] = useReducer(CatalogReducer, initialCatalog); - const [ currentTab, setCurrentTab ] = useState(null); + const [ currentTab, setCurrentTab ] = useState(null); const { root = null, pageParser = null, activeOffer = null, searchResult = null } = catalogState; const saveActivePages = useCallback(() => @@ -124,7 +124,7 @@ export const CatalogView: FC = props => if(pendingPageLookup !== null || pendingOpenTree) { - let tree: ICatalogPageData[] = []; + let tree: INodeData[] = []; if(pendingPageLookup !== null) { diff --git a/src/views/catalog/common/CatalogUtilities.ts b/src/views/catalog/common/CatalogUtilities.ts index a45bb7a7..b9f455e4 100644 --- a/src/views/catalog/common/CatalogUtilities.ts +++ b/src/views/catalog/common/CatalogUtilities.ts @@ -1,14 +1,14 @@ -import { CatalogPageMessageOfferData, ICatalogPageData, ICatalogPageParser, IFurnitureData, SellablePetPaletteData } from '@nitrots/nitro-renderer'; +import { CatalogPageMessageOfferData, CatalogPageMessageParser, IFurnitureData, INodeData, SellablePetPaletteData } from '@nitrots/nitro-renderer'; import { GetConfiguration, GetProductDataForLocalization, GetRoomEngine } from '../../../api'; export interface ICatalogOffers { - [key: string]: ICatalogPageData[]; + [key: string]: INodeData[]; } export interface ICatalogSearchResult { - page: ICatalogPageData; + page: INodeData; furniture: IFurnitureData[]; } @@ -21,10 +21,10 @@ export function GetOfferName(offer: CatalogPageMessageOfferData): string return offer.localizationId; } -export function GetOfferNodes(offers: ICatalogOffers, offerId: number): ICatalogPageData[] +export function GetOfferNodes(offers: ICatalogOffers, offerId: number): INodeData[] { const pages = offers[offerId.toString()]; - const allowedPages: ICatalogPageData[] = []; + const allowedPages: INodeData[] = []; if(pages && pages.length) { @@ -39,7 +39,7 @@ export function GetOfferNodes(offers: ICatalogOffers, offerId: number): ICatalog return allowedPages; } -export function SetOffersToNodes(offers: ICatalogOffers, pageData: ICatalogPageData): void +export function SetOffersToNodes(offers: ICatalogOffers, pageData: INodeData): void { if(pageData.offerIds && pageData.offerIds.length) { @@ -66,7 +66,7 @@ export function SetOffersToNodes(offers: ICatalogOffers, pageData: ICatalogPageD } } -export function GetCatalogPageImage(page: ICatalogPageParser, index: number = 0): string +export function GetCatalogPageImage(page: CatalogPageMessageParser, index: number = 0): string { const imageName = page.localization.images && page.localization.images[index]; @@ -79,7 +79,7 @@ export function GetCatalogPageImage(page: ICatalogPageParser, index: number = 0) return assetUrl; } -export function GetCatalogPageText(page: ICatalogPageParser, index: number = 0): string +export function GetCatalogPageText(page: CatalogPageMessageParser, index: number = 0): string { let message = (page.localization.texts[index] || ''); @@ -150,7 +150,7 @@ export function GetPetAvailableColors(petIndex: number, palettes: SellablePetPal } } -export function GetCatalogPageTreeByName(page: ICatalogPageData, lookup: string, tree: ICatalogPageData[]) +export function GetCatalogPageTreeByName(page: INodeData, lookup: string, tree: INodeData[]) { if(page.pageName === lookup) return page; @@ -167,7 +167,7 @@ export function GetCatalogPageTreeByName(page: ICatalogPageData, lookup: string, } } -export function GetCatalogPageTreeById(page: ICatalogPageData, lookup: number, tree: ICatalogPageData[]) +export function GetCatalogPageTreeById(page: INodeData, lookup: number, tree: INodeData[]) { if(page.pageId === lookup) return page; @@ -184,7 +184,7 @@ export function GetCatalogPageTreeById(page: ICatalogPageData, lookup: number, t } } -export function GetCatalogPageTreeByOfferId(page: ICatalogPageData, lookup: number, tree: ICatalogPageData[]) +export function GetCatalogPageTreeByOfferId(page: INodeData, lookup: number, tree: INodeData[]) { if(page.offerIds.indexOf(lookup) >= 0) return page; @@ -201,9 +201,9 @@ export function GetCatalogPageTreeByOfferId(page: ICatalogPageData, lookup: numb } } -export function BuildCatalogPageTree(page: ICatalogPageData, lookup: string, isOffer: boolean = false) +export function BuildCatalogPageTree(page: INodeData, lookup: string, isOffer: boolean = false) { - const pageTree: ICatalogPageData[] = []; + const pageTree: INodeData[] = []; if(isOffer) { diff --git a/src/views/catalog/reducers/CatalogReducer.tsx b/src/views/catalog/reducers/CatalogReducer.tsx index 89888cc9..35b1daf3 100644 --- a/src/views/catalog/reducers/CatalogReducer.tsx +++ b/src/views/catalog/reducers/CatalogReducer.tsx @@ -1,4 +1,5 @@ -import { CatalogGroupData, CatalogPageMessageOfferData, ClubOfferData, GiftWrappingConfigurationParser, ICatalogPageData, ICatalogPageParser } from '@nitrots/nitro-renderer'; +import { CatalogPageMessageOfferData, CatalogPageMessageParser, ClubOfferData, GiftWrappingConfigurationParser, INodeData } from '@nitrots/nitro-renderer'; +import { HabboGroupEntryData } from '@nitrots/nitro-renderer/src/nitro/communication/messages/parser/user/HabboGroupEntryData'; import { Reducer } from 'react'; import { CatalogPetPalette } from '../common/CatalogPetPalette'; import { ICatalogOffers, ICatalogSearchResult, SetOffersToNodes } from '../common/CatalogUtilities'; @@ -7,13 +8,13 @@ import { SubscriptionInfo } from '../common/SubscriptionInfo'; export interface ICatalogState { - root: ICatalogPageData; + root: INodeData; offerRoot: ICatalogOffers; - currentTab: ICatalogPageData; - pageParser: ICatalogPageParser; + currentTab: INodeData; + pageParser: CatalogPageMessageParser; activeOffer: CatalogPageMessageOfferData; searchResult: ICatalogSearchResult; - groups: CatalogGroupData[]; + groups: HabboGroupEntryData[]; petPalettes: CatalogPetPalette[]; clubOffers: ClubOfferData[]; subscriptionInfo: SubscriptionInfo; @@ -24,13 +25,13 @@ export interface ICatalogAction { type: string; payload: { - root?: ICatalogPageData; + root?: INodeData; offerRoot?: ICatalogOffers; - currentTab?: ICatalogPageData; - pageParser?: ICatalogPageParser; + currentTab?: INodeData; + pageParser?: CatalogPageMessageParser; activeOffer?: CatalogPageMessageOfferData; searchResult?: ICatalogSearchResult; - groups?: CatalogGroupData[]; + groups?: HabboGroupEntryData[]; petPalette?: CatalogPetPalette; clubOffers?: ClubOfferData[]; subscriptionInfo?: SubscriptionInfo; @@ -88,7 +89,7 @@ export const CatalogReducer: Reducer = (state, ac return { ...state, currentTab, searchResult }; } case CatalogActions.SET_CATALOG_PAGE_PARSER: { - let pageParser = (Object.create(action.payload.pageParser) as ICatalogPageParser); + let pageParser = (Object.create(action.payload.pageParser) as CatalogPageMessageParser); let activeOffer = null; if(pageParser.layoutCode === 'single_bundle') diff --git a/src/views/catalog/views/navigation/CatalogNavigationView.tsx b/src/views/catalog/views/navigation/CatalogNavigationView.tsx index b5e0aadd..ac636961 100644 --- a/src/views/catalog/views/navigation/CatalogNavigationView.tsx +++ b/src/views/catalog/views/navigation/CatalogNavigationView.tsx @@ -1,10 +1,10 @@ -import { ICatalogPageData } from '@nitrots/nitro-renderer'; +import { INodeData } from '@nitrots/nitro-renderer'; import { FC, useEffect } from 'react'; import { CatalogSearchView } from '../search/CatalogSearchView'; import { CatalogNavigationViewProps } from './CatalogNavigationView.types'; import { CatalogNavigationSetView } from './set/CatalogNavigationSetView'; -export let ACTIVE_PAGES: ICatalogPageData[] = []; +export let ACTIVE_PAGES: INodeData[] = []; export const CatalogNavigationView: FC = props => { diff --git a/src/views/catalog/views/navigation/CatalogNavigationView.types.ts b/src/views/catalog/views/navigation/CatalogNavigationView.types.ts index 05e3fade..6e248f42 100644 --- a/src/views/catalog/views/navigation/CatalogNavigationView.types.ts +++ b/src/views/catalog/views/navigation/CatalogNavigationView.types.ts @@ -1,9 +1,9 @@ -import { ICatalogPageData } from '@nitrots/nitro-renderer'; +import { INodeData } from '@nitrots/nitro-renderer'; import { Dispatch, SetStateAction } from 'react'; export interface CatalogNavigationViewProps { - page: ICatalogPageData; - pendingTree: ICatalogPageData[]; - setPendingTree: Dispatch>; + page: INodeData; + pendingTree: INodeData[]; + setPendingTree: Dispatch>; } diff --git a/src/views/catalog/views/navigation/item/CatalogNavigationItemView.tsx b/src/views/catalog/views/navigation/item/CatalogNavigationItemView.tsx index 74f42bd1..42344628 100644 --- a/src/views/catalog/views/navigation/item/CatalogNavigationItemView.tsx +++ b/src/views/catalog/views/navigation/item/CatalogNavigationItemView.tsx @@ -1,4 +1,4 @@ -import { GetCatalogPageComposer, ICatalogPageData } from '@nitrots/nitro-renderer'; +import { GetCatalogPageComposer, INodeData } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import { SendMessageHook } from '../../../../../hooks/messages/message-event'; import { CatalogMode } from '../../../CatalogView.types'; @@ -12,7 +12,7 @@ export const CatalogNavigationItemView: FC = pro const { page = null, isActive = false, pendingTree = null, setPendingTree = null, setActiveChild = null } = props; const [ isExpanded, setIsExpanded ] = useState(false); - const select = useCallback((selectPage: ICatalogPageData, expand: boolean = false) => + const select = useCallback((selectPage: INodeData, expand: boolean = false) => { if(!selectPage) return; diff --git a/src/views/catalog/views/navigation/item/CatalogNavigationItemView.types.ts b/src/views/catalog/views/navigation/item/CatalogNavigationItemView.types.ts index 8ef4598e..455964fc 100644 --- a/src/views/catalog/views/navigation/item/CatalogNavigationItemView.types.ts +++ b/src/views/catalog/views/navigation/item/CatalogNavigationItemView.types.ts @@ -1,11 +1,11 @@ -import { ICatalogPageData } from '@nitrots/nitro-renderer'; +import { INodeData } from '@nitrots/nitro-renderer'; import { Dispatch, SetStateAction } from 'react'; export interface CatalogNavigationItemViewProps { - page: ICatalogPageData; + page: INodeData; isActive: boolean; - pendingTree: ICatalogPageData[]; - setPendingTree: Dispatch>; - setActiveChild: Dispatch>; + pendingTree: INodeData[]; + setPendingTree: Dispatch>; + setActiveChild: Dispatch>; } diff --git a/src/views/catalog/views/navigation/set/CatalogNavigationSetView.tsx b/src/views/catalog/views/navigation/set/CatalogNavigationSetView.tsx index 4c464e0c..966fbfd4 100644 --- a/src/views/catalog/views/navigation/set/CatalogNavigationSetView.tsx +++ b/src/views/catalog/views/navigation/set/CatalogNavigationSetView.tsx @@ -1,4 +1,4 @@ -import { ICatalogPageData } from '@nitrots/nitro-renderer'; +import { INodeData } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; import { CatalogNavigationItemView } from '../item/CatalogNavigationItemView'; import { CatalogNavigationSetViewProps } from './CatalogNavigationSetView.types'; @@ -6,7 +6,7 @@ import { CatalogNavigationSetViewProps } from './CatalogNavigationSetView.types' export const CatalogNavigationSetView: FC = props => { const { page = null, isFirstSet = false, pendingTree = null, setPendingTree = null } = props; - const [ activeChild, setActiveChild ] = useState(null); + const [ activeChild, setActiveChild ] = useState(null); useEffect(() => { diff --git a/src/views/catalog/views/navigation/set/CatalogNavigationSetView.types.ts b/src/views/catalog/views/navigation/set/CatalogNavigationSetView.types.ts index 99001cde..7f42bd83 100644 --- a/src/views/catalog/views/navigation/set/CatalogNavigationSetView.types.ts +++ b/src/views/catalog/views/navigation/set/CatalogNavigationSetView.types.ts @@ -1,10 +1,10 @@ -import { ICatalogPageData } from '@nitrots/nitro-renderer'; +import { INodeData } from '@nitrots/nitro-renderer'; import { Dispatch, SetStateAction } from 'react'; export interface CatalogNavigationSetViewProps { - page: ICatalogPageData; + page: INodeData; isFirstSet?: boolean; - pendingTree: ICatalogPageData[]; - setPendingTree: Dispatch>; + pendingTree: INodeData[]; + setPendingTree: Dispatch>; } diff --git a/src/views/catalog/views/page/layout/CatalogLayout.types.ts b/src/views/catalog/views/page/layout/CatalogLayout.types.ts index e727ce7a..53eccea6 100644 --- a/src/views/catalog/views/page/layout/CatalogLayout.types.ts +++ b/src/views/catalog/views/page/layout/CatalogLayout.types.ts @@ -1,7 +1,7 @@ -import { ICatalogPageParser, RoomPreviewer } from '@nitrots/nitro-renderer'; +import { CatalogPageMessageParser, RoomPreviewer } from '@nitrots/nitro-renderer'; export interface CatalogLayoutProps { roomPreviewer: RoomPreviewer; - pageParser?: ICatalogPageParser; + pageParser?: CatalogPageMessageParser; } diff --git a/src/views/catalog/views/page/layout/GetCatalogLayout.tsx b/src/views/catalog/views/page/layout/GetCatalogLayout.tsx index e36c2b96..c7478d58 100644 --- a/src/views/catalog/views/page/layout/GetCatalogLayout.tsx +++ b/src/views/catalog/views/page/layout/GetCatalogLayout.tsx @@ -1,4 +1,4 @@ -import { ICatalogPageParser, RoomPreviewer } from '@nitrots/nitro-renderer'; +import { CatalogPageMessageParser, RoomPreviewer } from '@nitrots/nitro-renderer'; import { CatalogLayoutBadgeDisplayView } from './badge-display/CatalogLayoutBadgeDisplayView'; import { CatalogLayoutDefaultView } from './default/CatalogLayoutDefaultView'; import { CatalogLayoutFrontpage4View } from './frontpage4/CatalogLayoutFrontpage4View'; @@ -13,7 +13,7 @@ import { CatalogLayoutSpacesView } from './spaces-new/CatalogLayoutSpacesView'; import { CatalogLayoutTrophiesView } from './trophies/CatalogLayoutTrophiesView'; import { CatalogLayoutVipBuyView } from './vip-buy/CatalogLayoutVipBuyView'; -export const GetCatalogLayout = (pageParser: ICatalogPageParser, roomPreviewer: RoomPreviewer) => +export const GetCatalogLayout = (pageParser: CatalogPageMessageParser, roomPreviewer: RoomPreviewer) => { switch(pageParser.layoutCode) { diff --git a/src/views/catalog/views/search/CatalogSearchView.tsx b/src/views/catalog/views/search/CatalogSearchView.tsx index 8acd3986..af6ffb41 100644 --- a/src/views/catalog/views/search/CatalogSearchView.tsx +++ b/src/views/catalog/views/search/CatalogSearchView.tsx @@ -1,4 +1,4 @@ -import { ICatalogPageData, IFurnitureData } from '@nitrots/nitro-renderer'; +import { IFurnitureData, INodeData } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import { GetSessionDataManager, LocalizeText } from '../../../../api'; import { GetOfferNodes } from '../../common/CatalogUtilities'; @@ -44,7 +44,7 @@ export const CatalogSearchView: FC = props => if(!furnitureData) return; - const foundPages: ICatalogPageData[] = []; + const foundPages: INodeData[] = []; const foundFurniture: IFurnitureData[] = []; for(const furniture of furnitureData) @@ -71,7 +71,7 @@ export const CatalogSearchView: FC = props => return (self.indexOf(value) === index); }); - const catalogPage: ICatalogPageData = { + const catalogPage: INodeData = { visible: true, icon: 0, pageId: -1, diff --git a/src/views/inventory/views/badge/InventoryBadgeView.tsx b/src/views/inventory/views/badge/InventoryBadgeView.tsx index 8314db2d..58ce4a56 100644 --- a/src/views/inventory/views/badge/InventoryBadgeView.tsx +++ b/src/views/inventory/views/badge/InventoryBadgeView.tsx @@ -18,7 +18,6 @@ export const InventoryBadgeView: FC = props => { if(needsBadgeUpdate) { - console.log('yee') dispatchBadgeState({ type: InventoryBadgeActions.SET_NEEDS_UPDATE, payload: {