mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +01:00
Fix catalog published alert
This commit is contained in:
parent
fa11f4ef77
commit
07a4dfbed9
@ -1,4 +1,4 @@
|
|||||||
import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPublishedMessageEvent, ClubGiftInfoEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, MarketplaceMakeOfferResult, NodeData, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, SellablePetPalettesMessageEvent, UserSubscriptionEvent } from '@nitrots/nitro-renderer';
|
import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, ClubGiftInfoEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, MarketplaceMakeOfferResult, NodeData, 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 { GetFurnitureData, GetProductDataForLocalization, LocalizeText, NotificationAlertType, NotificationUtilities } from '../../api';
|
import { GetFurnitureData, GetProductDataForLocalization, LocalizeText, NotificationAlertType, NotificationUtilities } from '../../api';
|
||||||
@ -251,13 +251,6 @@ export const CatalogMessageHandler: FC<{}> = props =>
|
|||||||
});
|
});
|
||||||
}, [ setCatalogOptions ]);
|
}, [ setCatalogOptions ]);
|
||||||
|
|
||||||
const onCatalogPublishedMessageEvent = useCallback((event: CatalogPublishedMessageEvent) =>
|
|
||||||
{
|
|
||||||
resetState();
|
|
||||||
|
|
||||||
NotificationUtilities.simpleAlert(LocalizeText('catalog.alert.published.description'), null, null, null, LocalizeText('catalog.alert.published.title'));
|
|
||||||
}, [ resetState ]);
|
|
||||||
|
|
||||||
const onGiftWrappingConfigurationEvent = useCallback((event: GiftWrappingConfigurationEvent) =>
|
const onGiftWrappingConfigurationEvent = useCallback((event: GiftWrappingConfigurationEvent) =>
|
||||||
{
|
{
|
||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
@ -316,7 +309,6 @@ export const CatalogMessageHandler: FC<{}> = props =>
|
|||||||
UseMessageEventHook(GiftReceiverNotFoundEvent, onGiftReceiverNotFoundEvent);
|
UseMessageEventHook(GiftReceiverNotFoundEvent, onGiftReceiverNotFoundEvent);
|
||||||
UseMessageEventHook(HabboClubOffersMessageEvent, onHabboClubOffersMessageEvent);
|
UseMessageEventHook(HabboClubOffersMessageEvent, onHabboClubOffersMessageEvent);
|
||||||
UseMessageEventHook(UserSubscriptionEvent, onUserSubscriptionEvent);
|
UseMessageEventHook(UserSubscriptionEvent, onUserSubscriptionEvent);
|
||||||
UseMessageEventHook(CatalogPublishedMessageEvent, onCatalogPublishedMessageEvent);
|
|
||||||
UseMessageEventHook(GiftWrappingConfigurationEvent, onGiftWrappingConfigurationEvent);
|
UseMessageEventHook(GiftWrappingConfigurationEvent, onGiftWrappingConfigurationEvent);
|
||||||
UseMessageEventHook(ClubGiftInfoEvent, onClubGiftInfoEvent);
|
UseMessageEventHook(ClubGiftInfoEvent, onClubGiftInfoEvent);
|
||||||
UseMessageEventHook(MarketplaceMakeOfferResult, onMarketplaceMakeOfferResult);
|
UseMessageEventHook(MarketplaceMakeOfferResult, onMarketplaceMakeOfferResult);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { FrontPageItem, GetCatalogIndexComposer, GetCatalogPageComposer, GetClubGiftInfo, GetGiftWrappingConfigurationComposer, ILinkEventTracker, RoomPreviewer } from '@nitrots/nitro-renderer';
|
import { CatalogPublishedMessageEvent, FrontPageItem, GetCatalogIndexComposer, GetCatalogPageComposer, GetClubGiftInfo, GetGiftWrappingConfigurationComposer, ILinkEventTracker, RoomPreviewer } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useState } from 'react';
|
import { FC, useCallback, useEffect, useState } from 'react';
|
||||||
import { AddEventLinkTracker, GetRoomEngine, LocalizeText, PlaySound, RemoveLinkEventTracker, SendMessageComposer, SoundNames } from '../../api';
|
import { AddEventLinkTracker, GetRoomEngine, LocalizeText, NotificationUtilities, PlaySound, RemoveLinkEventTracker, SendMessageComposer, SoundNames } from '../../api';
|
||||||
import { Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
|
import { Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
|
||||||
import { CatalogPurchasedEvent } from '../../events';
|
import { CatalogPurchasedEvent } from '../../events';
|
||||||
import { BatchUpdates, UseUiEvent } from '../../hooks';
|
import { BatchUpdates, UseMessageEventHook, UseUiEvent } from '../../hooks';
|
||||||
import { CatalogContextProvider } from './CatalogContext';
|
import { CatalogContextProvider } from './CatalogContext';
|
||||||
import { CatalogMessageHandler } from './CatalogMessageHandler';
|
import { CatalogMessageHandler } from './CatalogMessageHandler';
|
||||||
import { CatalogPage } from './common/CatalogPage';
|
import { CatalogPage } from './common/CatalogPage';
|
||||||
@ -59,6 +59,17 @@ export const CatalogView: FC<{}> = props =>
|
|||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const onCatalogPublishedMessageEvent = useCallback((event: CatalogPublishedMessageEvent) =>
|
||||||
|
{
|
||||||
|
const wasVisible = isVisible;
|
||||||
|
|
||||||
|
resetState();
|
||||||
|
|
||||||
|
if(wasVisible) NotificationUtilities.simpleAlert(LocalizeText('catalog.alert.published.description'), null, null, null, LocalizeText('catalog.alert.published.title'));
|
||||||
|
}, [ isVisible, resetState ]);
|
||||||
|
|
||||||
|
UseMessageEventHook(CatalogPublishedMessageEvent, onCatalogPublishedMessageEvent);
|
||||||
|
|
||||||
const getNodeById = useCallback((id: number, node: ICatalogNode) =>
|
const getNodeById = useCallback((id: number, node: ICatalogNode) =>
|
||||||
{
|
{
|
||||||
if((node.pageId === id) && (node !== rootNode)) return node;
|
if((node.pageId === id) && (node !== rootNode)) return node;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user