Update events & hooks

This commit is contained in:
Bill 2022-03-03 04:11:31 -05:00
parent 53b57d72c9
commit eb8ba913b8
213 changed files with 1245 additions and 1471 deletions

View File

@ -4,10 +4,7 @@ import { GetCommunication, GetConfiguration, GetNitroInstance } from './api';
import { Base, TransitionAnimation, TransitionAnimationTypes } from './common'; import { Base, TransitionAnimation, TransitionAnimationTypes } from './common';
import { LoadingView } from './components/loading/LoadingView'; import { LoadingView } from './components/loading/LoadingView';
import { MainView } from './components/main/MainView'; import { MainView } from './components/main/MainView';
import { useConfigurationEvent } from './hooks/events/core/configuration/configuration-event'; import { DispatchUiEvent, UseConfigurationEvent, UseLocalizationEvent, UseMainEvent, UseRoomEngineEvent } from './hooks';
import { useLocalizationEvent } from './hooks/events/nitro/localization/localization-event';
import { dispatchMainEvent, useMainEvent } from './hooks/events/nitro/main-event';
import { useRoomEngineEvent } from './hooks/events/nitro/room/room-engine-event';
export const App: FC<{}> = props => export const App: FC<{}> = props =>
{ {
@ -105,21 +102,21 @@ export const App: FC<{}> = props =>
} }
}, [ getPreloadAssetUrls ]); }, [ getPreloadAssetUrls ]);
useMainEvent(Nitro.WEBGL_UNAVAILABLE, handler); UseMainEvent(Nitro.WEBGL_UNAVAILABLE, handler);
useMainEvent(Nitro.WEBGL_CONTEXT_LOST, handler); UseMainEvent(Nitro.WEBGL_CONTEXT_LOST, handler);
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING, handler); UseMainEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING, handler);
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED, handler); UseMainEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED, handler);
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, handler); UseMainEvent(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, handler);
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_ERROR, handler); UseMainEvent(NitroCommunicationDemoEvent.CONNECTION_ERROR, handler);
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, handler); UseMainEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, handler);
useRoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, handler); UseRoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, handler);
useLocalizationEvent(NitroLocalizationEvent.LOADED, handler); UseLocalizationEvent(NitroLocalizationEvent.LOADED, handler);
useConfigurationEvent(ConfigurationEvent.LOADED, handler); UseConfigurationEvent(ConfigurationEvent.LOADED, handler);
useConfigurationEvent(ConfigurationEvent.FAILED, handler); UseConfigurationEvent(ConfigurationEvent.FAILED, handler);
if(!WebGL.isWebGLAvailable()) if(!WebGL.isWebGLAvailable())
{ {
dispatchMainEvent(new NitroEvent(Nitro.WEBGL_UNAVAILABLE)); DispatchUiEvent(new NitroEvent(Nitro.WEBGL_UNAVAILABLE));
} }
else else
{ {

View File

@ -1,7 +1,7 @@
import { GroupInformationComposer } from '@nitrots/nitro-renderer'; import { GroupInformationComposer } from '@nitrots/nitro-renderer';
import { SendMessageHook } from '../../hooks'; import { SendMessageComposer } from '..';
export function GetGroupInformation(groupId: number): void export function GetGroupInformation(groupId: number): void
{ {
SendMessageHook(new GroupInformationComposer(groupId, true)); SendMessageComposer(new GroupInformationComposer(groupId, true));
} }

View File

@ -1,4 +1,4 @@
import { GroupJoinComposer } from '@nitrots/nitro-renderer'; import { GroupJoinComposer } from '@nitrots/nitro-renderer';
import { SendMessageHook } from '../../hooks'; import { SendMessageComposer } from '..';
export const TryJoinGroup = (groupId: number) => SendMessageHook(new GroupJoinComposer(groupId)); export const TryJoinGroup = (groupId: number) => SendMessageComposer(new GroupJoinComposer(groupId));

View File

@ -1,2 +1,4 @@
export * from './GetGroupInformation'; export * from './GetGroupInformation';
export * from './GetGroupManager';
export * from './GetGroupMembers';
export * from './TryJoinGroup'; export * from './TryJoinGroup';

View File

@ -1,7 +1,7 @@
import { RoomInfoComposer } from '@nitrots/nitro-renderer'; import { RoomInfoComposer } from '@nitrots/nitro-renderer';
import { SendMessageHook } from '../../hooks/messages/message-event'; import { SendMessageComposer } from '../nitro';
export function TryVisitRoom(roomId: number): void export function TryVisitRoom(roomId: number): void
{ {
SendMessageHook(new RoomInfoComposer(roomId, false, true)); SendMessageComposer(new RoomInfoComposer(roomId, false, true));
} }

View File

@ -0,0 +1,4 @@
import { IMessageComposer } from '@nitrots/nitro-renderer';
import { GetConnection } from './GetConnection';
export const SendMessageComposer = (event: IMessageComposer<unknown[]>) => GetConnection().send(event);

View File

@ -10,4 +10,9 @@ export * from './GetNitroInstance';
export * from './GetTicker'; export * from './GetTicker';
export * from './RemoveLinkEventTracker'; export * from './RemoveLinkEventTracker';
export * from './room'; export * from './room';
export * from './room/widgets';
export * from './room/widgets/events';
export * from './room/widgets/handlers';
export * from './room/widgets/messages';
export * from './SendMessageComposer';
export * from './session'; export * from './session';

View File

@ -6,6 +6,7 @@ export * from './RoomWidgetChooserContentEvent';
export * from './RoomWidgetDoorbellEvent'; export * from './RoomWidgetDoorbellEvent';
export * from './RoomWidgetFloodControlEvent'; export * from './RoomWidgetFloodControlEvent';
export * from './RoomWidgetObjectNameEvent'; export * from './RoomWidgetObjectNameEvent';
export * from './RoomWidgetPollUpdateEvent';
export * from './RoomWidgetUpdateBackgroundColorPreviewEvent'; export * from './RoomWidgetUpdateBackgroundColorPreviewEvent';
export * from './RoomWidgetUpdateChatEvent'; export * from './RoomWidgetUpdateChatEvent';
export * from './RoomWidgetUpdateChatInputContentEvent'; export * from './RoomWidgetUpdateChatInputContentEvent';
@ -34,4 +35,5 @@ export * from './RoomWidgetUpdateTrophyEvent';
export * from './RoomWidgetUpdateUserDataEvent'; export * from './RoomWidgetUpdateUserDataEvent';
export * from './RoomWidgetUpdateYoutubeDisplayEvent'; export * from './RoomWidgetUpdateYoutubeDisplayEvent';
export * from './RoomWidgetUseProductBubbleEvent'; export * from './RoomWidgetUseProductBubbleEvent';
export * from './RoomWidgetWordQuizUpdateEvent';
export * from './UseProductItem'; export * from './UseProductItem';

View File

@ -1,6 +1,6 @@
import { NitroEvent, RoomSessionFriendRequestEvent, RoomWidgetEnum } from '@nitrots/nitro-renderer'; import { NitroEvent, RoomSessionFriendRequestEvent, RoomWidgetEnum } from '@nitrots/nitro-renderer';
import { FriendRequestEvent, FriendsAcceptFriendRequestEvent, FriendsDeclineFriendRequestEvent } from '../../../../../events'; import { FriendRequestEvent, FriendsAcceptFriendRequestEvent, FriendsDeclineFriendRequestEvent } from '../../../../../events';
import { dispatchUiEvent } from '../../../../../hooks'; import { DispatchUiEvent } from '../../../../../hooks';
import { RoomWidgetUpdateEvent, RoomWidgetUpdateFriendRequestEvent } from '../events'; import { RoomWidgetUpdateEvent, RoomWidgetUpdateFriendRequestEvent } from '../events';
import { RoomWidgetFriendRequestMessage, RoomWidgetMessage } from '../messages'; import { RoomWidgetFriendRequestMessage, RoomWidgetMessage } from '../messages';
import { RoomWidgetHandler } from './RoomWidgetHandler'; import { RoomWidgetHandler } from './RoomWidgetHandler';
@ -30,10 +30,10 @@ export class FriendRequestHandler extends RoomWidgetHandler
switch(message.type) switch(message.type)
{ {
case RoomWidgetFriendRequestMessage.ACCEPT: case RoomWidgetFriendRequestMessage.ACCEPT:
dispatchUiEvent(new FriendsAcceptFriendRequestEvent(friendMessage.requestId)); DispatchUiEvent(new FriendsAcceptFriendRequestEvent(friendMessage.requestId));
break; break;
case RoomWidgetFriendRequestMessage.DECLINE: case RoomWidgetFriendRequestMessage.DECLINE:
dispatchUiEvent(new FriendsDeclineFriendRequestEvent(friendMessage.requestId)); DispatchUiEvent(new FriendsDeclineFriendRequestEvent(friendMessage.requestId));
break; break;
} }

View File

@ -1,10 +1,8 @@
import { NitroEvent, RoomControllerLevel, RoomEngineDimmerStateEvent, RoomEngineTriggerWidgetEvent, RoomSessionDimmerPresetsEvent, RoomWidgetEnum } from '@nitrots/nitro-renderer'; import { NitroEvent, RoomControllerLevel, RoomEngineDimmerStateEvent, RoomEngineTriggerWidgetEvent, RoomSessionDimmerPresetsEvent, RoomWidgetEnum } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from '../..'; import { GetRoomEngine } from '../..';
import { GetSessionDataManager } from '../../..'; import { GetSessionDataManager } from '../../..';
import { RoomWidgetUpdateDimmerEvent, RoomWidgetUpdateEvent } from '../events'; import { RoomWidgetUpdateDimmerEvent, RoomWidgetUpdateDimmerStateEvent, RoomWidgetUpdateEvent } from '../events';
import { RoomWidgetUpdateDimmerStateEvent } from '../events/RoomWidgetUpdateDimmerStateEvent'; import { RoomWidgetDimmerChangeStateMessage, RoomWidgetDimmerPreviewMessage, RoomWidgetDimmerSavePresetMessage, RoomWidgetFurniToWidgetMessage, RoomWidgetMessage } from '../messages';
import { RoomWidgetDimmerChangeStateMessage, RoomWidgetDimmerPreviewMessage, RoomWidgetFurniToWidgetMessage, RoomWidgetMessage } from '../messages';
import { RoomWidgetDimmerSavePresetMessage } from '../messages/RoomWidgetDimmerSavePresetMessage';
import { RoomWidgetHandler } from './RoomWidgetHandler'; import { RoomWidgetHandler } from './RoomWidgetHandler';
export class FurnitureDimmerWidgetHandler extends RoomWidgetHandler export class FurnitureDimmerWidgetHandler extends RoomWidgetHandler

View File

@ -1,8 +1,6 @@
import { NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable, RoomWidgetEnum } from '@nitrots/nitro-renderer'; import { NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable, RoomWidgetEnum } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from '../../../..'; import { GetRoomEngine } from '../../../..';
import { IPhotoData } from '../events'; import { IPhotoData, RoomWidgetUpdateEvent, RoomWidgetUpdateExternalImageEvent } from '../events';
import { RoomWidgetUpdateEvent } from '../events/RoomWidgetUpdateEvent';
import { RoomWidgetUpdateExternalImageEvent } from '../events/RoomWidgetUpdateExternalImageEvent';
import { RoomWidgetMessage } from '../messages/RoomWidgetMessage'; import { RoomWidgetMessage } from '../messages/RoomWidgetMessage';
import { RoomWidgetHandler } from './RoomWidgetHandler'; import { RoomWidgetHandler } from './RoomWidgetHandler';

View File

@ -1,8 +1,8 @@
import { NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable, RoomWidgetEnum } from '@nitrots/nitro-renderer'; import { NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable, RoomWidgetEnum } from '@nitrots/nitro-renderer';
import { RoomWidgetUpdateMannequinEvent } from '..'; import { RoomWidgetUpdateMannequinEvent } from '..';
import { GetRoomEngine } from '../../GetRoomEngine'; import { GetRoomEngine } from '../../GetRoomEngine';
import { RoomWidgetUpdateEvent } from '../events/RoomWidgetUpdateEvent'; import { RoomWidgetUpdateEvent } from '../events';
import { RoomWidgetMessage } from '../messages/RoomWidgetMessage'; import { RoomWidgetMessage } from '../messages';
import { RoomWidgetHandler } from './RoomWidgetHandler'; import { RoomWidgetHandler } from './RoomWidgetHandler';
export class FurnitureMannequinWidgetHandler extends RoomWidgetHandler export class FurnitureMannequinWidgetHandler extends RoomWidgetHandler

View File

@ -1,13 +1,9 @@
import { SecurityLevel } from '@nitrots/nitro-renderer'; import { GetYoutubeDisplayStatusMessageComposer, NitroEvent, RoomWidgetEnum, SecurityLevel } from '@nitrots/nitro-renderer';
import { NitroEvent } from '@nitrots/nitro-renderer/src/core/events/NitroEvent'; import { RoomEngineTriggerWidgetEvent } from '@nitrots/nitro-renderer/';
import { GetYoutubeDisplayStatusMessageComposer } from '@nitrots/nitro-renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube';
import { RoomEngineTriggerWidgetEvent } from '@nitrots/nitro-renderer/src/nitro/room/events/RoomEngineTriggerWidgetEvent';
import { RoomWidgetEnum } from '@nitrots/nitro-renderer/src/nitro/ui/widget/enums/RoomWidgetEnum';
import { RoomWidgetMessage, RoomWidgetUpdateEvent } from '..'; import { RoomWidgetMessage, RoomWidgetUpdateEvent } from '..';
import { GetSessionDataManager, IsOwnerOfFurniture } from '../../..'; import { GetSessionDataManager, IsOwnerOfFurniture, SendMessageComposer } from '../../..';
import { SendMessageHook } from '../../../../../hooks';
import { GetRoomEngine } from '../../GetRoomEngine'; import { GetRoomEngine } from '../../GetRoomEngine';
import { RoomWidgetUpdateYoutubeDisplayEvent } from '../events/RoomWidgetUpdateYoutubeDisplayEvent'; import { RoomWidgetUpdateYoutubeDisplayEvent } from '../events';
import { RoomWidgetHandler } from './RoomWidgetHandler'; import { RoomWidgetHandler } from './RoomWidgetHandler';
export class FurnitureYoutubeDisplayWidgetHandler extends RoomWidgetHandler export class FurnitureYoutubeDisplayWidgetHandler extends RoomWidgetHandler
@ -34,7 +30,7 @@ export class FurnitureYoutubeDisplayWidgetHandler extends RoomWidgetHandler
const hasControl = GetSessionDataManager().hasSecurity(SecurityLevel.EMPLOYEE) || IsOwnerOfFurniture(roomObject); const hasControl = GetSessionDataManager().hasSecurity(SecurityLevel.EMPLOYEE) || IsOwnerOfFurniture(roomObject);
this.container.eventDispatcher.dispatchEvent(new RoomWidgetUpdateYoutubeDisplayEvent(roomObject.id, hasControl)); this.container.eventDispatcher.dispatchEvent(new RoomWidgetUpdateYoutubeDisplayEvent(roomObject.id, hasControl));
SendMessageHook(new GetYoutubeDisplayStatusMessageComposer(this._lastFurniId)); SendMessageComposer(new GetYoutubeDisplayStatusMessageComposer(this._lastFurniId));
return; return;
} }
case RoomEngineTriggerWidgetEvent.CLOSE_WIDGET: { case RoomEngineTriggerWidgetEvent.CLOSE_WIDGET: {

View File

@ -1,8 +1,6 @@
import { NitroEvent, RoomSessionPollEvent, RoomWidgetEnum } from '@nitrots/nitro-renderer'; import { NitroEvent, RoomSessionPollEvent, RoomWidgetEnum } from '@nitrots/nitro-renderer';
import { RoomWidgetPollUpdateEvent } from '../events/RoomWidgetPollUpdateEvent'; import { RoomWidgetPollUpdateEvent, RoomWidgetUpdateEvent } from '../events';
import { RoomWidgetUpdateEvent } from '../events/RoomWidgetUpdateEvent'; import { RoomWidgetMessage, RoomWidgetPollMessage } from '../messages';
import { RoomWidgetMessage } from '../messages/RoomWidgetMessage';
import { RoomWidgetPollMessage } from '../messages/RoomWidgetPollMessage';
import { RoomWidgetHandler } from './RoomWidgetHandler'; import { RoomWidgetHandler } from './RoomWidgetHandler';
export class PollWidgetHandler extends RoomWidgetHandler export class PollWidgetHandler extends RoomWidgetHandler

View File

@ -1,9 +1,8 @@
import { AvatarExpressionEnum, HabboClubLevelEnum, NitroEvent, RoomControllerLevel, RoomRotatingEffect, RoomSessionChatEvent, RoomSettingsComposer, RoomShakingEffect, RoomWidgetEnum, RoomZoomEvent, TextureUtils } from '@nitrots/nitro-renderer'; import { AvatarExpressionEnum, HabboClubLevelEnum, NitroEvent, RoomControllerLevel, RoomRotatingEffect, RoomSessionChatEvent, RoomSettingsComposer, RoomShakingEffect, RoomWidgetEnum, RoomZoomEvent, TextureUtils } from '@nitrots/nitro-renderer';
import { GetConfiguration, GetNitroInstance } from '../../..'; import { GetConfiguration, GetNitroInstance, SendMessageComposer } from '../../..';
import { GetRoomEngine, GetSessionDataManager, LocalizeText } from '../../../..'; import { GetRoomEngine, GetSessionDataManager, LocalizeText } from '../../../..';
import { FloorplanEditorEvent } from '../../../../../events/floorplan-editor/FloorplanEditorEvent'; import { FloorplanEditorEvent } from '../../../../../events/floorplan-editor/FloorplanEditorEvent';
import { dispatchUiEvent } from '../../../../../hooks'; import { DispatchUiEvent } from '../../../../../hooks';
import { SendMessageHook } from '../../../../../hooks/messages';
import { NotificationUtilities } from '../../../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../../../views/notification-center/common/NotificationUtilities';
import { RoomWidgetFloodControlEvent, RoomWidgetUpdateEvent } from '../events'; import { RoomWidgetFloodControlEvent, RoomWidgetUpdateEvent } from '../events';
import { RoomWidgetChatMessage, RoomWidgetChatSelectAvatarMessage, RoomWidgetChatTypingMessage, RoomWidgetMessage, RoomWidgetRequestWidgetMessage } from '../messages'; import { RoomWidgetChatMessage, RoomWidgetChatSelectAvatarMessage, RoomWidgetChatTypingMessage, RoomWidgetMessage, RoomWidgetRequestWidgetMessage } from '../messages';
@ -160,7 +159,7 @@ export class RoomWidgetChatInputHandler extends RoomWidgetHandler
if(this.container.roomSession.controllerLevel >= RoomControllerLevel.ROOM_OWNER) if(this.container.roomSession.controllerLevel >= RoomControllerLevel.ROOM_OWNER)
{ {
//this.container.processWidgetMessage(new RoomWidgetRequestWidgetMessage(RoomWidgetRequestWidgetMessage.FLOOR_EDITOR)); //this.container.processWidgetMessage(new RoomWidgetRequestWidgetMessage(RoomWidgetRequestWidgetMessage.FLOOR_EDITOR));
dispatchUiEvent(new FloorplanEditorEvent(FloorplanEditorEvent.SHOW_FLOORPLAN_EDITOR)); DispatchUiEvent(new FloorplanEditorEvent(FloorplanEditorEvent.SHOW_FLOORPLAN_EDITOR));
} }
return null; return null;
@ -179,7 +178,7 @@ export class RoomWidgetChatInputHandler extends RoomWidgetHandler
case ':settings': case ':settings':
if(this.container.roomSession.isRoomOwner || GetSessionDataManager().isModerator) if(this.container.roomSession.isRoomOwner || GetSessionDataManager().isModerator)
{ {
SendMessageHook(new RoomSettingsComposer(this.container.roomSession.roomId)); SendMessageComposer(new RoomSettingsComposer(this.container.roomSession.roomId));
} }
return null; return null;

View File

@ -1,10 +1,8 @@
import { IFurnitureData, NitroEvent, ObjectDataFactory, PetFigureData, PetRespectComposer, PetSupplementComposer, PetType, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectOperationType, RoomObjectType, RoomObjectVariable, RoomSessionPetInfoUpdateEvent, RoomSessionUserBadgesEvent, RoomSessionUserFigureUpdateEvent, RoomTradingLevelEnum, RoomUnitDropHandItemComposer, RoomUnitGiveHandItemComposer, RoomUnitGiveHandItemPetComposer, RoomUserData, RoomWidgetEnum, RoomWidgetEnumItemExtradataParameter, Vector3d } from '@nitrots/nitro-renderer'; import { IFurnitureData, NitroEvent, ObjectDataFactory, PetFigureData, PetRespectComposer, PetSupplementComposer, PetType, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectOperationType, RoomObjectType, RoomObjectVariable, RoomSessionPetInfoUpdateEvent, RoomSessionUserBadgesEvent, RoomSessionUserFigureUpdateEvent, RoomTradingLevelEnum, RoomUnitDropHandItemComposer, RoomUnitGiveHandItemComposer, RoomUnitGiveHandItemPetComposer, RoomUserData, RoomWidgetEnum, RoomWidgetEnumItemExtradataParameter, Vector3d } from '@nitrots/nitro-renderer';
import { SendMessageComposer } from '../../..';
import { GetNitroInstance, GetRoomEngine, GetSessionDataManager, IsOwnerOfFurniture } from '../../../..'; import { GetNitroInstance, GetRoomEngine, GetSessionDataManager, IsOwnerOfFurniture } from '../../../..';
import { InventoryTradeRequestEvent, WiredSelectObjectEvent } from '../../../../../events'; import { FriendsSendFriendRequestEvent, HelpReportUserEvent, InventoryTradeRequestEvent, WiredSelectObjectEvent } from '../../../../../events';
import { FriendsSendFriendRequestEvent } from '../../../../../events/friends/FriendsSendFriendRequestEvent'; import { DispatchUiEvent } from '../../../../../hooks';
import { HelpReportUserEvent } from '../../../../../events/help/HelpReportUserEvent';
import { dispatchUiEvent } from '../../../../../hooks/events';
import { SendMessageHook } from '../../../../../hooks/messages';
import { FriendsHelper } from '../../../../../views/friends/common/FriendsHelper'; import { FriendsHelper } from '../../../../../views/friends/common/FriendsHelper';
import { PetSupplementEnum } from '../../../../../views/room/widgets/avatar-info/common/PetSupplementEnum'; import { PetSupplementEnum } from '../../../../../views/room/widgets/avatar-info/common/PetSupplementEnum';
import { LocalizeText } from '../../../../utils/LocalizeText'; import { LocalizeText } from '../../../../utils/LocalizeText';
@ -81,7 +79,7 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler
case RoomWidgetRoomObjectMessage.GET_OBJECT_INFO: case RoomWidgetRoomObjectMessage.GET_OBJECT_INFO:
return this.processObjectInfoMessage((message as RoomWidgetRoomObjectMessage)); return this.processObjectInfoMessage((message as RoomWidgetRoomObjectMessage));
case RoomWidgetUserActionMessage.SEND_FRIEND_REQUEST: case RoomWidgetUserActionMessage.SEND_FRIEND_REQUEST:
dispatchUiEvent(new FriendsSendFriendRequestEvent(userData.webID, userData.name)); DispatchUiEvent(new FriendsSendFriendRequestEvent(userData.webID, userData.name));
break; break;
case RoomWidgetUserActionMessage.RESPECT_USER: case RoomWidgetUserActionMessage.RESPECT_USER:
GetSessionDataManager().giveRespect(userId); GetSessionDataManager().giveRespect(userId);
@ -122,7 +120,7 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler
this.container.roomSession.sendTakeRightsMessage((message as RoomWidgetUserActionMessage).userId); this.container.roomSession.sendTakeRightsMessage((message as RoomWidgetUserActionMessage).userId);
break; break;
case RoomWidgetUserActionMessage.START_TRADING: case RoomWidgetUserActionMessage.START_TRADING:
dispatchUiEvent(new InventoryTradeRequestEvent(userData.roomIndex, userData.name)); DispatchUiEvent(new InventoryTradeRequestEvent(userData.roomIndex, userData.name));
break; break;
// case RoomWidgetUserActionMessage.RWUAM_OPEN_HOME_PAGE: // case RoomWidgetUserActionMessage.RWUAM_OPEN_HOME_PAGE:
// this._container.sessionDataManager._Str_21275((message as RoomWidgetUserActionMessage).userId, _local_3.name); // this._container.sessionDataManager._Str_21275((message as RoomWidgetUserActionMessage).userId, _local_3.name);
@ -146,22 +144,22 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler
this.container.roomSession.removePetSaddle(userId); this.container.roomSession.removePetSaddle(userId);
break; break;
case RoomWidgetUserActionMessage.PASS_CARRY_ITEM: case RoomWidgetUserActionMessage.PASS_CARRY_ITEM:
SendMessageHook(new RoomUnitGiveHandItemComposer(userId)); SendMessageComposer(new RoomUnitGiveHandItemComposer(userId));
break; break;
case RoomWidgetUserActionMessage.GIVE_CARRY_ITEM_TO_PET: case RoomWidgetUserActionMessage.GIVE_CARRY_ITEM_TO_PET:
SendMessageHook(new RoomUnitGiveHandItemPetComposer(userId)); SendMessageComposer(new RoomUnitGiveHandItemPetComposer(userId));
break; break;
case RoomWidgetUserActionMessage.GIVE_WATER_TO_PET: case RoomWidgetUserActionMessage.GIVE_WATER_TO_PET:
SendMessageHook(new PetSupplementComposer(userId, PetSupplementEnum.WATER)); SendMessageComposer(new PetSupplementComposer(userId, PetSupplementEnum.WATER));
break; break;
case RoomWidgetUserActionMessage.GIVE_LIGHT_TO_PET: case RoomWidgetUserActionMessage.GIVE_LIGHT_TO_PET:
SendMessageHook(new PetSupplementComposer(userId, PetSupplementEnum.LIGHT)); SendMessageComposer(new PetSupplementComposer(userId, PetSupplementEnum.LIGHT));
break; break;
case RoomWidgetUserActionMessage.TREAT_PET: case RoomWidgetUserActionMessage.TREAT_PET:
SendMessageHook(new PetRespectComposer(userId)); SendMessageComposer(new PetRespectComposer(userId));
break; break;
case RoomWidgetUserActionMessage.DROP_CARRY_ITEM: case RoomWidgetUserActionMessage.DROP_CARRY_ITEM:
SendMessageHook(new RoomUnitDropHandItemComposer()); SendMessageComposer(new RoomUnitDropHandItemComposer());
break; break;
case RoomWidgetUserActionMessage.REQUEST_PET_UPDATE: case RoomWidgetUserActionMessage.REQUEST_PET_UPDATE:
this.container.roomSession.userDataManager.requestPetInfo(userId); this.container.roomSession.userDataManager.requestPetInfo(userId);
@ -169,7 +167,7 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler
case RoomWidgetUserActionMessage.REPORT: case RoomWidgetUserActionMessage.REPORT:
return; return;
case RoomWidgetUserActionMessage.REPORT_CFH_OTHER: case RoomWidgetUserActionMessage.REPORT_CFH_OTHER:
dispatchUiEvent(new HelpReportUserEvent(userId)); DispatchUiEvent(new HelpReportUserEvent(userId));
return; return;
case RoomWidgetUserActionMessage.AMBASSADOR_ALERT_USER: case RoomWidgetUserActionMessage.AMBASSADOR_ALERT_USER:
this.container.roomSession.sendAmbassadorAlertMessage(userId); this.container.roomSession.sendAmbassadorAlertMessage(userId);
@ -391,7 +389,7 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler
event.tileSizeX = furnitureData.tileSizeX; event.tileSizeX = furnitureData.tileSizeX;
event.tileSizeY = furnitureData.tileSizeY; event.tileSizeY = furnitureData.tileSizeY;
dispatchUiEvent(new WiredSelectObjectEvent(event.id, event.category)); DispatchUiEvent(new WiredSelectObjectEvent(event.id, event.category));
} }
} }

View File

@ -14,6 +14,7 @@ export * from './RoomWidgetFurniActionMessage';
export * from './RoomWidgetFurniToWidgetMessage'; export * from './RoomWidgetFurniToWidgetMessage';
export * from './RoomWidgetLetUserInMessage'; export * from './RoomWidgetLetUserInMessage';
export * from './RoomWidgetMessage'; export * from './RoomWidgetMessage';
export * from './RoomWidgetPollMessage';
export * from './RoomWidgetPresentOpenMessage'; export * from './RoomWidgetPresentOpenMessage';
export * from './RoomWidgetRequestWidgetMessage'; export * from './RoomWidgetRequestWidgetMessage';
export * from './RoomWidgetRoomObjectMessage'; export * from './RoomWidgetRoomObjectMessage';

View File

@ -1,7 +1,7 @@
import { DesktopViewComposer } from '@nitrots/nitro-renderer'; import { DesktopViewComposer } from '@nitrots/nitro-renderer';
import { SendMessageHook } from '../../../hooks'; import { SendMessageComposer } from '..';
export function GoToDesktop(): void export function GoToDesktop(): void
{ {
SendMessageHook(new DesktopViewComposer()); SendMessageComposer(new DesktopViewComposer());
} }

View File

@ -1,7 +1,7 @@
import { UserProfileComposer } from '@nitrots/nitro-renderer'; import { UserProfileComposer } from '@nitrots/nitro-renderer';
import { SendMessageHook } from '../../hooks'; import { SendMessageComposer } from '..';
export function GetUserProfile(userId: number): void export function GetUserProfile(userId: number): void
{ {
SendMessageHook(new UserProfileComposer(userId)); SendMessageComposer(new UserProfileComposer(userId));
} }

View File

@ -1,9 +1,9 @@
import { NitroSoundEvent } from '@nitrots/nitro-renderer/src/nitro/events/NitroSoundEvent'; import { NitroSoundEvent } from '@nitrots/nitro-renderer/src/nitro/events/NitroSoundEvent';
import { dispatchMainEvent } from '../../hooks'; import { DispatchMainEvent } from '../../hooks';
export function PlaySound(sampleCode: string): void export function PlaySound(sampleCode: string): void
{ {
dispatchMainEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sampleCode)); DispatchMainEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sampleCode));
} }
export const CAMERA_SHUTTER = 'camera_shutter'; export const CAMERA_SHUTTER = 'camera_shutter';

View File

@ -1,14 +1,9 @@
import { AchievementData, AchievementEvent, AchievementsEvent, AchievementsScoreEvent, RequestAchievementsMessageComposer } from '@nitrots/nitro-renderer'; import { AchievementData, AchievementEvent, AchievementsEvent, AchievementsScoreEvent, RequestAchievementsMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { GetConfiguration, LocalizeText } from '../../api'; import { GetConfiguration, LocalizeText, SendMessageComposer } from '../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardSubHeaderView, NitroCardView } from '../../common'; import { Base, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardSubHeaderView, NitroCardView, Text } from '../../common';
import { Base } from '../../common/Base'; import { AchievementsUIEvent, AchievementsUIUnseenCountEvent } from '../../events';
import { Column } from '../../common/Column'; import { BatchUpdates, DispatchUiEvent, UseMessageEventHook, UseUiEvent } from '../../hooks';
import { Flex } from '../../common/Flex';
import { Text } from '../../common/Text';
import { AchievementsUIEvent, AchievementsUIUnseenCountEvent } from '../../events/achievements';
import { BatchUpdates, CreateMessageHook, dispatchUiEvent, SendMessageHook } from '../../hooks';
import { useUiEvent } from '../../hooks/events';
import { AchievementCategory } from './common/AchievementCategory'; import { AchievementCategory } from './common/AchievementCategory';
import { AchievementUtilities } from './common/AchievementUtilities'; import { AchievementUtilities } from './common/AchievementUtilities';
import { AchievementsCategoryListView } from './views/category-list/AchievementsCategoryListView'; import { AchievementsCategoryListView } from './views/category-list/AchievementsCategoryListView';
@ -38,9 +33,9 @@ export const AchievementsView: FC<{}> = props =>
} }
}, []); }, []);
useUiEvent(AchievementsUIEvent.SHOW_ACHIEVEMENTS, onAchievementsUIEvent); UseUiEvent(AchievementsUIEvent.SHOW_ACHIEVEMENTS, onAchievementsUIEvent);
useUiEvent(AchievementsUIEvent.HIDE_ACHIEVEMENTS, onAchievementsUIEvent); UseUiEvent(AchievementsUIEvent.HIDE_ACHIEVEMENTS, onAchievementsUIEvent);
useUiEvent(AchievementsUIEvent.TOGGLE_ACHIEVEMENTS, onAchievementsUIEvent); UseUiEvent(AchievementsUIEvent.TOGGLE_ACHIEVEMENTS, onAchievementsUIEvent);
const onAchievementEvent = useCallback((event: AchievementEvent) => const onAchievementEvent = useCallback((event: AchievementEvent) =>
{ {
@ -89,7 +84,7 @@ export const AchievementsView: FC<{}> = props =>
setAchievementCategories(newCategories); setAchievementCategories(newCategories);
}, [ achievementCategories ]); }, [ achievementCategories ]);
CreateMessageHook(AchievementEvent, onAchievementEvent); UseMessageEventHook(AchievementEvent, onAchievementEvent);
const onAchievementsEvent = useCallback((event: AchievementsEvent) => const onAchievementsEvent = useCallback((event: AchievementsEvent) =>
{ {
@ -119,7 +114,7 @@ export const AchievementsView: FC<{}> = props =>
}); });
}, []); }, []);
CreateMessageHook(AchievementsEvent, onAchievementsEvent); UseMessageEventHook(AchievementsEvent, onAchievementsEvent);
const onAchievementsScoreEvent = useCallback((event: AchievementsScoreEvent) => const onAchievementsScoreEvent = useCallback((event: AchievementsScoreEvent) =>
{ {
@ -128,7 +123,7 @@ export const AchievementsView: FC<{}> = props =>
setAchievementScore(parser.score); setAchievementScore(parser.score);
}, []); }, []);
CreateMessageHook(AchievementsScoreEvent, onAchievementsScoreEvent); UseMessageEventHook(AchievementsScoreEvent, onAchievementsScoreEvent);
const getTotalUnseen = useMemo(() => const getTotalUnseen = useMemo(() =>
{ {
@ -204,12 +199,12 @@ export const AchievementsView: FC<{}> = props =>
{ {
if(!isVisible || !isInitalized) return; if(!isVisible || !isInitalized) return;
SendMessageHook(new RequestAchievementsMessageComposer()); SendMessageComposer(new RequestAchievementsMessageComposer());
}, [ isVisible, isInitalized ]); }, [ isVisible, isInitalized ]);
useEffect(() => useEffect(() =>
{ {
dispatchUiEvent(new AchievementsUIUnseenCountEvent(getTotalUnseen)); DispatchUiEvent(new AchievementsUIUnseenCountEvent(getTotalUnseen));
}, [ getTotalUnseen ]); }, [ getTotalUnseen ]);
if(!isVisible || !isInitalized) return null; if(!isVisible || !isInitalized) return null;

View File

@ -1,13 +1,13 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { AvatarEditorFigureCategory, FigureSetIdsMessageEvent, GetWardrobeMessageComposer, IAvatarFigureContainer, ILinkEventTracker, UserFigureComposer, UserWardrobePageEvent } from '@nitrots/nitro-renderer'; import { AvatarEditorFigureCategory, FigureSetIdsMessageEvent, GetWardrobeMessageComposer, IAvatarFigureContainer, ILinkEventTracker, UserFigureComposer, UserWardrobePageEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { AddEventLinkTracker, GetAvatarRenderManager, GetClubMemberLevel, GetConfiguration, GetSessionDataManager, LocalizeText, RemoveLinkEventTracker } from '../../api'; import { AddEventLinkTracker, GetAvatarRenderManager, GetClubMemberLevel, GetConfiguration, GetSessionDataManager, LocalizeText, RemoveLinkEventTracker, SendMessageComposer } from '../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common'; import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
import { Button } from '../../common/Button'; import { Button } from '../../common/Button';
import { ButtonGroup } from '../../common/ButtonGroup'; import { ButtonGroup } from '../../common/ButtonGroup';
import { Column } from '../../common/Column'; import { Column } from '../../common/Column';
import { Grid } from '../../common/Grid'; import { Grid } from '../../common/Grid';
import { CreateMessageHook, SendMessageHook } from '../../hooks'; import { UseMessageEventHook } from '../../hooks';
import { AvatarEditorAction } from './common/AvatarEditorAction'; import { AvatarEditorAction } from './common/AvatarEditorAction';
import { AvatarEditorUtilities } from './common/AvatarEditorUtilities'; import { AvatarEditorUtilities } from './common/AvatarEditorUtilities';
import { BodyModel } from './common/BodyModel'; import { BodyModel } from './common/BodyModel';
@ -50,7 +50,7 @@ export const AvatarEditorView: FC<{}> = props =>
setBoundFurnitureNames(parser.boundsFurnitureNames); setBoundFurnitureNames(parser.boundsFurnitureNames);
}, []); }, []);
CreateMessageHook(FigureSetIdsMessageEvent, onFigureSetIdsMessageEvent); UseMessageEventHook(FigureSetIdsMessageEvent, onFigureSetIdsMessageEvent);
const onUserWardrobePageEvent = useCallback((event: UserWardrobePageEvent) => const onUserWardrobePageEvent = useCallback((event: UserWardrobePageEvent) =>
{ {
@ -76,7 +76,7 @@ export const AvatarEditorView: FC<{}> = props =>
setSavedFigures(savedFigures) setSavedFigures(savedFigures)
}, [ maxWardrobeSlots ]); }, [ maxWardrobeSlots ]);
CreateMessageHook(UserWardrobePageEvent, onUserWardrobePageEvent); UseMessageEventHook(UserWardrobePageEvent, onUserWardrobePageEvent);
const selectCategory = useCallback((name: string) => const selectCategory = useCallback((name: string) =>
{ {
@ -152,7 +152,7 @@ export const AvatarEditorView: FC<{}> = props =>
resetCategories(); resetCategories();
return; return;
case AvatarEditorAction.ACTION_SAVE: case AvatarEditorAction.ACTION_SAVE:
SendMessageHook(new UserFigureComposer(figureData.gender, figureData.getFigureString())); SendMessageComposer(new UserFigureComposer(figureData.gender, figureData.getFigureString()));
setIsVisible(false); setIsVisible(false);
return; return;
} }
@ -214,7 +214,7 @@ export const AvatarEditorView: FC<{}> = props =>
if(!isWardrobeVisible) return; if(!isWardrobeVisible) return;
setActiveCategory(null); setActiveCategory(null);
SendMessageHook(new GetWardrobeMessageComposer()); SendMessageComposer(new GetWardrobeMessageComposer());
}, [ isWardrobeVisible ]); }, [ isWardrobeVisible ]);
useEffect(() => useEffect(() =>

View File

@ -1,8 +1,7 @@
import { IAvatarFigureContainer, SaveWardrobeOutfitMessageComposer } from '@nitrots/nitro-renderer'; import { IAvatarFigureContainer, SaveWardrobeOutfitMessageComposer } from '@nitrots/nitro-renderer';
import { Dispatch, FC, SetStateAction, useCallback, useMemo } from 'react'; import { Dispatch, FC, SetStateAction, useCallback, useMemo } from 'react';
import { GetAvatarRenderManager, GetSessionDataManager } from '../../../../api'; import { GetAvatarRenderManager, GetSessionDataManager, SendMessageComposer } from '../../../../api';
import { AutoGrid, Base, Button, Flex, LayoutGridItem } from '../../../../common'; import { AutoGrid, Base, Button, Flex, LayoutGridItem } from '../../../../common';
import { SendMessageHook } from '../../../../hooks';
import { AvatarImageView } from '../../../../views/shared/avatar-image/AvatarImageView'; import { AvatarImageView } from '../../../../views/shared/avatar-image/AvatarImageView';
import { CurrencyIcon } from '../../../../views/shared/currency-icon/CurrencyIcon'; import { CurrencyIcon } from '../../../../views/shared/currency-icon/CurrencyIcon';
import { FigureData } from '../../common/FigureData'; import { FigureData } from '../../common/FigureData';
@ -40,7 +39,7 @@ export const AvatarEditorWardrobeView: FC<AvatarEditorWardrobeViewProps> = props
newFigures[index] = [ GetAvatarRenderManager().createFigureContainer(figure), gender ]; newFigures[index] = [ GetAvatarRenderManager().createFigureContainer(figure), gender ];
setSavedFigures(newFigures); setSavedFigures(newFigures);
SendMessageHook(new SaveWardrobeOutfitMessageComposer((index + 1), figure, gender)); SendMessageComposer(new SaveWardrobeOutfitMessageComposer((index + 1), figure, gender));
}, [ figureData, savedFigures, setSavedFigures ]); }, [ figureData, savedFigures, setSavedFigures ]);
const figures = useMemo(() => const figures = useMemo(() =>

View File

@ -1,9 +1,7 @@
import { ILinkEventTracker, InitCameraMessageEvent, IRoomCameraWidgetEffect, RequestCameraConfigurationComposer, RoomCameraWidgetManagerEvent, RoomSessionEvent } from '@nitrots/nitro-renderer'; import { ILinkEventTracker, InitCameraMessageEvent, IRoomCameraWidgetEffect, RequestCameraConfigurationComposer, RoomCameraWidgetManagerEvent, RoomSessionEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { AddEventLinkTracker, GetRoomCameraWidgetManager, RemoveLinkEventTracker } from '../../api'; import { AddEventLinkTracker, GetRoomCameraWidgetManager, RemoveLinkEventTracker, SendMessageComposer } from '../../api';
import { useRoomSessionManagerEvent } from '../../hooks'; import { UseCameraEvent, UseMessageEventHook, UseRoomSessionManagerEvent } from '../../hooks';
import { useCameraEvent } from '../../hooks/events/nitro/camera/camera-event';
import { CreateMessageHook, SendMessageHook } from '../../hooks/messages/message-event';
import { CameraWidgetContextProvider } from './CameraWidgetContext'; import { CameraWidgetContextProvider } from './CameraWidgetContext';
import { CameraPicture } from './common/CameraPicture'; import { CameraPicture } from './common/CameraPicture';
import { CameraWidgetCaptureView } from './views/capture/CameraWidgetCaptureView'; import { CameraWidgetCaptureView } from './views/capture/CameraWidgetCaptureView';
@ -30,7 +28,7 @@ export const CameraWidgetView: FC<{}> = props =>
setAvailableEffects(Array.from(GetRoomCameraWidgetManager().effects.values())) setAvailableEffects(Array.from(GetRoomCameraWidgetManager().effects.values()))
}, []); }, []);
useCameraEvent(RoomCameraWidgetManagerEvent.INITIALIZED, onRoomCameraWidgetManagerEvent); UseCameraEvent(RoomCameraWidgetManagerEvent.INITIALIZED, onRoomCameraWidgetManagerEvent);
const onCameraConfigurationEvent = useCallback((event: InitCameraMessageEvent) => const onCameraConfigurationEvent = useCallback((event: InitCameraMessageEvent) =>
{ {
@ -39,14 +37,14 @@ export const CameraWidgetView: FC<{}> = props =>
setPrice({ credits: parser.creditPrice, duckets: parser.ducketPrice, publishDucketPrice: parser.publishDucketPrice }); setPrice({ credits: parser.creditPrice, duckets: parser.ducketPrice, publishDucketPrice: parser.publishDucketPrice });
}, []); }, []);
CreateMessageHook(InitCameraMessageEvent, onCameraConfigurationEvent); UseMessageEventHook(InitCameraMessageEvent, onCameraConfigurationEvent);
const onRoomSessionEvent = useCallback((event: RoomSessionEvent) => const onRoomSessionEvent = useCallback((event: RoomSessionEvent) =>
{ {
setMode(MODE_NONE); setMode(MODE_NONE);
}, []); }, []);
useRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent); UseRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent);
useEffect(() => useEffect(() =>
{ {
@ -54,7 +52,7 @@ export const CameraWidgetView: FC<{}> = props =>
{ {
GetRoomCameraWidgetManager().init(); GetRoomCameraWidgetManager().init();
SendMessageHook(new RequestCameraConfigurationComposer()); SendMessageComposer(new RequestCameraConfigurationComposer());
return; return;
} }

View File

@ -1,9 +1,9 @@
import { CameraPublishStatusMessageEvent, CameraPurchaseOKMessageEvent, CameraStorageUrlMessageEvent, PublishPhotoMessageComposer, PurchasePhotoMessageComposer } from '@nitrots/nitro-renderer'; import { CameraPublishStatusMessageEvent, CameraPurchaseOKMessageEvent, CameraStorageUrlMessageEvent, PublishPhotoMessageComposer, PurchasePhotoMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { GetConfiguration, GetRoomEngine, LocalizeText } from '../../../../api'; import { GetConfiguration, GetRoomEngine, LocalizeText, SendMessageComposer } from '../../../../api';
import { Button, Column, Flex, LayoutImage, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { Button, Column, Flex, LayoutImage, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { InventoryEvent } from '../../../../events'; import { InventoryEvent } from '../../../../events';
import { BatchUpdates, CreateMessageHook, dispatchUiEvent, SendMessageHook } from '../../../../hooks'; import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
import { CurrencyIcon } from '../../../../views/shared/currency-icon/CurrencyIcon'; import { CurrencyIcon } from '../../../../views/shared/currency-icon/CurrencyIcon';
export interface CameraWidgetCheckoutViewProps export interface CameraWidgetCheckoutViewProps
@ -33,7 +33,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
}); });
}, []); }, []);
CreateMessageHook(CameraPurchaseOKMessageEvent, onCameraPurchaseOKMessageEvent); UseMessageEventHook(CameraPurchaseOKMessageEvent, onCameraPurchaseOKMessageEvent);
const onCameraPublishStatusMessageEvent = useCallback((event: CameraPublishStatusMessageEvent) => const onCameraPublishStatusMessageEvent = useCallback((event: CameraPublishStatusMessageEvent) =>
{ {
@ -48,7 +48,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
}); });
}, []); }, []);
CreateMessageHook(CameraPublishStatusMessageEvent, onCameraPublishStatusMessageEvent); UseMessageEventHook(CameraPublishStatusMessageEvent, onCameraPublishStatusMessageEvent);
const onCameraStorageUrlMessageEvent = useCallback((event: CameraStorageUrlMessageEvent) => const onCameraStorageUrlMessageEvent = useCallback((event: CameraStorageUrlMessageEvent) =>
{ {
@ -57,7 +57,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
setPictureUrl(GetConfiguration<string>('camera.url') + '/' + parser.url); setPictureUrl(GetConfiguration<string>('camera.url') + '/' + parser.url);
}, []); }, []);
CreateMessageHook(CameraStorageUrlMessageEvent, onCameraStorageUrlMessageEvent); UseMessageEventHook(CameraStorageUrlMessageEvent, onCameraStorageUrlMessageEvent);
const processAction = (type: string, value: string | number = null) => const processAction = (type: string, value: string | number = null) =>
{ {
@ -70,13 +70,13 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
if(isWaiting) return; if(isWaiting) return;
setIsWaiting(true); setIsWaiting(true);
SendMessageHook(new PurchasePhotoMessageComposer('')); SendMessageComposer(new PurchasePhotoMessageComposer(''));
return; return;
case 'publish': case 'publish':
if(isWaiting) return; if(isWaiting) return;
setIsWaiting(true); setIsWaiting(true);
SendMessageHook(new PublishPhotoMessageComposer()); SendMessageComposer(new PublishPhotoMessageComposer());
return; return;
case 'cancel': case 'cancel':
onCancelClick(); onCancelClick();
@ -127,7 +127,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
{ (picturesBought > 0) && { (picturesBought > 0) &&
<Text> <Text>
<Text bold>{ LocalizeText('camera.purchase.count.info') }</Text> { picturesBought } <Text bold>{ LocalizeText('camera.purchase.count.info') }</Text> { picturesBought }
<u className="ms-1 cursor-pointer" onClick={ () => dispatchUiEvent(new InventoryEvent(InventoryEvent.SHOW_INVENTORY)) }>{ LocalizeText('camera.open.inventory') }</u> <u className="ms-1 cursor-pointer" onClick={ () => DispatchUiEvent(new InventoryEvent(InventoryEvent.SHOW_INVENTORY)) }>{ LocalizeText('camera.open.inventory') }</u>
</Text> } </Text> }
</Column> </Column>
<Flex alignItems="center"> <Flex alignItems="center">

View File

@ -2,13 +2,8 @@ import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent
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 } from '../../api'; import { GetFurnitureData, GetProductDataForLocalization, LocalizeText } from '../../api';
import { CatalogNameResultEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogSetExtraPurchaseParameterEvent } from '../../events'; import { CatalogGiftReceiverNotFoundEvent, CatalogNameResultEvent, CatalogPurchasedEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent, CatalogSetExtraPurchaseParameterEvent } from '../../events';
import { CatalogGiftReceiverNotFoundEvent } from '../../events/catalog/CatalogGiftReceiverNotFoundEvent'; import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../hooks';
import { CatalogPurchasedEvent } from '../../events/catalog/CatalogPurchasedEvent';
import { CatalogPurchaseSoldOutEvent } from '../../events/catalog/CatalogPurchaseSoldOutEvent';
import { BatchUpdates } from '../../hooks';
import { dispatchUiEvent } from '../../hooks/events/ui/ui-event';
import { CreateMessageHook } from '../../hooks/messages/message-event';
import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType'; import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType';
import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities';
import { useCatalogContext } from './CatalogContext'; import { useCatalogContext } from './CatalogContext';
@ -102,28 +97,28 @@ export const CatalogMessageHandler: FC<{}> = props =>
{ {
const parser = event.getParser(); const parser = event.getParser();
dispatchUiEvent(new CatalogPurchasedEvent(parser.offer)); DispatchUiEvent(new CatalogPurchasedEvent(parser.offer));
}, []); }, []);
const onPurchaseErrorMessageEvent = useCallback((event: PurchaseErrorMessageEvent) => const onPurchaseErrorMessageEvent = useCallback((event: PurchaseErrorMessageEvent) =>
{ {
const parser = event.getParser(); const parser = event.getParser();
dispatchUiEvent(new CatalogPurchaseFailureEvent(parser.code)); DispatchUiEvent(new CatalogPurchaseFailureEvent(parser.code));
}, []); }, []);
const onPurchaseNotAllowedMessageEvent = useCallback((event: PurchaseNotAllowedMessageEvent) => const onPurchaseNotAllowedMessageEvent = useCallback((event: PurchaseNotAllowedMessageEvent) =>
{ {
const parser = event.getParser(); const parser = event.getParser();
dispatchUiEvent(new CatalogPurchaseNotAllowedEvent(parser.code)); DispatchUiEvent(new CatalogPurchaseNotAllowedEvent(parser.code));
}, []); }, []);
const onLimitedEditionSoldOutEvent = useCallback((event: LimitedEditionSoldOutEvent) => const onLimitedEditionSoldOutEvent = useCallback((event: LimitedEditionSoldOutEvent) =>
{ {
const parser = event.getParser(); const parser = event.getParser();
dispatchUiEvent(new CatalogPurchaseSoldOutEvent()); DispatchUiEvent(new CatalogPurchaseSoldOutEvent());
}, []); }, []);
const onProductOfferEvent = useCallback((event: ProductOfferEvent) => const onProductOfferEvent = useCallback((event: ProductOfferEvent) =>
@ -160,7 +155,7 @@ export const CatalogMessageHandler: FC<{}> = props =>
if(offer.product && (offer.product.productType === ProductTypeEnum.WALL)) if(offer.product && (offer.product.productType === ProductTypeEnum.WALL))
{ {
dispatchUiEvent(new CatalogSetExtraPurchaseParameterEvent(offer.product.extraParam)); DispatchUiEvent(new CatalogSetExtraPurchaseParameterEvent(offer.product.extraParam));
} }
// (this._isObjectMoverRequested) && (this._purchasableOffer) // (this._isObjectMoverRequested) && (this._purchasableOffer)
@ -199,12 +194,12 @@ export const CatalogMessageHandler: FC<{}> = props =>
{ {
const parser = event.getParser(); const parser = event.getParser();
dispatchUiEvent(new CatalogNameResultEvent(parser.result, parser.validationInfo)); DispatchUiEvent(new CatalogNameResultEvent(parser.result, parser.validationInfo));
}, []); }, []);
const onGiftReceiverNotFoundEvent = useCallback(() => const onGiftReceiverNotFoundEvent = useCallback(() =>
{ {
dispatchUiEvent(new CatalogGiftReceiverNotFoundEvent()); DispatchUiEvent(new CatalogGiftReceiverNotFoundEvent());
}, []); }, []);
const onHabboClubOffersMessageEvent = useCallback((event: HabboClubOffersMessageEvent) => const onHabboClubOffersMessageEvent = useCallback((event: HabboClubOffersMessageEvent) =>
@ -310,24 +305,24 @@ export const CatalogMessageHandler: FC<{}> = props =>
}); });
}, [ setCatalogOptions ]); }, [ setCatalogOptions ]);
CreateMessageHook(CatalogPagesListEvent, onCatalogPagesListEvent); UseMessageEventHook(CatalogPagesListEvent, onCatalogPagesListEvent);
CreateMessageHook(CatalogPageMessageEvent, onCatalogPageMessageEvent); UseMessageEventHook(CatalogPageMessageEvent, onCatalogPageMessageEvent);
CreateMessageHook(PurchaseOKMessageEvent, onPurchaseOKMessageEvent); UseMessageEventHook(PurchaseOKMessageEvent, onPurchaseOKMessageEvent);
CreateMessageHook(PurchaseErrorMessageEvent, onPurchaseErrorMessageEvent); UseMessageEventHook(PurchaseErrorMessageEvent, onPurchaseErrorMessageEvent);
CreateMessageHook(PurchaseNotAllowedMessageEvent, onPurchaseNotAllowedMessageEvent); UseMessageEventHook(PurchaseNotAllowedMessageEvent, onPurchaseNotAllowedMessageEvent);
CreateMessageHook(LimitedEditionSoldOutEvent, onLimitedEditionSoldOutEvent); UseMessageEventHook(LimitedEditionSoldOutEvent, onLimitedEditionSoldOutEvent);
CreateMessageHook(ProductOfferEvent, onProductOfferEvent); UseMessageEventHook(ProductOfferEvent, onProductOfferEvent);
CreateMessageHook(GuildMembershipsMessageEvent, onGuildMembershipsMessageEvent); UseMessageEventHook(GuildMembershipsMessageEvent, onGuildMembershipsMessageEvent);
CreateMessageHook(SellablePetPalettesMessageEvent, onSellablePetPalettesMessageEvent); UseMessageEventHook(SellablePetPalettesMessageEvent, onSellablePetPalettesMessageEvent);
CreateMessageHook(ApproveNameMessageEvent, onApproveNameMessageEvent); UseMessageEventHook(ApproveNameMessageEvent, onApproveNameMessageEvent);
CreateMessageHook(GiftReceiverNotFoundEvent, onGiftReceiverNotFoundEvent); UseMessageEventHook(GiftReceiverNotFoundEvent, onGiftReceiverNotFoundEvent);
CreateMessageHook(HabboClubOffersMessageEvent, onHabboClubOffersMessageEvent); UseMessageEventHook(HabboClubOffersMessageEvent, onHabboClubOffersMessageEvent);
CreateMessageHook(UserSubscriptionEvent, onUserSubscriptionEvent); UseMessageEventHook(UserSubscriptionEvent, onUserSubscriptionEvent);
CreateMessageHook(CatalogPublishedMessageEvent, onCatalogPublishedMessageEvent); UseMessageEventHook(CatalogPublishedMessageEvent, onCatalogPublishedMessageEvent);
CreateMessageHook(GiftWrappingConfigurationEvent, onGiftWrappingConfigurationEvent); UseMessageEventHook(GiftWrappingConfigurationEvent, onGiftWrappingConfigurationEvent);
CreateMessageHook(ClubGiftInfoEvent, onClubGiftInfoEvent); UseMessageEventHook(ClubGiftInfoEvent, onClubGiftInfoEvent);
CreateMessageHook(MarketplaceMakeOfferResult, onMarketplaceMakeOfferResult); UseMessageEventHook(MarketplaceMakeOfferResult, onMarketplaceMakeOfferResult);
CreateMessageHook(MarketplaceConfigurationEvent, onMarketplaceConfigurationEvent); UseMessageEventHook(MarketplaceConfigurationEvent, onMarketplaceConfigurationEvent);
return null; return null;
} }

View File

@ -1,14 +1,9 @@
import { FrontPageItem, GetCatalogIndexComposer, GetCatalogPageComposer, GetClubGiftInfo, GetGiftWrappingConfigurationComposer, GetMarketplaceConfigurationMessageComposer, ILinkEventTracker, RoomPreviewer } from '@nitrots/nitro-renderer'; import { FrontPageItem, GetCatalogIndexComposer, GetCatalogPageComposer, GetClubGiftInfo, GetGiftWrappingConfigurationComposer, GetMarketplaceConfigurationMessageComposer, ILinkEventTracker, RoomPreviewer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { AddEventLinkTracker, GetRoomEngine, LocalizeText, RemoveLinkEventTracker } from '../../api'; import { AddEventLinkTracker, CREDITS, GetRoomEngine, LocalizeText, PlaySound, RemoveLinkEventTracker, SendMessageComposer } from '../../api';
import { CREDITS, PlaySound } from '../../api/utils/PlaySound'; import { Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
import { Column } from '../../common/Column';
import { Grid } from '../../common/Grid';
import { CatalogPurchasedEvent } from '../../events'; import { CatalogPurchasedEvent } from '../../events';
import { BatchUpdates } from '../../hooks'; import { BatchUpdates, UseUiEvent } from '../../hooks';
import { useUiEvent } from '../../hooks/events/ui/ui-event';
import { SendMessageHook } from '../../hooks/messages/message-event';
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';
@ -119,7 +114,7 @@ export const CatalogView: FC<{}> = props =>
setPageId(pageId); setPageId(pageId);
}); });
if(pageId > -1) SendMessageHook(new GetCatalogPageComposer(pageId, offerId, currentType)); if(pageId > -1) SendMessageComposer(new GetCatalogPageComposer(pageId, offerId, currentType));
}, [ currentType ]); }, [ currentType ]);
const showCatalogPage = useCallback((pageId: number, layoutCode: string, localization: IPageLocalization, offers: IPurchasableOffer[], offerId: number, acceptSeasonCurrencyAsCredits: boolean) => const showCatalogPage = useCallback((pageId: number, layoutCode: string, localization: IPageLocalization, offers: IPurchasableOffer[], offerId: number, acceptSeasonCurrencyAsCredits: boolean) =>
@ -276,7 +271,7 @@ export const CatalogView: FC<{}> = props =>
PlaySound(CREDITS); PlaySound(CREDITS);
}, []); }, []);
useUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogPurchasedEvent); UseUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogPurchasedEvent);
const linkReceived = useCallback((url: string) => const linkReceived = useCallback((url: string) =>
{ {
@ -352,10 +347,10 @@ export const CatalogView: FC<{}> = props =>
{ {
if(!isVisible || rootNode) return; if(!isVisible || rootNode) return;
SendMessageHook(new GetMarketplaceConfigurationMessageComposer()); SendMessageComposer(new GetMarketplaceConfigurationMessageComposer());
SendMessageHook(new GetGiftWrappingConfigurationComposer()); SendMessageComposer(new GetGiftWrappingConfigurationComposer());
SendMessageHook(new GetClubGiftInfo()); SendMessageComposer(new GetClubGiftInfo());
SendMessageHook(new GetCatalogIndexComposer(currentType)); SendMessageComposer(new GetCatalogIndexComposer(currentType));
}, [ isVisible, rootNode, currentType ]); }, [ isVisible, rootNode, currentType ]);
useEffect(() => useEffect(() =>

View File

@ -1,6 +1,5 @@
import { GetProductOfferComposer, IFurnitureData } from '@nitrots/nitro-renderer'; import { GetProductOfferComposer, IFurnitureData } from '@nitrots/nitro-renderer';
import { GetProductDataForLocalization } from '../../../api'; import { GetProductDataForLocalization, SendMessageComposer } from '../../../api';
import { SendMessageHook } from '../../../hooks';
import { ICatalogPage } from './ICatalogPage'; import { ICatalogPage } from './ICatalogPage';
import { IProduct } from './IProduct'; import { IProduct } from './IProduct';
import { IPurchasableOffer } from './IPurchasableOffer'; import { IPurchasableOffer } from './IPurchasableOffer';
@ -21,7 +20,7 @@ export class FurnitureOffer implements IPurchasableOffer
public activate(): void public activate(): void
{ {
SendMessageHook(new GetProductOfferComposer((this._furniData.rentOfferId > -1) ? this._furniData.rentOfferId : this._furniData.purchaseOfferId)); SendMessageComposer(new GetProductOfferComposer((this._furniData.rentOfferId > -1) ? this._furniData.rentOfferId : this._furniData.purchaseOfferId));
} }
public get offerId(): number public get offerId(): number

View File

@ -2,7 +2,7 @@ import { NitroToolbarAnimateIconEvent, TextureUtils, ToolbarIconEnum } from '@ni
import { FC, useCallback, useRef } from 'react'; import { FC, useCallback, useRef } from 'react';
import { GetRoomEngine } from '../../../../api'; import { GetRoomEngine } from '../../../../api';
import { CatalogPurchasedEvent } from '../../../../events'; import { CatalogPurchasedEvent } from '../../../../events';
import { useUiEvent } from '../../../../hooks'; import { UseUiEvent } from '../../../../hooks';
import { RoomPreviewerView, RoomPreviewerViewProps } from '../../../../views/shared/room-previewer/RoomPreviewerView'; import { RoomPreviewerView, RoomPreviewerViewProps } from '../../../../views/shared/room-previewer/RoomPreviewerView';
export const CatalogRoomPreviewerView: FC<RoomPreviewerViewProps> = props => export const CatalogRoomPreviewerView: FC<RoomPreviewerViewProps> = props =>
@ -39,7 +39,7 @@ export const CatalogRoomPreviewerView: FC<RoomPreviewerViewProps> = props =>
animatePurchase(); animatePurchase();
}, [ animatePurchase ]); }, [ animatePurchase ]);
useUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogPurchasedEvent); UseUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogPurchasedEvent);
return ( return (
<div ref={ elementRef }> <div ref={ elementRef }>

View File

@ -2,11 +2,11 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { PurchaseFromCatalogAsGiftComposer } from '@nitrots/nitro-renderer'; import { PurchaseFromCatalogAsGiftComposer } from '@nitrots/nitro-renderer';
import classNames from 'classnames'; import classNames from 'classnames';
import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { GetSessionDataManager, LocalizeText } from '../../../../api'; import { GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../../api';
import { Base, Button, ButtonGroup, Column, Flex, FormGroup, LayoutGiftTagView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { Base, Button, ButtonGroup, Column, Flex, FormGroup, LayoutGiftTagView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { CatalogEvent, CatalogPurchasedEvent } from '../../../../events'; import { CatalogEvent, CatalogPurchasedEvent } from '../../../../events';
import { CatalogInitGiftEvent } from '../../../../events/catalog/CatalogInitGiftEvent'; import { CatalogInitGiftEvent } from '../../../../events/catalog/CatalogInitGiftEvent';
import { BatchUpdates, SendMessageHook, useUiEvent } from '../../../../hooks'; import { BatchUpdates, UseUiEvent } from '../../../../hooks';
import { CurrencyIcon } from '../../../../views/shared/currency-icon/CurrencyIcon'; import { CurrencyIcon } from '../../../../views/shared/currency-icon/CurrencyIcon';
import { FurniImageView } from '../../../../views/shared/furni-image/FurniImageView'; import { FurniImageView } from '../../../../views/shared/furni-image/FurniImageView';
import { useCatalogContext } from '../../CatalogContext'; import { useCatalogContext } from '../../CatalogContext';
@ -75,9 +75,9 @@ export const CatalogGiftView: FC<{}> = props =>
} }
}, [ close ]); }, [ close ]);
useUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogEvent); UseUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogEvent);
useUiEvent(CatalogEvent.INIT_GIFT, onCatalogEvent); UseUiEvent(CatalogEvent.INIT_GIFT, onCatalogEvent);
useUiEvent(CatalogEvent.GIFT_RECEIVER_NOT_FOUND, onCatalogEvent); UseUiEvent(CatalogEvent.GIFT_RECEIVER_NOT_FOUND, onCatalogEvent);
const isBoxDefault = useMemo(() => const isBoxDefault = useMemo(() =>
{ {
@ -123,7 +123,7 @@ export const CatalogGiftView: FC<{}> = props =>
return; return;
} }
SendMessageHook(new PurchaseFromCatalogAsGiftComposer(pageId, offerId, extraData, receiverName, message, selectedColorId, selectedBoxIndex, selectedRibbonIndex, showMyFace)); SendMessageComposer(new PurchaseFromCatalogAsGiftComposer(pageId, offerId, extraData, receiverName, message, selectedColorId, selectedBoxIndex, selectedRibbonIndex, showMyFace));
return; return;
} }
}, [ extraData, maxBoxIndex, maxRibbonIndex, message, offerId, pageId, receiverName, selectedBoxIndex, selectedColorId, selectedRibbonIndex, showMyFace ]); }, [ extraData, maxBoxIndex, maxRibbonIndex, message, offerId, pageId, receiverName, selectedBoxIndex, selectedColorId, selectedRibbonIndex, showMyFace ]);

View File

@ -1,10 +1,9 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { RedeemVoucherMessageComposer, VoucherRedeemErrorMessageEvent, VoucherRedeemOkMessageEvent } from '@nitrots/nitro-renderer'; import { RedeemVoucherMessageComposer, VoucherRedeemErrorMessageEvent, VoucherRedeemOkMessageEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { LocalizeText } from '../../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../../api';
import { Button } from '../../../../../common/Button'; import { Button, Flex } from '../../../../../common';
import { Flex } from '../../../../../common/Flex'; import { BatchUpdates, UseMessageEventHook } from '../../../../../hooks';
import { BatchUpdates, CreateMessageHook, SendMessageHook } from '../../../../../hooks';
import { NotificationUtilities } from '../../../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../../../views/notification-center/common/NotificationUtilities';
export interface CatalogRedeemVoucherViewProps export interface CatalogRedeemVoucherViewProps
@ -22,7 +21,7 @@ export const CatalogRedeemVoucherView: FC<CatalogRedeemVoucherViewProps> = props
{ {
if(!voucher || !voucher.length || isWaiting) return; if(!voucher || !voucher.length || isWaiting) return;
SendMessageHook(new RedeemVoucherMessageComposer(voucher)); SendMessageComposer(new RedeemVoucherMessageComposer(voucher));
setIsWaiting(true); setIsWaiting(true);
} }
@ -44,7 +43,7 @@ export const CatalogRedeemVoucherView: FC<CatalogRedeemVoucherViewProps> = props
}); });
}, []); }, []);
CreateMessageHook(VoucherRedeemOkMessageEvent, onVoucherRedeemOkMessageEvent); UseMessageEventHook(VoucherRedeemOkMessageEvent, onVoucherRedeemOkMessageEvent);
const onVoucherRedeemErrorMessageEvent = useCallback((event: VoucherRedeemErrorMessageEvent) => const onVoucherRedeemErrorMessageEvent = useCallback((event: VoucherRedeemErrorMessageEvent) =>
{ {
@ -55,7 +54,7 @@ export const CatalogRedeemVoucherView: FC<CatalogRedeemVoucherViewProps> = props
setIsWaiting(false); setIsWaiting(false);
}, []); }, []);
CreateMessageHook(VoucherRedeemErrorMessageEvent, onVoucherRedeemErrorMessageEvent); UseMessageEventHook(VoucherRedeemErrorMessageEvent, onVoucherRedeemErrorMessageEvent);
return ( return (
<Flex gap={ 1 }> <Flex gap={ 1 }>

View File

@ -1,11 +1,7 @@
import { CatalogGroupsComposer } from '@nitrots/nitro-renderer'; import { CatalogGroupsComposer } from '@nitrots/nitro-renderer';
import { FC, useEffect, useState } from 'react'; import { FC, useEffect, useState } from 'react';
import { Base } from '../../../../../common/Base'; import { SendMessageComposer } from '../../../../../api';
import { Column } from '../../../../../common/Column'; import { Base, Column, Flex, Grid, Text } from '../../../../../common';
import { Flex } from '../../../../../common/Flex';
import { Grid } from '../../../../../common/Grid';
import { Text } from '../../../../../common/Text';
import { SendMessageHook } from '../../../../../hooks/messages';
import { useCatalogContext } from '../../../CatalogContext'; import { useCatalogContext } from '../../../CatalogContext';
import { CatalogFirstProductSelectorWidgetView } from '../widgets/CatalogFirstProductSelectorWidgetView'; import { CatalogFirstProductSelectorWidgetView } from '../widgets/CatalogFirstProductSelectorWidgetView';
import { CatalogGuildSelectorWidgetView } from '../widgets/CatalogGuildSelectorWidgetView'; import { CatalogGuildSelectorWidgetView } from '../widgets/CatalogGuildSelectorWidgetView';
@ -22,7 +18,7 @@ export const CatalogLayouGuildForumView: FC<CatalogLayoutProps> = props =>
useEffect(() => useEffect(() =>
{ {
SendMessageHook(new CatalogGroupsComposer()); SendMessageComposer(new CatalogGroupsComposer());
}, [ page ]); }, [ page ]);
return ( return (

View File

@ -1,18 +1,9 @@
import { ClubOfferData, GetClubOffersMessageComposer, PurchaseFromCatalogComposer } from '@nitrots/nitro-renderer'; import { ClubOfferData, GetClubOffersMessageComposer, PurchaseFromCatalogComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { LocalizeText } from '../../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../../api';
import { AutoGrid } from '../../../../../common/AutoGrid'; import { AutoGrid, Button, Column, Flex, Grid, LayoutGridItem, LayoutLoadingSpinnerView, Text } from '../../../../../common';
import { Button } from '../../../../../common/Button'; import { CatalogEvent, CatalogPurchasedEvent, CatalogPurchaseFailureEvent } from '../../../../../events';
import { Column } from '../../../../../common/Column'; import { UseUiEvent } from '../../../../../hooks';
import { Flex } from '../../../../../common/Flex';
import { Grid } from '../../../../../common/Grid';
import { LayoutGridItem } from '../../../../../common/layout/LayoutGridItem';
import { LayoutLoadingSpinnerView } from '../../../../../common/layout/LayoutLoadingSpinnerView';
import { Text } from '../../../../../common/Text';
import { CatalogPurchasedEvent, CatalogPurchaseFailureEvent } from '../../../../../events';
import { CatalogEvent } from '../../../../../events/catalog/CatalogEvent';
import { useUiEvent } from '../../../../../hooks';
import { SendMessageHook } from '../../../../../hooks/messages/message-event';
import { CurrencyIcon } from '../../../../../views/shared/currency-icon/CurrencyIcon'; import { CurrencyIcon } from '../../../../../views/shared/currency-icon/CurrencyIcon';
import { GetCurrencyAmount } from '../../../../purse/common/CurrencyHelper'; import { GetCurrencyAmount } from '../../../../purse/common/CurrencyHelper';
import { GLOBAL_PURSE } from '../../../../purse/PurseView'; import { GLOBAL_PURSE } from '../../../../purse/PurseView';
@ -40,8 +31,8 @@ export const CatalogLayoutVipBuyView: FC<CatalogLayoutProps> = props =>
} }
}, []); }, []);
useUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogEvent); UseUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogEvent);
useUiEvent(CatalogPurchaseFailureEvent.PURCHASE_FAILED, onCatalogEvent); UseUiEvent(CatalogPurchaseFailureEvent.PURCHASE_FAILED, onCatalogEvent);
const getOfferText = useCallback((offer: ClubOfferData) => const getOfferText = useCallback((offer: ClubOfferData) =>
{ {
@ -103,7 +94,7 @@ export const CatalogLayoutVipBuyView: FC<CatalogLayoutProps> = props =>
if(!pendingOffer) return; if(!pendingOffer) return;
setPurchaseState(CatalogPurchaseState.PURCHASE); setPurchaseState(CatalogPurchaseState.PURCHASE);
SendMessageHook(new PurchaseFromCatalogComposer(currentPage.pageId, pendingOffer.offerId, null, 1)); SendMessageComposer(new PurchaseFromCatalogComposer(currentPage.pageId, pendingOffer.offerId, null, 1));
}, [ pendingOffer, currentPage ]); }, [ pendingOffer, currentPage ]);
const setOffer = useCallback((offer: ClubOfferData) => const setOffer = useCallback((offer: ClubOfferData) =>
@ -142,7 +133,7 @@ export const CatalogLayoutVipBuyView: FC<CatalogLayoutProps> = props =>
useEffect(() => useEffect(() =>
{ {
if(!clubOffers) SendMessageHook(new GetClubOffersMessageComposer(1)); if(!clubOffers) SendMessageComposer(new GetClubOffersMessageComposer(1));
}, [ clubOffers ]); }, [ clubOffers ]);
return ( return (

View File

@ -1,11 +1,8 @@
import { CancelMarketplaceOfferMessageComposer, GetMarketplaceOwnOffersMessageComposer, MarketplaceCancelOfferResultEvent, MarketplaceOwnOffersEvent, RedeemMarketplaceOfferCreditsMessageComposer } from '@nitrots/nitro-renderer'; import { CancelMarketplaceOfferMessageComposer, GetMarketplaceOwnOffersMessageComposer, MarketplaceCancelOfferResultEvent, MarketplaceOwnOffersEvent, RedeemMarketplaceOfferCreditsMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useMemo, useState } from 'react'; import { FC, useCallback, useMemo, useState } from 'react';
import { LocalizeText } from '../../../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../../../api';
import { Button } from '../../../../../../common/Button'; import { Button, Column, Grid, Text } from '../../../../../../common';
import { Column } from '../../../../../../common/Column'; import { BatchUpdates, UseMessageEventHook, UseMountEffect } from '../../../../../../hooks';
import { Grid } from '../../../../../../common/Grid';
import { Text } from '../../../../../../common/Text';
import { BatchUpdates, CreateMessageHook, SendMessageHook, UseMountEffect } from '../../../../../../hooks';
import { NotificationAlertType } from '../../../../../../views/notification-center/common/NotificationAlertType'; import { NotificationAlertType } from '../../../../../../views/notification-center/common/NotificationAlertType';
import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities';
import { CatalogLayoutProps } from '../CatalogLayout.types'; import { CatalogLayoutProps } from '../CatalogLayout.types';
@ -40,7 +37,7 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC<CatalogLayoutProps> = prop
}); });
}, []); }, []);
CreateMessageHook(MarketplaceOwnOffersEvent, onMarketPlaceOwnOffersEvent); UseMessageEventHook(MarketplaceOwnOffersEvent, onMarketPlaceOwnOffersEvent);
const onMarketplaceCancelOfferResultEvent = useCallback((event:MarketplaceCancelOfferResultEvent) => const onMarketplaceCancelOfferResultEvent = useCallback((event:MarketplaceCancelOfferResultEvent) =>
{ {
@ -58,7 +55,7 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC<CatalogLayoutProps> = prop
setOffers(prevValue => prevValue.filter(value => (value.offerId !== parser.offerId))); setOffers(prevValue => prevValue.filter(value => (value.offerId !== parser.offerId)));
}, []); }, []);
CreateMessageHook(MarketplaceCancelOfferResultEvent, onMarketplaceCancelOfferResultEvent); UseMessageEventHook(MarketplaceCancelOfferResultEvent, onMarketplaceCancelOfferResultEvent);
const soldOffers = useMemo(() => const soldOffers = useMemo(() =>
{ {
@ -74,17 +71,17 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC<CatalogLayoutProps> = prop
return prevValue.filter(value => (idsToDelete.indexOf(value.offerId) === -1)); return prevValue.filter(value => (idsToDelete.indexOf(value.offerId) === -1));
}) })
SendMessageHook(new RedeemMarketplaceOfferCreditsMessageComposer()); SendMessageComposer(new RedeemMarketplaceOfferCreditsMessageComposer());
}, [ soldOffers ]); }, [ soldOffers ]);
const takeItemBack = (offerData: MarketplaceOfferData) => const takeItemBack = (offerData: MarketplaceOfferData) =>
{ {
SendMessageHook(new CancelMarketplaceOfferMessageComposer(offerData.offerId)); SendMessageComposer(new CancelMarketplaceOfferMessageComposer(offerData.offerId));
}; };
UseMountEffect(() => UseMountEffect(() =>
{ {
SendMessageHook(new GetMarketplaceOwnOffersMessageComposer()); SendMessageComposer(new GetMarketplaceOwnOffersMessageComposer());
}); });
return ( return (

View File

@ -1,12 +1,8 @@
import { BuyMarketplaceOfferMessageComposer, GetMarketplaceOffersMessageComposer, MarketplaceBuyOfferResultEvent, MarketPlaceOffersEvent } from '@nitrots/nitro-renderer'; import { BuyMarketplaceOfferMessageComposer, GetMarketplaceOffersMessageComposer, MarketplaceBuyOfferResultEvent, MarketPlaceOffersEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useMemo, useState } from 'react'; import { FC, useCallback, useMemo, useState } from 'react';
import { LocalizeText } from '../../../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../../../api';
import { Button } from '../../../../../../common/Button'; import { Button, ButtonGroup, Column, Grid, Text } from '../../../../../../common';
import { ButtonGroup } from '../../../../../../common/ButtonGroup'; import { BatchUpdates, UseMessageEventHook } from '../../../../../../hooks';
import { Column } from '../../../../../../common/Column';
import { Grid } from '../../../../../../common/Grid';
import { Text } from '../../../../../../common/Text';
import { BatchUpdates, CreateMessageHook, SendMessageHook } from '../../../../../../hooks';
import { NotificationAlertType } from '../../../../../../views/notification-center/common/NotificationAlertType'; import { NotificationAlertType } from '../../../../../../views/notification-center/common/NotificationAlertType';
import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities';
import { GetCurrencyAmount } from '../../../../../purse/common/CurrencyHelper'; import { GetCurrencyAmount } from '../../../../../purse/common/CurrencyHelper';
@ -35,7 +31,7 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
const requestOffers = useCallback((options: IMarketplaceSearchOptions) => const requestOffers = useCallback((options: IMarketplaceSearchOptions) =>
{ {
setLastSearch(options); setLastSearch(options);
SendMessageHook(new GetMarketplaceOffersMessageComposer(options.minPrice, options.maxPrice, options.query, options.type)) SendMessageComposer(new GetMarketplaceOffersMessageComposer(options.minPrice, options.maxPrice, options.query, options.type))
}, []); }, []);
const getSortTypes = useMemo( () => const getSortTypes = useMemo( () =>
@ -62,7 +58,7 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
const offerId = offerData.offerId; const offerId = offerData.offerId;
NotificationUtilities.confirm(LocalizeText('catalog.marketplace.confirm_header'), () => NotificationUtilities.confirm(LocalizeText('catalog.marketplace.confirm_header'), () =>
{ {
SendMessageHook(new BuyMarketplaceOfferMessageComposer(offerId)); SendMessageComposer(new BuyMarketplaceOfferMessageComposer(offerId));
}, },
null, null, null, LocalizeText('catalog.marketplace.confirm_title')); null, null, null, LocalizeText('catalog.marketplace.confirm_title'));
},[]); },[]);
@ -132,7 +128,7 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
NotificationUtilities.confirm(LocalizeText('catalog.marketplace.confirm_higher_header') + NotificationUtilities.confirm(LocalizeText('catalog.marketplace.confirm_higher_header') +
'\n' + LocalizeText('catalog.marketplace.confirm_price', ['price'], [parser.newPrice.toString()]), () => '\n' + LocalizeText('catalog.marketplace.confirm_price', ['price'], [parser.newPrice.toString()]), () =>
{ {
SendMessageHook(new BuyMarketplaceOfferMessageComposer(parser.offerId)); SendMessageComposer(new BuyMarketplaceOfferMessageComposer(parser.offerId));
}, },
null, null, null, LocalizeText('catalog.marketplace.confirm_higher_title')); null, null, null, LocalizeText('catalog.marketplace.confirm_higher_title'));
break; break;
@ -142,8 +138,8 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
} }
}, [lastSearch, requestOffers]); }, [lastSearch, requestOffers]);
CreateMessageHook(MarketPlaceOffersEvent, onMarketPlaceOffersEvent); UseMessageEventHook(MarketPlaceOffersEvent, onMarketPlaceOffersEvent);
CreateMessageHook(MarketplaceBuyOfferResultEvent, onMarketplaceBuyOfferResultEvent); UseMessageEventHook(MarketplaceBuyOfferResultEvent, onMarketplaceBuyOfferResultEvent);
return ( return (
<> <>

View File

@ -1,9 +1,9 @@
import { ImageResult, MakeOfferMessageComposer, Vector3d } from '@nitrots/nitro-renderer'; import { ImageResult, MakeOfferMessageComposer, Vector3d } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { GetRoomEngine, LocalizeText } from '../../../../../../api'; import { GetRoomEngine, LocalizeText, SendMessageComposer } from '../../../../../../api';
import { Base, Button, Column, Grid, LayoutImage, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../../common'; import { Base, Button, Column, Grid, LayoutImage, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../../common';
import { CatalogPostMarketplaceOfferEvent } from '../../../../../../events'; import { CatalogPostMarketplaceOfferEvent } from '../../../../../../events';
import { BatchUpdates, SendMessageHook, useUiEvent } from '../../../../../../hooks'; import { BatchUpdates, UseUiEvent } from '../../../../../../hooks';
import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities';
import { FurnitureItem } from '../../../../../inventory/common/FurnitureItem'; import { FurnitureItem } from '../../../../../inventory/common/FurnitureItem';
import { useCatalogContext } from '../../../../CatalogContext'; import { useCatalogContext } from '../../../../CatalogContext';
@ -29,7 +29,7 @@ export const MarketplacePostOfferView : FC<{}> = props =>
setItem(event.item); setItem(event.item);
}, []); }, []);
useUiEvent(CatalogPostMarketplaceOfferEvent.POST_MARKETPLACE, onCatalogPostMarketplaceOfferEvent); UseUiEvent(CatalogPostMarketplaceOfferEvent.POST_MARKETPLACE, onCatalogPostMarketplaceOfferEvent);
const getItemImage = useCallback( () => const getItemImage = useCallback( () =>
{ {
@ -79,7 +79,7 @@ export const MarketplacePostOfferView : FC<{}> = props =>
NotificationUtilities.confirm(LocalizeText('inventory.marketplace.confirm_offer.info', ['furniname', 'price'], [getFurniTitle(), askingPrice.toString()]), () => NotificationUtilities.confirm(LocalizeText('inventory.marketplace.confirm_offer.info', ['furniname', 'price'], [getFurniTitle(), askingPrice.toString()]), () =>
{ {
SendMessageHook(new MakeOfferMessageComposer(askingPrice, item.isWallItem ? 2 : 1, item.id)); SendMessageComposer(new MakeOfferMessageComposer(askingPrice, item.isWallItem ? 2 : 1, item.id));
setItem(null); setItem(null);
}, },
() => { setItem(null)}, null, null, LocalizeText('inventory.marketplace.confirm_offer.title')); () => { setItem(null)}, null, null, LocalizeText('inventory.marketplace.confirm_offer.title'));

View File

@ -1,12 +1,9 @@
import { ApproveNameMessageComposer } from '@nitrots/nitro-renderer'; import { ApproveNameMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { LocalizeText } from '../../../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../../../api';
import { Column } from '../../../../../../common/Column'; import { Column, Flex, Text } from '../../../../../../common';
import { Flex } from '../../../../../../common/Flex';
import { Text } from '../../../../../../common/Text';
import { CatalogPurchasedEvent } from '../../../../../../events'; import { CatalogPurchasedEvent } from '../../../../../../events';
import { useUiEvent } from '../../../../../../hooks/events/ui/ui-event'; import { UseUiEvent } from '../../../../../../hooks';
import { SendMessageHook } from '../../../../../../hooks/messages/message-event';
import { CurrencyIcon } from '../../../../../../views/shared/currency-icon/CurrencyIcon'; import { CurrencyIcon } from '../../../../../../views/shared/currency-icon/CurrencyIcon';
import { IPurchasableOffer } from '../../../../common/IPurchasableOffer'; import { IPurchasableOffer } from '../../../../common/IPurchasableOffer';
import { Offer } from '../../../../common/Offer'; import { Offer } from '../../../../common/Offer';
@ -31,11 +28,11 @@ export const CatalogLayoutPetPurchaseView: FC<CatalogLayoutPetPurchaseViewProps>
setNameApproved(false); setNameApproved(false);
}, []); }, []);
useUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogPurchasedEvent); UseUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogPurchasedEvent);
const beforePurchase = useCallback(() => const beforePurchase = useCallback(() =>
{ {
SendMessageHook(new ApproveNameMessageComposer(petNameValue, 1)); SendMessageComposer(new ApproveNameMessageComposer(petNameValue, 1));
}, [ petNameValue ]); }, [ petNameValue ]);
const extraData = `${ petNameValue }\n${ extra }`; const extraData = `${ petNameValue }\n${ extra }`;

View File

@ -1,19 +1,10 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { ApproveNameMessageComposer, ColorConverter, GetSellablePetPalettesComposer, PurchaseFromCatalogComposer, SellablePetPaletteData } from '@nitrots/nitro-renderer'; import { ApproveNameMessageComposer, ColorConverter, GetSellablePetPalettesComposer, PurchaseFromCatalogComposer, SellablePetPaletteData } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { LocalizeText } from '../../../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../../../api';
import { AutoGrid } from '../../../../../../common/AutoGrid'; import { AutoGrid, Base, Button, Column, Flex, Grid, LayoutGridItem, Text } from '../../../../../../common';
import { Base } from '../../../../../../common/Base'; import { CatalogNameResultEvent, CatalogPurchaseFailureEvent, CatalogWidgetEvent } from '../../../../../../events';
import { Button } from '../../../../../../common/Button'; import { BatchUpdates, DispatchUiEvent, UseUiEvent } from '../../../../../../hooks';
import { Column } from '../../../../../../common/Column';
import { Flex } from '../../../../../../common/Flex';
import { Grid } from '../../../../../../common/Grid';
import { LayoutGridItem } from '../../../../../../common/layout/LayoutGridItem';
import { Text } from '../../../../../../common/Text';
import { CatalogNameResultEvent, CatalogPurchaseFailureEvent } from '../../../../../../events';
import { CatalogWidgetEvent } from '../../../../../../events/catalog/CatalogWidgetEvent';
import { BatchUpdates, dispatchUiEvent, useUiEvent } from '../../../../../../hooks';
import { SendMessageHook } from '../../../../../../hooks/messages/message-event';
import { PetImageView } from '../../../../../../views/shared/pet-image/PetImageView'; import { PetImageView } from '../../../../../../views/shared/pet-image/PetImageView';
import { useCatalogContext } from '../../../../CatalogContext'; import { useCatalogContext } from '../../../../CatalogContext';
import { GetPetAvailableColors, GetPetIndexFromLocalization } from '../../../../common/CatalogUtilities'; import { GetPetAvailableColors, GetPetIndexFromLocalization } from '../../../../common/CatalogUtilities';
@ -103,14 +94,14 @@ export const CatalogLayoutPetView: FC<CatalogLayoutProps> = props =>
{ {
if(approvalResult === -1) if(approvalResult === -1)
{ {
SendMessageHook(new ApproveNameMessageComposer(petName, 1)); SendMessageComposer(new ApproveNameMessageComposer(petName, 1));
return; return;
} }
if(approvalResult === 0) if(approvalResult === 0)
{ {
SendMessageHook(new PurchaseFromCatalogComposer(page.pageId, currentOffer.offerId, `${ petName }\n${ petPurchaseString }`, 1)); SendMessageComposer(new PurchaseFromCatalogComposer(page.pageId, currentOffer.offerId, `${ petName }\n${ petPurchaseString }`, 1));
return; return;
} }
@ -121,10 +112,10 @@ export const CatalogLayoutPetView: FC<CatalogLayoutProps> = props =>
setApprovalResult(event.result); setApprovalResult(event.result);
if(event.result === 0) purchasePet(); if(event.result === 0) purchasePet();
else dispatchUiEvent(new CatalogPurchaseFailureEvent(-1)); else DispatchUiEvent(new CatalogPurchaseFailureEvent(-1));
}, [ purchasePet ]); }, [ purchasePet ]);
useUiEvent(CatalogWidgetEvent.APPROVE_RESULT, onCatalogNameResultEvent); UseUiEvent(CatalogWidgetEvent.APPROVE_RESULT, onCatalogNameResultEvent);
useEffect(() => useEffect(() =>
{ {
@ -176,7 +167,7 @@ export const CatalogLayoutPetView: FC<CatalogLayoutProps> = props =>
setSellablePalettes([]); setSellablePalettes([]);
}); });
SendMessageHook(new GetSellablePetPalettesComposer(productData.type)); SendMessageComposer(new GetSellablePetPalettesComposer(productData.type));
}, [ currentOffer, petPalettes ]); }, [ currentOffer, petPalettes ]);
useEffect(() => useEffect(() =>

View File

@ -1,7 +1,7 @@
import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'; import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react';
import { LocalizeText } from '../../../../../../api'; import { LocalizeText } from '../../../../../../api';
import { CatalogEvent, CatalogNameResultEvent } from '../../../../../../events'; import { CatalogEvent, CatalogNameResultEvent } from '../../../../../../events';
import { useUiEvent } from '../../../../../../hooks/events/ui/ui-event'; import { UseUiEvent } from '../../../../../../hooks';
export interface CatalogPetNameApprovalViewProps export interface CatalogPetNameApprovalViewProps
{ {
@ -28,7 +28,7 @@ export const CatalogPetNameApprovalView: FC<CatalogPetNameApprovalViewProps> = p
setValidationResult(event.result); setValidationResult(event.result);
}, [ setNameApproved ]); }, [ setNameApproved ]);
useUiEvent(CatalogEvent.APPROVE_NAME_RESULT, onCatalogNameResultEvent); UseUiEvent(CatalogEvent.APPROVE_NAME_RESULT, onCatalogNameResultEvent);
const validationErrorMessage = () => const validationErrorMessage = () =>
{ {

View File

@ -1,9 +1,7 @@
import { SelectClubGiftComposer } from '@nitrots/nitro-renderer'; import { SelectClubGiftComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import { LocalizeText } from '../../../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../../../api';
import { AutoGrid } from '../../../../../../common/AutoGrid'; import { AutoGrid, Text } from '../../../../../../common';
import { Text } from '../../../../../../common/Text';
import { SendMessageHook } from '../../../../../../hooks';
import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities';
import { useCatalogContext } from '../../../../CatalogContext'; import { useCatalogContext } from '../../../../CatalogContext';
import { CatalogLayoutProps } from '../CatalogLayout.types'; import { CatalogLayoutProps } from '../CatalogLayout.types';
@ -31,7 +29,7 @@ export const CatalogLayoutVipGiftsView: FC<CatalogLayoutProps> = props =>
{ {
NotificationUtilities.confirm(LocalizeText('catalog.club_gift.confirm'), () => NotificationUtilities.confirm(LocalizeText('catalog.club_gift.confirm'), () =>
{ {
SendMessageHook(new SelectClubGiftComposer(localizationId)); SendMessageComposer(new SelectClubGiftComposer(localizationId));
setCatalogOptions(prevValue => setCatalogOptions(prevValue =>
{ {

View File

@ -1,10 +1,8 @@
import { StringDataType } from '@nitrots/nitro-renderer'; import { StringDataType } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { AutoGrid, AutoGridProps } from '../../../../../common/AutoGrid'; import { AutoGrid, AutoGridProps, LayoutGridItem } from '../../../../../common';
import { LayoutGridItem } from '../../../../../common/layout/LayoutGridItem'; import { InventoryBadgesRequestEvent, InventoryBadgesUpdatedEvent } from '../../../../../events';
import { InventoryBadgesUpdatedEvent } from '../../../../../events'; import { DispatchUiEvent, UseUiEvent } from '../../../../../hooks';
import { InventoryBadgesRequestEvent } from '../../../../../events/inventory/InventoryBadgesRequestEvent';
import { dispatchUiEvent, useUiEvent } from '../../../../../hooks';
import { BadgeImageView } from '../../../../../views/shared/badge-image/BadgeImageView'; import { BadgeImageView } from '../../../../../views/shared/badge-image/BadgeImageView';
import { useCatalogContext } from '../../../CatalogContext'; import { useCatalogContext } from '../../../CatalogContext';
@ -27,7 +25,7 @@ export const CatalogBadgeSelectorWidgetView: FC<CatalogBadgeSelectorWidgetViewPr
setBadges(event.badges); setBadges(event.badges);
}, []); }, []);
useUiEvent(InventoryBadgesUpdatedEvent.BADGES_UPDATED, onInventoryBadgesUpdatedEvent); UseUiEvent(InventoryBadgesUpdatedEvent.BADGES_UPDATED, onInventoryBadgesUpdatedEvent);
const previewStuffData = useMemo(() => const previewStuffData = useMemo(() =>
{ {
@ -55,7 +53,7 @@ export const CatalogBadgeSelectorWidgetView: FC<CatalogBadgeSelectorWidgetViewPr
useEffect(() => useEffect(() =>
{ {
dispatchUiEvent(new InventoryBadgesRequestEvent(InventoryBadgesRequestEvent.REQUEST_BADGES)); DispatchUiEvent(new InventoryBadgesRequestEvent(InventoryBadgesRequestEvent.REQUEST_BADGES));
}, []); }, []);
return ( return (

View File

@ -1,6 +1,6 @@
import { StringDataType } from '@nitrots/nitro-renderer'; import { StringDataType } from '@nitrots/nitro-renderer';
import { FC, useMemo } from 'react'; import { FC, useMemo } from 'react';
import { BaseProps } from '../../../../../common/Base'; import { BaseProps } from '../../../../../common';
import { BadgeImageView } from '../../../../../views/shared/badge-image/BadgeImageView'; import { BadgeImageView } from '../../../../../views/shared/badge-image/BadgeImageView';
import { useCatalogContext } from '../../../CatalogContext'; import { useCatalogContext } from '../../../CatalogContext';

View File

@ -1,10 +1,7 @@
import { CatalogGroupsComposer, StringDataType } from '@nitrots/nitro-renderer'; import { CatalogGroupsComposer, StringDataType } from '@nitrots/nitro-renderer';
import { FC, useEffect, useMemo, useState } from 'react'; import { FC, useEffect, useMemo, useState } from 'react';
import { LocalizeText } from '../../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../../api';
import { Base } from '../../../../../common/Base'; import { Base, Button, Flex } from '../../../../../common';
import { Button } from '../../../../../common/Button';
import { Flex } from '../../../../../common/Flex';
import { SendMessageHook } from '../../../../../hooks';
import { useCatalogContext } from '../../../CatalogContext'; import { useCatalogContext } from '../../../CatalogContext';
export const CatalogGuildSelectorWidgetView: FC<{}> = props => export const CatalogGuildSelectorWidgetView: FC<{}> = props =>
@ -43,7 +40,7 @@ export const CatalogGuildSelectorWidgetView: FC<{}> = props =>
useEffect(() => useEffect(() =>
{ {
SendMessageHook(new CatalogGroupsComposer()); SendMessageComposer(new CatalogGroupsComposer());
}, []); }, []);
if(!groups || !groups.length) if(!groups || !groups.length)

View File

@ -1,7 +1,7 @@
import { FC } from 'react'; import { FC } from 'react';
import { AutoGrid, AutoGridProps } from '../../../../../common/AutoGrid'; import { AutoGrid, AutoGridProps } from '../../../../../common/AutoGrid';
import { CatalogSetExtraPurchaseParameterEvent } from '../../../../../events'; import { CatalogSetExtraPurchaseParameterEvent } from '../../../../../events';
import { dispatchUiEvent } from '../../../../../hooks'; import { DispatchUiEvent } from '../../../../../hooks';
import { useCatalogContext } from '../../../CatalogContext'; import { useCatalogContext } from '../../../CatalogContext';
import { IPurchasableOffer } from '../../../common/IPurchasableOffer'; import { IPurchasableOffer } from '../../../common/IPurchasableOffer';
import { ProductTypeEnum } from '../../../common/ProductTypeEnum'; import { ProductTypeEnum } from '../../../common/ProductTypeEnum';
@ -29,7 +29,7 @@ export const CatalogItemGridWidgetView: FC<CatalogItemGridWidgetViewProps> = pro
if(offer.product && (offer.product.productType === ProductTypeEnum.WALL)) if(offer.product && (offer.product.productType === ProductTypeEnum.WALL))
{ {
dispatchUiEvent(new CatalogSetExtraPurchaseParameterEvent(offer.product.extraParam)); DispatchUiEvent(new CatalogSetExtraPurchaseParameterEvent(offer.product.extraParam));
} }
} }

View File

@ -1,9 +1,9 @@
import { PurchaseFromCatalogComposer } from '@nitrots/nitro-renderer'; import { PurchaseFromCatalogComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { CreateLinkEvent, GetClubMemberLevel, LocalizeText } from '../../../../../api'; import { CreateLinkEvent, GetClubMemberLevel, LocalizeText, SendMessageComposer } from '../../../../../api';
import { Button, LayoutLoadingSpinnerView } from '../../../../../common'; import { Button, LayoutLoadingSpinnerView } from '../../../../../common';
import { CatalogEvent, CatalogInitGiftEvent, CatalogInitPurchaseEvent, CatalogPurchasedEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent, CatalogWidgetEvent } from '../../../../../events'; import { CatalogEvent, CatalogInitGiftEvent, CatalogInitPurchaseEvent, CatalogPurchasedEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent, CatalogWidgetEvent } from '../../../../../events';
import { dispatchUiEvent, SendMessageHook, useUiEvent } from '../../../../../hooks'; import { DispatchUiEvent, UseUiEvent } from '../../../../../hooks';
import { GetCurrencyAmount } from '../../../../purse/common/CurrencyHelper'; import { GetCurrencyAmount } from '../../../../purse/common/CurrencyHelper';
import { useCatalogContext } from '../../../CatalogContext'; import { useCatalogContext } from '../../../CatalogContext';
import { CatalogPurchaseState } from '../../../common/CatalogPurchaseState'; import { CatalogPurchaseState } from '../../../common/CatalogPurchaseState';
@ -31,7 +31,7 @@ export const CatalogPurchaseWidgetView: FC<CatalogPurchaseWidgetViewProps> = pro
// offer, page.pageId, extraData, quantity, previewStuffData, null, true, null // offer, page.pageId, extraData, quantity, previewStuffData, null, true, null
}, [ currentOffer ]); }, [ currentOffer ]);
useUiEvent(CatalogWidgetEvent.INIT_PURCHASE, onCatalogInitPurchaseEvent); UseUiEvent(CatalogWidgetEvent.INIT_PURCHASE, onCatalogInitPurchaseEvent);
const onCatalogEvent = useCallback((event: CatalogEvent) => const onCatalogEvent = useCallback((event: CatalogEvent) =>
{ {
@ -52,10 +52,10 @@ export const CatalogPurchaseWidgetView: FC<CatalogPurchaseWidgetViewProps> = pro
} }
}, []); }, []);
useUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogEvent); UseUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogEvent);
useUiEvent(CatalogPurchaseFailureEvent.PURCHASE_FAILED, onCatalogEvent); UseUiEvent(CatalogPurchaseFailureEvent.PURCHASE_FAILED, onCatalogEvent);
useUiEvent(CatalogPurchaseNotAllowedEvent.NOT_ALLOWED, onCatalogEvent); UseUiEvent(CatalogPurchaseNotAllowedEvent.NOT_ALLOWED, onCatalogEvent);
useUiEvent(CatalogPurchaseSoldOutEvent.SOLD_OUT, onCatalogEvent); UseUiEvent(CatalogPurchaseSoldOutEvent.SOLD_OUT, onCatalogEvent);
const isLimitedSoldOut = useMemo(() => const isLimitedSoldOut = useMemo(() =>
{ {
@ -86,7 +86,7 @@ export const CatalogPurchaseWidgetView: FC<CatalogPurchaseWidgetViewProps> = pro
if(isGift) if(isGift)
{ {
dispatchUiEvent(new CatalogInitGiftEvent(currentOffer.page.pageId, currentOffer.offerId, extraData)); DispatchUiEvent(new CatalogInitGiftEvent(currentOffer.page.pageId, currentOffer.offerId, extraData));
return; return;
} }
@ -109,7 +109,7 @@ export const CatalogPurchaseWidgetView: FC<CatalogPurchaseWidgetViewProps> = pro
// if(nodes) pageId = nodes[0].pageId; // if(nodes) pageId = nodes[0].pageId;
// } // }
SendMessageHook(new PurchaseFromCatalogComposer(pageId, currentOffer.offerId, extraData, quantity)); SendMessageComposer(new PurchaseFromCatalogComposer(pageId, currentOffer.offerId, extraData, quantity));
}, [ currentOffer, purchaseCallback, extraData, quantity ]); }, [ currentOffer, purchaseCallback, extraData, quantity ]);
useEffect(() => useEffect(() =>

View File

@ -1,7 +1,7 @@
import { GetGuestRoomResultEvent, RoomSessionChatEvent, RoomSessionEvent } from '@nitrots/nitro-renderer'; import { GetGuestRoomResultEvent, RoomSessionChatEvent, RoomSessionEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { GetRoomSession } from '../../api'; import { GetRoomSession } from '../../api';
import { CreateMessageHook, useRoomSessionManagerEvent } from '../../hooks'; import { UseMessageEventHook, UseRoomSessionManagerEvent } from '../../hooks';
import { useChatHistoryContext } from './ChatHistoryContext'; import { useChatHistoryContext } from './ChatHistoryContext';
import { ChatEntryType } from './common/ChatEntryType'; import { ChatEntryType } from './common/ChatEntryType';
import { IChatEntry } from './common/IChatEntry'; import { IChatEntry } from './common/IChatEntry';
@ -64,7 +64,7 @@ export const ChatHistoryMessageHandler: FC<{}> = props =>
addChatEntry(entry); addChatEntry(entry);
}, [addChatEntry]); }, [addChatEntry]);
useRoomSessionManagerEvent(RoomSessionChatEvent.CHAT_EVENT, onChatEvent); UseRoomSessionManagerEvent(RoomSessionChatEvent.CHAT_EVENT, onChatEvent);
const onRoomSessionEvent = useCallback((event: RoomSessionEvent) => const onRoomSessionEvent = useCallback((event: RoomSessionEvent) =>
{ {
@ -79,8 +79,8 @@ export const ChatHistoryMessageHandler: FC<{}> = props =>
} }
}, []); }, []);
useRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent); UseRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent);
useRoomSessionManagerEvent(RoomSessionEvent.STARTED, onRoomSessionEvent); UseRoomSessionManagerEvent(RoomSessionEvent.STARTED, onRoomSessionEvent);
const onGetGuestRoomResultEvent = useCallback((event: GetGuestRoomResultEvent) => const onGetGuestRoomResultEvent = useCallback((event: GetGuestRoomResultEvent) =>
{ {
@ -106,7 +106,7 @@ export const ChatHistoryMessageHandler: FC<{}> = props =>
} }
}, [addChatEntry, addRoomHistoryEntry, needsRoomInsert]); }, [addChatEntry, addRoomHistoryEntry, needsRoomInsert]);
CreateMessageHook(GetGuestRoomResultEvent, onGetGuestRoomResultEvent); UseMessageEventHook(GetGuestRoomResultEvent, onGetGuestRoomResultEvent);
return null; return null;
} }

View File

@ -1,7 +1,7 @@
import { GroupBadgePartsComposer, GroupBadgePartsEvent, GroupPurchasedEvent, GroupSettingsComposer, ILinkEventTracker } from '@nitrots/nitro-renderer'; import { GroupBadgePartsComposer, GroupBadgePartsEvent, GroupPurchasedEvent, GroupSettingsComposer, ILinkEventTracker } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { AddEventLinkTracker, RemoveLinkEventTracker, TryVisitRoom } from '../../api'; import { AddEventLinkTracker, RemoveLinkEventTracker, SendMessageComposer, TryVisitRoom } from '../../api';
import { CreateMessageHook, SendMessageHook } from '../../hooks'; import { UseMessageEventHook } from '../../hooks';
import { CompareId } from './common/CompareId'; import { CompareId } from './common/CompareId';
import { IGroupCustomize } from './common/IGroupCustomize'; import { IGroupCustomize } from './common/IGroupCustomize';
import { GroupsContextProvider } from './GroupsContext'; import { GroupsContextProvider } from './GroupsContext';
@ -23,7 +23,7 @@ export const GroupsView: FC<{}> = props =>
TryVisitRoom(parser.roomId); TryVisitRoom(parser.roomId);
}, []); }, []);
CreateMessageHook(GroupPurchasedEvent, onGroupPurchasedEvent); UseMessageEventHook(GroupPurchasedEvent, onGroupPurchasedEvent);
const onGroupBadgePartsEvent = useCallback((event: GroupBadgePartsEvent) => const onGroupBadgePartsEvent = useCallback((event: GroupBadgePartsEvent) =>
{ {
@ -52,7 +52,7 @@ export const GroupsView: FC<{}> = props =>
setGroupCustomize(customize); setGroupCustomize(customize);
}, [ setGroupCustomize ]); }, [ setGroupCustomize ]);
CreateMessageHook(GroupBadgePartsEvent, onGroupBadgePartsEvent); UseMessageEventHook(GroupBadgePartsEvent, onGroupBadgePartsEvent);
const linkReceived = useCallback((url: string) => const linkReceived = useCallback((url: string) =>
{ {
@ -69,7 +69,7 @@ export const GroupsView: FC<{}> = props =>
if(!parts[2]) return; if(!parts[2]) return;
setCreatorVisible(false); setCreatorVisible(false);
SendMessageHook(new GroupSettingsComposer(Number(parts[2]))); SendMessageComposer(new GroupSettingsComposer(Number(parts[2])));
return; return;
} }
}, []); }, []);
@ -88,7 +88,7 @@ export const GroupsView: FC<{}> = props =>
useEffect(() => useEffect(() =>
{ {
SendMessageHook(new GroupBadgePartsComposer()); SendMessageComposer(new GroupBadgePartsComposer());
}, []); }, []);
return ( return (

View File

@ -1,8 +1,8 @@
import { GroupBuyComposer, GroupBuyDataComposer, GroupBuyDataEvent } from '@nitrots/nitro-renderer'; import { GroupBuyComposer, GroupBuyDataComposer, GroupBuyDataEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { HasHabboClub, LocalizeText } from '../../../api'; import { HasHabboClub, LocalizeText, SendMessageComposer } from '../../../api';
import { Base, Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common'; import { Base, Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common';
import { BatchUpdates, CreateMessageHook, SendMessageHook } from '../../../hooks'; import { BatchUpdates, UseMessageEventHook } from '../../../hooks';
import { IGroupData } from '../common/IGroupData'; import { IGroupData } from '../common/IGroupData';
import { GroupTabBadgeView } from './tabs/GroupTabBadgeView'; import { GroupTabBadgeView } from './tabs/GroupTabBadgeView';
import { GroupTabColorsView } from './tabs/GroupTabColorsView'; import { GroupTabColorsView } from './tabs/GroupTabColorsView';
@ -49,7 +49,7 @@ export const GroupCreatorView: FC<GroupCreatorViewProps> = props =>
} }
}); });
SendMessageHook(new GroupBuyComposer(groupData.groupName, groupData.groupDescription, groupData.groupHomeroomId, groupData.groupColors[0], groupData.groupColors[1], badge)); SendMessageComposer(new GroupBuyComposer(groupData.groupName, groupData.groupDescription, groupData.groupHomeroomId, groupData.groupColors[0], groupData.groupColors[1], badge));
} }
const previousStep = () => const previousStep = () =>
@ -101,7 +101,7 @@ export const GroupCreatorView: FC<GroupCreatorViewProps> = props =>
}); });
}, []); }, []);
CreateMessageHook(GroupBuyDataEvent, onGroupBuyDataEvent); UseMessageEventHook(GroupBuyDataEvent, onGroupBuyDataEvent);
useEffect(() => useEffect(() =>
{ {
@ -121,7 +121,7 @@ export const GroupCreatorView: FC<GroupCreatorViewProps> = props =>
}); });
}); });
SendMessageHook(new GroupBuyDataComposer()); SendMessageComposer(new GroupBuyDataComposer());
}, [ setGroupData ]); }, [ setGroupData ]);
if(!groupData) return null; if(!groupData) return null;

View File

@ -2,7 +2,7 @@ import { GroupInformationEvent, GroupInformationParser } from '@nitrots/nitro-re
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { LocalizeText } from '../../../api'; import { LocalizeText } from '../../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../common'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../common';
import { CreateMessageHook } from '../../../hooks'; import { UseMessageEventHook } from '../../../hooks';
import { GroupInformationView } from './GroupInformationView'; import { GroupInformationView } from './GroupInformationView';
export const GroupInformationStandaloneView: FC<{}> = props => export const GroupInformationStandaloneView: FC<{}> = props =>
@ -16,7 +16,7 @@ export const GroupInformationStandaloneView: FC<{}> = props =>
if((groupInformation && (groupInformation.id === parser.id)) || parser.flag) setGroupInformation(parser); if((groupInformation && (groupInformation.id === parser.id)) || parser.flag) setGroupInformation(parser);
}, [ groupInformation ]); }, [ groupInformation ]);
CreateMessageHook(GroupInformationEvent, onGroupInformationEvent); UseMessageEventHook(GroupInformationEvent, onGroupInformationEvent);
if(!groupInformation) return null; if(!groupInformation) return null;

View File

@ -1,11 +1,7 @@
import { GroupInformationParser, GroupRemoveMemberComposer } from '@nitrots/nitro-renderer'; import { GroupInformationParser, GroupRemoveMemberComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import { CreateLinkEvent, GetSessionDataManager, LocalizeText, TryVisitRoom } from '../../../api'; import { CreateLinkEvent, GetGroupManager, GetGroupMembers, GetSessionDataManager, LocalizeText, SendMessageComposer, TryJoinGroup, TryVisitRoom } from '../../../api';
import { GetGroupManager } from '../../../api/groups/GetGroupManager';
import { GetGroupMembers } from '../../../api/groups/GetGroupMembers';
import { TryJoinGroup } from '../../../api/groups/TryJoinGroup';
import { Button, Column, Flex, Grid, Text } from '../../../common'; import { Button, Column, Flex, Grid, Text } from '../../../common';
import { SendMessageHook } from '../../../hooks';
import { NotificationUtilities } from '../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../views/notification-center/common/NotificationUtilities';
import { BadgeImageView } from '../../../views/shared/badge-image/BadgeImageView'; import { BadgeImageView } from '../../../views/shared/badge-image/BadgeImageView';
import { CatalogPageName } from '../../catalog/common/CatalogPageName'; import { CatalogPageName } from '../../catalog/common/CatalogPageName';
@ -33,7 +29,7 @@ export const GroupInformationView: FC<GroupInformationViewProps> = props =>
{ {
NotificationUtilities.confirm(LocalizeText('group.leaveconfirm.desc'), () => NotificationUtilities.confirm(LocalizeText('group.leaveconfirm.desc'), () =>
{ {
SendMessageHook(new GroupRemoveMemberComposer(groupInformation.id, GetSessionDataManager().userId)); SendMessageComposer(new GroupRemoveMemberComposer(groupInformation.id, GetSessionDataManager().userId));
if(onClose) onClose(); if(onClose) onClose();
}, null); }, null);

View File

@ -2,7 +2,7 @@ import { GroupBadgePart, GroupInformationEvent, GroupSettingsEvent } from '@nitr
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { LocalizeText } from '../../../api'; import { LocalizeText } from '../../../api';
import { Base, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView, Text } from '../../../common'; import { Base, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView, Text } from '../../../common';
import { CreateMessageHook } from '../../../hooks'; import { UseMessageEventHook } from '../../../hooks';
import { IGroupData } from '../common/IGroupData'; import { IGroupData } from '../common/IGroupData';
import { GroupTabBadgeView } from './tabs/GroupTabBadgeView'; import { GroupTabBadgeView } from './tabs/GroupTabBadgeView';
import { GroupTabColorsView } from './tabs/GroupTabColorsView'; import { GroupTabColorsView } from './tabs/GroupTabColorsView';
@ -55,7 +55,7 @@ export const GroupManagerView: FC<{}> = props =>
}); });
}, [ groupData ]); }, [ groupData ]);
CreateMessageHook(GroupInformationEvent, onGroupInformationEvent); UseMessageEventHook(GroupInformationEvent, onGroupInformationEvent);
const onGroupSettingsEvent = useCallback((event: GroupSettingsEvent) => const onGroupSettingsEvent = useCallback((event: GroupSettingsEvent) =>
{ {
@ -85,7 +85,7 @@ export const GroupManagerView: FC<{}> = props =>
}); });
}, [ setGroupData ]); }, [ setGroupData ]);
CreateMessageHook(GroupSettingsEvent, onGroupSettingsEvent); UseMessageEventHook(GroupSettingsEvent, onGroupSettingsEvent);
if(!groupData || (groupData.groupId <= 0)) return null; if(!groupData || (groupData.groupId <= 0)) return null;

View File

@ -1,9 +1,9 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { GroupAdminGiveComposer, GroupAdminTakeComposer, GroupConfirmMemberRemoveEvent, GroupConfirmRemoveMemberComposer, GroupMemberParser, GroupMembersComposer, GroupMembersEvent, GroupMembershipAcceptComposer, GroupMembershipDeclineComposer, GroupMembersParser, GroupRank, GroupRemoveMemberComposer, ILinkEventTracker } from '@nitrots/nitro-renderer'; import { GroupAdminGiveComposer, GroupAdminTakeComposer, GroupConfirmMemberRemoveEvent, GroupConfirmRemoveMemberComposer, GroupMemberParser, GroupMembersComposer, GroupMembersEvent, GroupMembershipAcceptComposer, GroupMembershipDeclineComposer, GroupMembersParser, GroupRank, GroupRemoveMemberComposer, ILinkEventTracker } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { AddEventLinkTracker, GetSessionDataManager, GetUserProfile, LocalizeText, RemoveLinkEventTracker } from '../../../api'; import { AddEventLinkTracker, GetSessionDataManager, GetUserProfile, LocalizeText, RemoveLinkEventTracker, SendMessageComposer } from '../../../api';
import { Base, Button, Column, Flex, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common'; import { Base, Button, Column, Flex, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common';
import { BatchUpdates, CreateMessageHook, SendMessageHook } from '../../../hooks'; import { BatchUpdates, UseMessageEventHook } from '../../../hooks';
import { NotificationUtilities } from '../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../views/notification-center/common/NotificationUtilities';
import { AvatarImageView } from '../../../views/shared/avatar-image/AvatarImageView'; import { AvatarImageView } from '../../../views/shared/avatar-image/AvatarImageView';
import { BadgeImageView } from '../../../views/shared/badge-image/BadgeImageView'; import { BadgeImageView } from '../../../views/shared/badge-image/BadgeImageView';
@ -36,15 +36,15 @@ export const GroupMembersView: FC<{}> = props =>
{ {
if((groupId === -1) || (levelId === -1) || (pageId === -1)) return; if((groupId === -1) || (levelId === -1) || (pageId === -1)) return;
SendMessageHook(new GroupMembersComposer(groupId, pageId, searchQuery, levelId)); SendMessageComposer(new GroupMembersComposer(groupId, pageId, searchQuery, levelId));
}, [ groupId, levelId, pageId, searchQuery ]); }, [ groupId, levelId, pageId, searchQuery ]);
const toggleAdmin = (member: GroupMemberParser) => const toggleAdmin = (member: GroupMemberParser) =>
{ {
if(!membersData.admin || (member.rank === GroupRank.OWNER)) return; if(!membersData.admin || (member.rank === GroupRank.OWNER)) return;
if(member.rank !== GroupRank.ADMIN) SendMessageHook(new GroupAdminGiveComposer(membersData.groupId, member.id)); if(member.rank !== GroupRank.ADMIN) SendMessageComposer(new GroupAdminGiveComposer(membersData.groupId, member.id));
else SendMessageHook(new GroupAdminTakeComposer(membersData.groupId, member.id)); else SendMessageComposer(new GroupAdminTakeComposer(membersData.groupId, member.id));
refreshMembers(); refreshMembers();
} }
@ -53,7 +53,7 @@ export const GroupMembersView: FC<{}> = props =>
{ {
if(!membersData.admin || (member.rank !== GroupRank.REQUESTED)) return; if(!membersData.admin || (member.rank !== GroupRank.REQUESTED)) return;
SendMessageHook(new GroupMembershipAcceptComposer(membersData.groupId, member.id)); SendMessageComposer(new GroupMembershipAcceptComposer(membersData.groupId, member.id));
refreshMembers(); refreshMembers();
} }
@ -64,7 +64,7 @@ export const GroupMembersView: FC<{}> = props =>
if(member.rank === GroupRank.REQUESTED) if(member.rank === GroupRank.REQUESTED)
{ {
SendMessageHook(new GroupMembershipDeclineComposer(membersData.groupId, member.id)); SendMessageComposer(new GroupMembershipDeclineComposer(membersData.groupId, member.id));
refreshMembers(); refreshMembers();
@ -72,7 +72,7 @@ export const GroupMembersView: FC<{}> = props =>
} }
setRemovingMemberName(member.name); setRemovingMemberName(member.name);
SendMessageHook(new GroupConfirmRemoveMemberComposer(membersData.groupId, member.id)); SendMessageComposer(new GroupConfirmRemoveMemberComposer(membersData.groupId, member.id));
} }
const onGroupMembersEvent = useCallback((event: GroupMembersEvent) => const onGroupMembersEvent = useCallback((event: GroupMembersEvent) =>
@ -87,7 +87,7 @@ export const GroupMembersView: FC<{}> = props =>
}); });
}, []); }, []);
CreateMessageHook(GroupMembersEvent, onGroupMembersEvent); UseMessageEventHook(GroupMembersEvent, onGroupMembersEvent);
const onGroupConfirmMemberRemoveEvent = useCallback((event: GroupConfirmMemberRemoveEvent) => const onGroupConfirmMemberRemoveEvent = useCallback((event: GroupConfirmMemberRemoveEvent) =>
{ {
@ -95,7 +95,7 @@ export const GroupMembersView: FC<{}> = props =>
NotificationUtilities.confirm(LocalizeText(((parser.furnitureCount > 0) ? 'group.kickconfirm.desc' : 'group.kickconfirm_nofurni.desc'), [ 'user', 'amount' ], [ removingMemberName, parser.furnitureCount.toString() ]), () => NotificationUtilities.confirm(LocalizeText(((parser.furnitureCount > 0) ? 'group.kickconfirm.desc' : 'group.kickconfirm_nofurni.desc'), [ 'user', 'amount' ], [ removingMemberName, parser.furnitureCount.toString() ]), () =>
{ {
SendMessageHook(new GroupRemoveMemberComposer(membersData.groupId, parser.userId)); SendMessageComposer(new GroupRemoveMemberComposer(membersData.groupId, parser.userId));
refreshMembers(); refreshMembers();
}, null); }, null);
@ -103,7 +103,7 @@ export const GroupMembersView: FC<{}> = props =>
setRemovingMemberName(null); setRemovingMemberName(null);
}, [ membersData, removingMemberName, refreshMembers ]); }, [ membersData, removingMemberName, refreshMembers ]);
CreateMessageHook(GroupConfirmMemberRemoveEvent, onGroupConfirmMemberRemoveEvent); UseMessageEventHook(GroupConfirmMemberRemoveEvent, onGroupConfirmMemberRemoveEvent);
const linkReceived = useCallback((url: string) => const linkReceived = useCallback((url: string) =>
{ {
@ -142,7 +142,7 @@ export const GroupMembersView: FC<{}> = props =>
{ {
if((groupId === -1) || (levelId === -1) || (pageId === -1)) return; if((groupId === -1) || (levelId === -1) || (pageId === -1)) return;
SendMessageHook(new GroupMembersComposer(groupId, pageId, searchQuery, levelId)); SendMessageComposer(new GroupMembersComposer(groupId, pageId, searchQuery, levelId));
}, [ groupId, levelId, pageId, searchQuery ]); }, [ groupId, levelId, pageId, searchQuery ]);
useEffect(() => useEffect(() =>

View File

@ -1,10 +1,9 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { DesktopViewEvent, GetGuestRoomResultEvent, GroupInformationComposer, GroupInformationEvent, GroupInformationParser, GroupRemoveMemberComposer, HabboGroupDeactivatedMessageEvent, RoomEntryInfoMessageEvent } from '@nitrots/nitro-renderer'; import { DesktopViewEvent, GetGuestRoomResultEvent, GroupInformationComposer, GroupInformationEvent, GroupInformationParser, GroupRemoveMemberComposer, HabboGroupDeactivatedMessageEvent, RoomEntryInfoMessageEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { GetGroupInformation, GetSessionDataManager, LocalizeText, TryJoinGroup } from '../../../api'; import { GetGroupInformation, GetGroupManager, GetSessionDataManager, LocalizeText, SendMessageComposer, TryJoinGroup } from '../../../api';
import { GetGroupManager } from '../../../api/groups/GetGroupManager';
import { Base, Button, Column, Flex, Text } from '../../../common'; import { Base, Button, Column, Flex, Text } from '../../../common';
import { CreateMessageHook, SendMessageHook } from '../../../hooks'; import { UseMessageEventHook } from '../../../hooks';
import { NotificationUtilities } from '../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../views/notification-center/common/NotificationUtilities';
import { BadgeImageView } from '../../../views/shared/badge-image/BadgeImageView'; import { BadgeImageView } from '../../../views/shared/badge-image/BadgeImageView';
import { GroupMembershipType } from '../common/GroupMembershipType'; import { GroupMembershipType } from '../common/GroupMembershipType';
@ -22,7 +21,7 @@ export const GroupRoomInformationView: FC<{}> = props =>
setGroupInformation(null); setGroupInformation(null);
}, []); }, []);
CreateMessageHook(DesktopViewEvent, onDesktopViewEvent); UseMessageEventHook(DesktopViewEvent, onDesktopViewEvent);
const onRoomEntryInfoMessageEvent = useCallback((event: RoomEntryInfoMessageEvent) => const onRoomEntryInfoMessageEvent = useCallback((event: RoomEntryInfoMessageEvent) =>
{ {
@ -30,7 +29,7 @@ export const GroupRoomInformationView: FC<{}> = props =>
setGroupInformation(null); setGroupInformation(null);
}, []); }, []);
CreateMessageHook(RoomEntryInfoMessageEvent, onRoomEntryInfoMessageEvent); UseMessageEventHook(RoomEntryInfoMessageEvent, onRoomEntryInfoMessageEvent);
const onGetGuestRoomResultEvent = useCallback((event: GetGuestRoomResultEvent) => const onGetGuestRoomResultEvent = useCallback((event: GetGuestRoomResultEvent) =>
{ {
@ -41,7 +40,7 @@ export const GroupRoomInformationView: FC<{}> = props =>
if(parser.data.habboGroupId > 0) if(parser.data.habboGroupId > 0)
{ {
setExpectedGroupId(parser.data.habboGroupId); setExpectedGroupId(parser.data.habboGroupId);
SendMessageHook(new GroupInformationComposer(parser.data.habboGroupId, false)); SendMessageComposer(new GroupInformationComposer(parser.data.habboGroupId, false));
} }
else else
{ {
@ -50,7 +49,7 @@ export const GroupRoomInformationView: FC<{}> = props =>
} }
}, []); }, []);
CreateMessageHook(GetGuestRoomResultEvent, onGetGuestRoomResultEvent); UseMessageEventHook(GetGuestRoomResultEvent, onGetGuestRoomResultEvent);
const onHabboGroupDeactivatedMessageEvent = useCallback((event: HabboGroupDeactivatedMessageEvent) => const onHabboGroupDeactivatedMessageEvent = useCallback((event: HabboGroupDeactivatedMessageEvent) =>
{ {
@ -62,7 +61,7 @@ export const GroupRoomInformationView: FC<{}> = props =>
setGroupInformation(null); setGroupInformation(null);
}, [ expectedGroupId, groupInformation ]); }, [ expectedGroupId, groupInformation ]);
CreateMessageHook(HabboGroupDeactivatedMessageEvent, onHabboGroupDeactivatedMessageEvent); UseMessageEventHook(HabboGroupDeactivatedMessageEvent, onHabboGroupDeactivatedMessageEvent);
const onGroupInformationEvent = useCallback((event: GroupInformationEvent) => const onGroupInformationEvent = useCallback((event: GroupInformationEvent) =>
{ {
@ -73,13 +72,13 @@ export const GroupRoomInformationView: FC<{}> = props =>
setGroupInformation(parser); setGroupInformation(parser);
}, [ expectedGroupId ]); }, [ expectedGroupId ]);
CreateMessageHook(GroupInformationEvent, onGroupInformationEvent); UseMessageEventHook(GroupInformationEvent, onGroupInformationEvent);
const leaveGroup = () => const leaveGroup = () =>
{ {
NotificationUtilities.confirm(LocalizeText('group.leaveconfirm.desc'), () => NotificationUtilities.confirm(LocalizeText('group.leaveconfirm.desc'), () =>
{ {
SendMessageHook(new GroupRemoveMemberComposer(groupInformation.id, GetSessionDataManager().userId)); SendMessageComposer(new GroupRemoveMemberComposer(groupInformation.id, GetSessionDataManager().userId));
}, null); }, null);
} }

View File

@ -1,7 +1,7 @@
import { GroupSaveBadgeComposer } from '@nitrots/nitro-renderer'; import { GroupSaveBadgeComposer } from '@nitrots/nitro-renderer';
import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'; import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react';
import { SendMessageComposer } from '../../../../api';
import { Column, Flex, Grid } from '../../../../common'; import { Column, Flex, Grid } from '../../../../common';
import { SendMessageHook } from '../../../../hooks';
import { BadgeImageView } from '../../../../views/shared/badge-image/BadgeImageView'; import { BadgeImageView } from '../../../../views/shared/badge-image/BadgeImageView';
import { GroupBadgePart } from '../../common/GroupBadgePart'; import { GroupBadgePart } from '../../common/GroupBadgePart';
import { IGroupData } from '../../common/IGroupData'; import { IGroupData } from '../../common/IGroupData';
@ -64,7 +64,7 @@ export const GroupTabBadgeView: FC<GroupTabBadgeViewProps> = props =>
badge.push(part.position); badge.push(part.position);
}); });
SendMessageHook(new GroupSaveBadgeComposer(groupData.groupId, badge)); SendMessageComposer(new GroupSaveBadgeComposer(groupData.groupId, badge));
return true; return true;
}, [ groupData, badgeParts, setGroupData ]); }, [ groupData, badgeParts, setGroupData ]);

View File

@ -1,9 +1,8 @@
import { GroupSaveColorsComposer } from '@nitrots/nitro-renderer'; import { GroupSaveColorsComposer } from '@nitrots/nitro-renderer';
import classNames from 'classnames'; import classNames from 'classnames';
import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'; import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react';
import { LocalizeText } from '../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../api';
import { AutoGrid, Base, Column, Flex, Grid, Text } from '../../../../common'; import { AutoGrid, Base, Column, Flex, Grid, Text } from '../../../../common';
import { SendMessageHook } from '../../../../hooks';
import { IGroupData } from '../../common/IGroupData'; import { IGroupData } from '../../common/IGroupData';
import { useGroupsContext } from '../../GroupsContext'; import { useGroupsContext } from '../../GroupsContext';
@ -59,7 +58,7 @@ export const GroupTabColorsView: FC<GroupTabColorsViewProps> = props =>
return true; return true;
} }
SendMessageHook(new GroupSaveColorsComposer(groupData.groupId, colors[0], colors[1])); SendMessageComposer(new GroupSaveColorsComposer(groupData.groupId, colors[0], colors[1]));
return true; return true;
}, [ groupData, colors, setGroupData ]); }, [ groupData, colors, setGroupData ]);

View File

@ -1,8 +1,8 @@
import { GroupDeleteComposer, GroupSaveInformationComposer } from '@nitrots/nitro-renderer'; import { GroupDeleteComposer, GroupSaveInformationComposer } from '@nitrots/nitro-renderer';
import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'; import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react';
import { CreateLinkEvent, LocalizeText } from '../../../../api'; import { CreateLinkEvent, LocalizeText, SendMessageComposer } from '../../../../api';
import { Base, Button, Column, Flex, Text } from '../../../../common'; import { Base, Button, Column, Flex, Text } from '../../../../common';
import { BatchUpdates, SendMessageHook } from '../../../../hooks'; import { BatchUpdates } from '../../../../hooks';
import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities';
import { IGroupData } from '../../common/IGroupData'; import { IGroupData } from '../../common/IGroupData';
@ -28,7 +28,7 @@ export const GroupTabIdentityView: FC<GroupTabIdentityViewProps> = props =>
NotificationUtilities.confirm(LocalizeText('group.deleteconfirm.desc'), () => NotificationUtilities.confirm(LocalizeText('group.deleteconfirm.desc'), () =>
{ {
SendMessageHook(new GroupDeleteComposer(groupData.groupId)); SendMessageComposer(new GroupDeleteComposer(groupData.groupId));
}, null, null, null, LocalizeText('group.deleteconfirm.title')); }, null, null, null, LocalizeText('group.deleteconfirm.title'));
} }
@ -56,7 +56,7 @@ export const GroupTabIdentityView: FC<GroupTabIdentityViewProps> = props =>
return true; return true;
} }
SendMessageHook(new GroupSaveInformationComposer(groupData.groupId, groupName, (groupDescription || ''))); SendMessageComposer(new GroupSaveInformationComposer(groupData.groupId, groupName, (groupDescription || '')));
return true; return true;
}, [ groupData, groupName, groupDescription, groupHomeroomId, setGroupData ]); }, [ groupData, groupName, groupDescription, groupHomeroomId, setGroupData ]);

View File

@ -1,8 +1,9 @@
import { GroupSavePreferencesComposer } from '@nitrots/nitro-renderer'; import { GroupSavePreferencesComposer } from '@nitrots/nitro-renderer';
import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'; import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react';
import { SendMessageComposer } from '../../../../api';
import { LocalizeText } from '../../../../api/utils/LocalizeText'; import { LocalizeText } from '../../../../api/utils/LocalizeText';
import { Column, Flex, HorizontalRule, Text } from '../../../../common'; import { Column, Flex, HorizontalRule, Text } from '../../../../common';
import { BatchUpdates, SendMessageHook } from '../../../../hooks'; import { BatchUpdates } from '../../../../hooks';
import { IGroupData } from '../../common/IGroupData'; import { IGroupData } from '../../common/IGroupData';
const STATES: string[] = [ 'regular', 'exclusive', 'private' ]; const STATES: string[] = [ 'regular', 'exclusive', 'private' ];
@ -41,7 +42,7 @@ export const GroupTabSettingsView: FC<GroupTabSettingsViewProps> = props =>
return true; return true;
} }
SendMessageHook(new GroupSavePreferencesComposer(groupData.groupId, groupState, groupDecorate ? 0 : 1)); SendMessageComposer(new GroupSavePreferencesComposer(groupData.groupId, groupState, groupDecorate ? 0 : 1));
return true; return true;
}, [ groupData, groupState, groupDecorate, setGroupData ]); }, [ groupData, groupState, groupDecorate, setGroupData ]);

View File

@ -1,9 +1,9 @@
import { GuideOnDutyStatusMessageEvent, GuideSessionAttachedMessageEvent, GuideSessionDetachedMessageEvent, GuideSessionEndedMessageEvent, GuideSessionInvitedToGuideRoomMessageEvent, GuideSessionMessageMessageEvent, GuideSessionOnDutyUpdateMessageComposer, GuideSessionPartnerIsTypingMessageEvent, GuideSessionStartedMessageEvent, ILinkEventTracker, PerkAllowancesMessageEvent, PerkEnum } from '@nitrots/nitro-renderer'; import { GuideOnDutyStatusMessageEvent, GuideSessionAttachedMessageEvent, GuideSessionDetachedMessageEvent, GuideSessionEndedMessageEvent, GuideSessionInvitedToGuideRoomMessageEvent, GuideSessionMessageMessageEvent, GuideSessionOnDutyUpdateMessageComposer, GuideSessionPartnerIsTypingMessageEvent, GuideSessionStartedMessageEvent, ILinkEventTracker, PerkAllowancesMessageEvent, PerkEnum } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { AddEventLinkTracker, GetConfiguration, GetSessionDataManager, LocalizeText, RemoveLinkEventTracker } from '../../api'; import { AddEventLinkTracker, GetConfiguration, GetSessionDataManager, LocalizeText, RemoveLinkEventTracker, SendMessageComposer } from '../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common';
import { GuideToolEvent, NotificationAlertEvent } from '../../events'; import { GuideToolEvent, NotificationAlertEvent } from '../../events';
import { CreateMessageHook, dispatchUiEvent, SendMessageHook, useUiEvent } from '../../hooks'; import { DispatchUiEvent, UseMessageEventHook, UseUiEvent } from '../../hooks';
import { GuideSessionState } from './common/GuideSessionState'; import { GuideSessionState } from './common/GuideSessionState';
import { GuideToolMessage } from './common/GuideToolMessage'; import { GuideToolMessage } from './common/GuideToolMessage';
import { GuideToolMessageGroup } from './common/GuideToolMessageGroup'; import { GuideToolMessageGroup } from './common/GuideToolMessageGroup';
@ -103,10 +103,10 @@ export const GuideToolView: FC<{}> = props =>
} }
}, [ updateSessionState ]); }, [ updateSessionState ]);
useUiEvent(GuideToolEvent.SHOW_GUIDE_TOOL, onGuideToolEvent); UseUiEvent(GuideToolEvent.SHOW_GUIDE_TOOL, onGuideToolEvent);
useUiEvent(GuideToolEvent.HIDE_GUIDE_TOOL, onGuideToolEvent); UseUiEvent(GuideToolEvent.HIDE_GUIDE_TOOL, onGuideToolEvent);
useUiEvent(GuideToolEvent.TOGGLE_GUIDE_TOOL, onGuideToolEvent); UseUiEvent(GuideToolEvent.TOGGLE_GUIDE_TOOL, onGuideToolEvent);
useUiEvent(GuideToolEvent.CREATE_HELP_REQUEST, onGuideToolEvent); UseUiEvent(GuideToolEvent.CREATE_HELP_REQUEST, onGuideToolEvent);
const onPerkAllowancesMessageEvent = useCallback((event: PerkAllowancesMessageEvent) => const onPerkAllowancesMessageEvent = useCallback((event: PerkAllowancesMessageEvent) =>
{ {
@ -115,11 +115,11 @@ export const GuideToolView: FC<{}> = props =>
if(!parser.isAllowed(PerkEnum.USE_GUIDE_TOOL) && isOnDuty) if(!parser.isAllowed(PerkEnum.USE_GUIDE_TOOL) && isOnDuty)
{ {
setIsOnDuty(false); setIsOnDuty(false);
SendMessageHook(new GuideSessionOnDutyUpdateMessageComposer(false, false, false, false)); SendMessageComposer(new GuideSessionOnDutyUpdateMessageComposer(false, false, false, false));
} }
}, [ isOnDuty, setIsOnDuty ]); }, [ isOnDuty, setIsOnDuty ]);
CreateMessageHook(PerkAllowancesMessageEvent, onPerkAllowancesMessageEvent); UseMessageEventHook(PerkAllowancesMessageEvent, onPerkAllowancesMessageEvent);
const onGuideOnDutyStatusMessageEvent = useCallback((event: GuideOnDutyStatusMessageEvent) => const onGuideOnDutyStatusMessageEvent = useCallback((event: GuideOnDutyStatusMessageEvent) =>
{ {
@ -131,7 +131,7 @@ export const GuideToolView: FC<{}> = props =>
setGuardiansOnDuty(parser.guardiansOnDuty); setGuardiansOnDuty(parser.guardiansOnDuty);
}, [ setIsOnDuty, setHelpersOnDuty, setGuidesOnDuty, setGuardiansOnDuty ]); }, [ setIsOnDuty, setHelpersOnDuty, setGuidesOnDuty, setGuardiansOnDuty ]);
CreateMessageHook(GuideOnDutyStatusMessageEvent, onGuideOnDutyStatusMessageEvent); UseMessageEventHook(GuideOnDutyStatusMessageEvent, onGuideOnDutyStatusMessageEvent);
const onGuideSessionAttachedMessageEvent = useCallback((event: GuideSessionAttachedMessageEvent) => const onGuideSessionAttachedMessageEvent = useCallback((event: GuideSessionAttachedMessageEvent) =>
{ {
@ -146,7 +146,7 @@ export const GuideToolView: FC<{}> = props =>
}, [ isOnDuty, updateSessionState ]); }, [ isOnDuty, updateSessionState ]);
CreateMessageHook(GuideSessionAttachedMessageEvent, onGuideSessionAttachedMessageEvent); UseMessageEventHook(GuideSessionAttachedMessageEvent, onGuideSessionAttachedMessageEvent);
const onGuideSessionStartedMessageEvent = useCallback((event: GuideSessionStartedMessageEvent) => const onGuideSessionStartedMessageEvent = useCallback((event: GuideSessionStartedMessageEvent) =>
{ {
@ -168,7 +168,7 @@ export const GuideToolView: FC<{}> = props =>
} }
}, [ isOnDuty, updateSessionState ]); }, [ isOnDuty, updateSessionState ]);
CreateMessageHook(GuideSessionStartedMessageEvent, onGuideSessionStartedMessageEvent); UseMessageEventHook(GuideSessionStartedMessageEvent, onGuideSessionStartedMessageEvent);
const onGuideSessionPartnerIsTypingMessageEvent = useCallback((event: GuideSessionPartnerIsTypingMessageEvent) => const onGuideSessionPartnerIsTypingMessageEvent = useCallback((event: GuideSessionPartnerIsTypingMessageEvent) =>
{ {
@ -177,7 +177,7 @@ export const GuideToolView: FC<{}> = props =>
setOngoingIsTyping(parser.isTyping); setOngoingIsTyping(parser.isTyping);
}, []); }, []);
CreateMessageHook(GuideSessionPartnerIsTypingMessageEvent, onGuideSessionPartnerIsTypingMessageEvent); UseMessageEventHook(GuideSessionPartnerIsTypingMessageEvent, onGuideSessionPartnerIsTypingMessageEvent);
const onGuideSessionMessageMessageEvent = useCallback((event: GuideSessionMessageMessageEvent) => const onGuideSessionMessageMessageEvent = useCallback((event: GuideSessionMessageMessageEvent) =>
{ {
@ -197,7 +197,7 @@ export const GuideToolView: FC<{}> = props =>
setOngoingMessageGroups(messageGroups); setOngoingMessageGroups(messageGroups);
}, [ ongoingMessageGroups ]); }, [ ongoingMessageGroups ]);
CreateMessageHook(GuideSessionMessageMessageEvent, onGuideSessionMessageMessageEvent); UseMessageEventHook(GuideSessionMessageMessageEvent, onGuideSessionMessageMessageEvent);
const onGuideSessionInvitedToGuideRoomMessageEvent = useCallback((event: GuideSessionInvitedToGuideRoomMessageEvent) => const onGuideSessionInvitedToGuideRoomMessageEvent = useCallback((event: GuideSessionInvitedToGuideRoomMessageEvent) =>
{ {
@ -219,7 +219,7 @@ export const GuideToolView: FC<{}> = props =>
setOngoingMessageGroups(messageGroups); setOngoingMessageGroups(messageGroups);
}, [isOnDuty, ongoingMessageGroups, ongoingUserId]); }, [isOnDuty, ongoingMessageGroups, ongoingUserId]);
CreateMessageHook(GuideSessionInvitedToGuideRoomMessageEvent, onGuideSessionInvitedToGuideRoomMessageEvent); UseMessageEventHook(GuideSessionInvitedToGuideRoomMessageEvent, onGuideSessionInvitedToGuideRoomMessageEvent);
const onGuideSessionEndedMessageEvent = useCallback((event: GuideSessionEndedMessageEvent) => const onGuideSessionEndedMessageEvent = useCallback((event: GuideSessionEndedMessageEvent) =>
{ {
@ -238,7 +238,7 @@ export const GuideToolView: FC<{}> = props =>
} }
}, [ isOnDuty, updateSessionState ]); }, [ isOnDuty, updateSessionState ]);
CreateMessageHook(GuideSessionEndedMessageEvent, onGuideSessionEndedMessageEvent); UseMessageEventHook(GuideSessionEndedMessageEvent, onGuideSessionEndedMessageEvent);
const onGuideSessionDetachedMessageEvent = useCallback((event: GuideSessionDetachedMessageEvent) => const onGuideSessionDetachedMessageEvent = useCallback((event: GuideSessionDetachedMessageEvent) =>
{ {
@ -259,7 +259,7 @@ export const GuideToolView: FC<{}> = props =>
} }
}, [ isOnDuty, updateSessionState ]); }, [ isOnDuty, updateSessionState ]);
CreateMessageHook(GuideSessionDetachedMessageEvent, onGuideSessionDetachedMessageEvent); UseMessageEventHook(GuideSessionDetachedMessageEvent, onGuideSessionDetachedMessageEvent);
const linkReceived = useCallback((url: string) => const linkReceived = useCallback((url: string) =>
{ {
@ -299,13 +299,13 @@ export const GuideToolView: FC<{}> = props =>
case 'toggle_duty': case 'toggle_duty':
if(!isHandlingBullyReports && !isHandlingGuideRequests && !isHandlingHelpRequests) if(!isHandlingBullyReports && !isHandlingGuideRequests && !isHandlingHelpRequests)
{ {
dispatchUiEvent(new NotificationAlertEvent([LocalizeText('guide.help.guide.tool.noqueueselected.message')], null, null, null, LocalizeText('guide.help.guide.tool.noqueueselected.caption'), null)); DispatchUiEvent(new NotificationAlertEvent([LocalizeText('guide.help.guide.tool.noqueueselected.message')], null, null, null, LocalizeText('guide.help.guide.tool.noqueueselected.caption'), null));
return; return;
} }
setIsOnDuty(v => setIsOnDuty(v =>
{ {
SendMessageHook(new GuideSessionOnDutyUpdateMessageComposer(!v, v ? false : isHandlingGuideRequests, v ? false : isHandlingHelpRequests, v ? false : isHandlingBullyReports)); SendMessageComposer(new GuideSessionOnDutyUpdateMessageComposer(!v, v ? false : isHandlingGuideRequests, v ? false : isHandlingHelpRequests, v ? false : isHandlingBullyReports));
return !v; return !v;
}); });

View File

@ -1,8 +1,7 @@
import { GuideSessionGuideDecidesMessageComposer } from '@nitrots/nitro-renderer'; import { GuideSessionGuideDecidesMessageComposer } from '@nitrots/nitro-renderer';
import { FC } from 'react'; import { FC } from 'react';
import { LocalizeText } from '../../../api'; import { LocalizeText, SendMessageComposer } from '../../../api';
import { Button, Column, Text } from '../../../common'; import { Button, Column, Text } from '../../../common';
import { SendMessageHook } from '../../../hooks';
interface GuideToolAcceptViewProps interface GuideToolAcceptViewProps
{ {
@ -14,7 +13,7 @@ export const GuideToolAcceptView: FC<GuideToolAcceptViewProps> = props =>
{ {
const { helpRequestDescription = null, helpRequestAverageTime = 0 } = props; const { helpRequestDescription = null, helpRequestAverageTime = 0 } = props;
const answerRequest = (response: boolean) => SendMessageHook(new GuideSessionGuideDecidesMessageComposer(response)); const answerRequest = (response: boolean) => SendMessageComposer(new GuideSessionGuideDecidesMessageComposer(response));
return ( return (
<Column> <Column>

View File

@ -1,9 +1,9 @@
import { GuideSessionGetRequesterRoomMessageComposer, GuideSessionInviteRequesterMessageComposer, GuideSessionRequesterRoomMessageEvent, GuideSessionResolvedMessageComposer } from '@nitrots/nitro-renderer'; import { GuideSessionGetRequesterRoomMessageComposer, GuideSessionInviteRequesterMessageComposer, GuideSessionRequesterRoomMessageEvent, GuideSessionResolvedMessageComposer } from '@nitrots/nitro-renderer';
import { GuideSessionMessageMessageComposer } from '@nitrots/nitro-renderer/src'; import { GuideSessionMessageMessageComposer } from '@nitrots/nitro-renderer/src';
import { FC, KeyboardEvent, useCallback, useState } from 'react'; import { FC, KeyboardEvent, useCallback, useState } from 'react';
import { GetSessionDataManager, LocalizeText, TryVisitRoom } from '../../../api'; import { GetSessionDataManager, LocalizeText, SendMessageComposer, TryVisitRoom } from '../../../api';
import { Base, Button, ButtonGroup, Column, Flex, Text } from '../../../common'; import { Base, Button, ButtonGroup, Column, Flex, Text } from '../../../common';
import { CreateMessageHook, SendMessageHook } from '../../../hooks'; import { UseMessageEventHook } from '../../../hooks';
import { AvatarImageView } from '../../../views/shared/avatar-image/AvatarImageView'; import { AvatarImageView } from '../../../views/shared/avatar-image/AvatarImageView';
import { GuideToolMessageGroup } from '../common/GuideToolMessageGroup'; import { GuideToolMessageGroup } from '../common/GuideToolMessageGroup';
@ -25,17 +25,17 @@ export const GuideToolOngoingView: FC<GuideToolOngoingViewProps> = props =>
const visit = useCallback(() => const visit = useCallback(() =>
{ {
SendMessageHook(new GuideSessionGetRequesterRoomMessageComposer()); SendMessageComposer(new GuideSessionGetRequesterRoomMessageComposer());
}, []); }, []);
const invite = useCallback(() => const invite = useCallback(() =>
{ {
SendMessageHook(new GuideSessionInviteRequesterMessageComposer()); SendMessageComposer(new GuideSessionInviteRequesterMessageComposer());
}, []); }, []);
const resolve = useCallback(() => const resolve = useCallback(() =>
{ {
SendMessageHook(new GuideSessionResolvedMessageComposer()); SendMessageComposer(new GuideSessionResolvedMessageComposer());
}, []); }, []);
const onGuideSessionRequesterRoomMessageEvent = useCallback((event: GuideSessionRequesterRoomMessageEvent) => const onGuideSessionRequesterRoomMessageEvent = useCallback((event: GuideSessionRequesterRoomMessageEvent) =>
@ -45,13 +45,13 @@ export const GuideToolOngoingView: FC<GuideToolOngoingViewProps> = props =>
TryVisitRoom(parser.requesterRoomId); TryVisitRoom(parser.requesterRoomId);
}, []); }, []);
CreateMessageHook(GuideSessionRequesterRoomMessageEvent, onGuideSessionRequesterRoomMessageEvent); UseMessageEventHook(GuideSessionRequesterRoomMessageEvent, onGuideSessionRequesterRoomMessageEvent);
const sendMessage = useCallback(() => const sendMessage = useCallback(() =>
{ {
if(!messageText || !messageText.length) return; if(!messageText || !messageText.length) return;
SendMessageHook(new GuideSessionMessageMessageComposer(messageText)); SendMessageComposer(new GuideSessionMessageMessageComposer(messageText));
setMessageText(''); setMessageText('');
}, [ messageText ]); }, [ messageText ]);

View File

@ -1,8 +1,7 @@
import { GuideSessionCreateMessageComposer } from '@nitrots/nitro-renderer'; import { GuideSessionCreateMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useState } from 'react'; import { FC, useState } from 'react';
import { LocalizeText } from '../../../api'; import { LocalizeText, SendMessageComposer } from '../../../api';
import { Button, Column, Text } from '../../../common'; import { Button, Column, Text } from '../../../common';
import { SendMessageHook } from '../../../hooks';
interface GuideToolUserCreateRequestViewProps interface GuideToolUserCreateRequestViewProps
{ {
@ -20,7 +19,7 @@ export const GuideToolUserCreateRequestView: FC<GuideToolUserCreateRequestViewPr
const sendRequest = () => const sendRequest = () =>
{ {
setIsPending(true); setIsPending(true);
SendMessageHook(new GuideSessionCreateMessageComposer(1, userRequest)); SendMessageComposer(new GuideSessionCreateMessageComposer(1, userRequest));
} }
return ( return (

View File

@ -1,8 +1,7 @@
import { GuideSessionFeedbackMessageComposer } from '@nitrots/nitro-renderer'; import { GuideSessionFeedbackMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import { LocalizeText } from '../../../api'; import { LocalizeText, SendMessageComposer } from '../../../api';
import { Button, Column, Flex, Text } from '../../../common'; import { Button, Column, Flex, Text } from '../../../common';
import { SendMessageHook } from '../../../hooks';
interface GuideToolUserFeedbackViewProps interface GuideToolUserFeedbackViewProps
{ {
@ -15,7 +14,7 @@ export const GuideToolUserFeedbackView: FC<GuideToolUserFeedbackViewProps> = pro
const giveFeedback = useCallback((recommend: boolean) => const giveFeedback = useCallback((recommend: boolean) =>
{ {
SendMessageHook(new GuideSessionFeedbackMessageComposer(recommend)); SendMessageComposer(new GuideSessionFeedbackMessageComposer(recommend));
}, []); }, []);
return ( return (

View File

@ -1,8 +1,7 @@
import { GuideSessionRequesterCancelsMessageComposer } from '@nitrots/nitro-renderer'; import { GuideSessionRequesterCancelsMessageComposer } from '@nitrots/nitro-renderer';
import { FC } from 'react'; import { FC } from 'react';
import { LocalizeText } from '../../../api'; import { LocalizeText, SendMessageComposer } from '../../../api';
import { Button, Column, Text } from '../../../common'; import { Button, Column, Text } from '../../../common';
import { SendMessageHook } from '../../../hooks';
interface GuideToolUserPendingViewProps interface GuideToolUserPendingViewProps
{ {
@ -14,7 +13,7 @@ export const GuideToolUserPendingView: FC<GuideToolUserPendingViewProps> = props
{ {
const { helpRequestDescription = null, helpRequestAverageTime = 0 } = props; const { helpRequestDescription = null, helpRequestAverageTime = 0 } = props;
const cancelRequest = () => SendMessageHook(new GuideSessionRequesterCancelsMessageComposer()); const cancelRequest = () => SendMessageComposer(new GuideSessionRequesterCancelsMessageComposer());
return ( return (
<Column> <Column>

View File

@ -1,7 +1,7 @@
import { CallForHelpResultMessageEvent, GetPendingCallsForHelpMessageComposer, IssueCloseNotificationMessageEvent } from '@nitrots/nitro-renderer'; import { CallForHelpResultMessageEvent, GetPendingCallsForHelpMessageComposer, IssueCloseNotificationMessageEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import { LocalizeText } from '../../api'; import { LocalizeText, SendMessageComposer } from '../../api';
import { CreateMessageHook, SendMessageHook } from '../../hooks/messages/message-event'; import { UseMessageEventHook } from '../../hooks';
import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType'; import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType';
import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities';
import { CallForHelpResult } from './common/CallForHelpResult'; import { CallForHelpResult } from './common/CallForHelpResult';
@ -18,7 +18,7 @@ export const HelpMessageHandler: FC<{}> = props =>
switch(parser.resultType) switch(parser.resultType)
{ {
case CallForHelpResult.TOO_MANY_PENDING_CALLS_CODE: case CallForHelpResult.TOO_MANY_PENDING_CALLS_CODE:
SendMessageHook(new GetPendingCallsForHelpMessageComposer()); SendMessageComposer(new GetPendingCallsForHelpMessageComposer());
NotificationUtilities.simpleAlert(LocalizeText('help.cfh.error.pending'), NotificationAlertType.MODERATION, null, null, LocalizeText('help.cfh.error.title')); NotificationUtilities.simpleAlert(LocalizeText('help.cfh.error.pending'), NotificationAlertType.MODERATION, null, null, LocalizeText('help.cfh.error.title'));
break; break;
case CallForHelpResult.HAS_ABUSIVE_CALL_CODE: case CallForHelpResult.HAS_ABUSIVE_CALL_CODE:
@ -33,7 +33,7 @@ export const HelpMessageHandler: FC<{}> = props =>
} }
}, []); }, []);
CreateMessageHook(CallForHelpResultMessageEvent, onCallForHelpResultMessageEvent); UseMessageEventHook(CallForHelpResultMessageEvent, onCallForHelpResultMessageEvent);
const onIssueCloseNotificationMessageEvent = useCallback((event: IssueCloseNotificationMessageEvent) => const onIssueCloseNotificationMessageEvent = useCallback((event: IssueCloseNotificationMessageEvent) =>
{ {
@ -44,7 +44,7 @@ export const HelpMessageHandler: FC<{}> = props =>
NotificationUtilities.simpleAlert(message, NotificationAlertType.MODERATION, null, null, LocalizeText('mod.alert.title')); NotificationUtilities.simpleAlert(message, NotificationAlertType.MODERATION, null, null, LocalizeText('mod.alert.title'));
}, []); }, []);
CreateMessageHook(IssueCloseNotificationMessageEvent, onIssueCloseNotificationMessageEvent); UseMessageEventHook(IssueCloseNotificationMessageEvent, onIssueCloseNotificationMessageEvent);
return null; return null;
} }

View File

@ -3,7 +3,7 @@ import { FC, useCallback, useEffect, useState } from 'react';
import { AddEventLinkTracker, LocalizeText, RemoveLinkEventTracker } from '../../api'; import { AddEventLinkTracker, LocalizeText, RemoveLinkEventTracker } from '../../api';
import { Base, Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common'; import { Base, Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common';
import { HelpReportUserEvent } from '../../events/help/HelpReportUserEvent'; import { HelpReportUserEvent } from '../../events/help/HelpReportUserEvent';
import { useUiEvent } from '../../hooks'; import { UseUiEvent } from '../../hooks';
import { IHelpReportState } from './common/IHelpReportState'; import { IHelpReportState } from './common/IHelpReportState';
import { HelpContextProvider } from './HelpContext'; import { HelpContextProvider } from './HelpContext';
import { HelpMessageHandler } from './HelpMessageHandler'; import { HelpMessageHandler } from './HelpMessageHandler';
@ -63,7 +63,7 @@ export const HelpView: FC<{}> = props =>
setIsVisible(true); setIsVisible(true);
}, []); }, []);
useUiEvent(HelpReportUserEvent.REPORT_USER, onHelpReportUserEvent); UseUiEvent(HelpReportUserEvent.REPORT_USER, onHelpReportUserEvent);
useEffect(() => useEffect(() =>
{ {

View File

@ -1,8 +1,7 @@
import { CallForHelpMessageComposer } from '@nitrots/nitro-renderer'; import { CallForHelpMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useState } from 'react'; import { FC, useState } from 'react';
import { CreateLinkEvent, LocalizeText } from '../../../api'; import { CreateLinkEvent, LocalizeText, SendMessageComposer } from '../../../api';
import { Button, Column, Text } from '../../../common'; import { Button, Column, Text } from '../../../common';
import { SendMessageHook } from '../../../hooks';
import { useHelpContext } from '../HelpContext'; import { useHelpContext } from '../HelpContext';
export const DescribeReportView: FC<{}> = props => export const DescribeReportView: FC<{}> = props =>
@ -24,7 +23,7 @@ export const DescribeReportView: FC<{}> = props =>
chats.push(entry.message); chats.push(entry.message);
}); });
SendMessageHook(new CallForHelpMessageComposer(message, cfhTopic, reportedUserId, roomId, chats)); SendMessageComposer(new CallForHelpMessageComposer(message, cfhTopic, reportedUserId, roomId, chats));
CreateLinkEvent('help/hide'); CreateLinkEvent('help/hide');
} }

View File

@ -1,11 +1,9 @@
import { GetCfhStatusMessageComposer } from '@nitrots/nitro-renderer'; import { GetCfhStatusMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import { LocalizeText } from '../../../api'; import { LocalizeText, SendMessageComposer } from '../../../api';
import { Button } from '../../../common/Button'; import { Button, Column, Text } from '../../../common';
import { Column } from '../../../common/Column'; import { GuideToolEvent } from '../../../events';
import { Text } from '../../../common/Text'; import { DispatchUiEvent } from '../../../hooks';
import { GuideToolEvent } from '../../../events/guide-tool/GuideToolEvent';
import { dispatchUiEvent, SendMessageHook } from '../../../hooks';
import { useHelpContext } from '../HelpContext'; import { useHelpContext } from '../HelpContext';
export const HelpIndexView: FC<{}> = props => export const HelpIndexView: FC<{}> = props =>
@ -21,12 +19,12 @@ export const HelpIndexView: FC<{}> = props =>
const onRequestMySanctionStatusClick = useCallback(() => const onRequestMySanctionStatusClick = useCallback(() =>
{ {
SendMessageHook(new GetCfhStatusMessageComposer(false)); SendMessageComposer(new GetCfhStatusMessageComposer(false));
}, []); }, []);
const onNewHelpRequestClick = useCallback(() => const onNewHelpRequestClick = useCallback(() =>
{ {
dispatchUiEvent(new GuideToolEvent(GuideToolEvent.CREATE_HELP_REQUEST)); DispatchUiEvent(new GuideToolEvent(GuideToolEvent.CREATE_HELP_REQUEST));
}, []); }, []);
return ( return (

View File

@ -2,7 +2,7 @@ import { SanctionStatusEvent, SanctionStatusMessageParser } from '@nitrots/nitro
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { LocalizeText } from '../../../api'; import { LocalizeText } from '../../../api';
import { Base, Button, Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../common'; import { Base, Button, Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../common';
import { CreateMessageHook } from '../../../hooks'; import { UseMessageEventHook } from '../../../hooks';
export const SanctionSatusView:FC<{}> = props => export const SanctionSatusView:FC<{}> = props =>
{ {
@ -17,7 +17,7 @@ export const SanctionSatusView:FC<{}> = props =>
setSanctionInfo(parser); setSanctionInfo(parser);
}, []); }, []);
CreateMessageHook(SanctionStatusEvent, onSanctionStatusEvent); UseMessageEventHook(SanctionStatusEvent, onSanctionStatusEvent);
const sanctionLocalization = useCallback((param: string, sanctionName: string, length?: number) => const sanctionLocalization = useCallback((param: string, sanctionName: string, length?: number) =>
{ {

View File

@ -1,7 +1,7 @@
import { ChangeUserNameMessageComposer, UserNameChangeMessageEvent } from '@nitrots/nitro-renderer'; import { ChangeUserNameMessageComposer, UserNameChangeMessageEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { GetSessionDataManager, LocalizeText } from '../../../../api'; import { GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../../api';
import { CreateMessageHook, SendMessageHook } from '../../../../hooks'; import { UseMessageEventHook } from '../../../../hooks';
import { NameChangeLayoutViewProps } from './NameChangeView.types'; import { NameChangeLayoutViewProps } from './NameChangeView.types';
export const NameChangeConfirmationView:FC<NameChangeLayoutViewProps> = props => export const NameChangeConfirmationView:FC<NameChangeLayoutViewProps> = props =>
@ -21,14 +21,14 @@ export const NameChangeConfirmationView:FC<NameChangeLayoutViewProps> = props =>
onAction('close'); onAction('close');
}, [ onAction ]); }, [ onAction ]);
CreateMessageHook(UserNameChangeMessageEvent, onUserNameChangeMessageEvent); UseMessageEventHook(UserNameChangeMessageEvent, onUserNameChangeMessageEvent);
const confirm = useCallback(() => const confirm = useCallback(() =>
{ {
if(isConfirming) return; if(isConfirming) return;
setIsConfirming(true); setIsConfirming(true);
SendMessageHook(new ChangeUserNameMessageComposer(username)); SendMessageComposer(new ChangeUserNameMessageComposer(username));
}, [ isConfirming, username ]); }, [ isConfirming, username ]);
return ( return (

View File

@ -1,7 +1,7 @@
import { CheckUserNameMessageComposer, CheckUserNameResultMessageEvent } from '@nitrots/nitro-renderer'; import { CheckUserNameMessageComposer, CheckUserNameResultMessageEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { LocalizeText } from '../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../api';
import { CreateMessageHook, SendMessageHook } from '../../../../hooks'; import { UseMessageEventHook } from '../../../../hooks';
import { NameChangeLayoutViewProps } from './NameChangeView.types'; import { NameChangeLayoutViewProps } from './NameChangeView.types';
const AVAILABLE: number = 0; const AVAILABLE: number = 0;
@ -52,7 +52,7 @@ export const NameChangeInputView:FC<NameChangeLayoutViewProps> = props =>
} }
}, []); }, []);
CreateMessageHook(CheckUserNameResultMessageEvent, onCheckUserNameResultMessageEvent); UseMessageEventHook(CheckUserNameResultMessageEvent, onCheckUserNameResultMessageEvent);
const check = useCallback(() => const check = useCallback(() =>
{ {
@ -63,7 +63,7 @@ export const NameChangeInputView:FC<NameChangeLayoutViewProps> = props =>
setErrorCode(null); setErrorCode(null);
setIsChecking(true); setIsChecking(true);
SendMessageHook(new CheckUserNameMessageComposer(newUsername)); SendMessageComposer(new CheckUserNameMessageComposer(newUsername));
}, [ newUsername ]); }, [ newUsername ]);
const handleUsernameChange = useCallback((username: string) => const handleUsernameChange = useCallback((username: string) =>

View File

@ -2,7 +2,7 @@ import { FC, useCallback, useMemo, useState } from 'react';
import { LocalizeText } from '../../../../api'; import { LocalizeText } from '../../../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
import { HelpNameChangeEvent } from '../../../../events'; import { HelpNameChangeEvent } from '../../../../events';
import { useUiEvent } from '../../../../hooks'; import { UseUiEvent } from '../../../../hooks';
import { NameChangeConfirmationView } from './NameChangeConfirmationView'; import { NameChangeConfirmationView } from './NameChangeConfirmationView';
import { NameChangeInitView } from './NameChangeInitView'; import { NameChangeInitView } from './NameChangeInitView';
import { NameChangeInputView } from './NameChangeInputView'; import { NameChangeInputView } from './NameChangeInputView';
@ -23,7 +23,7 @@ export const NameChangeView:FC<{}> = props =>
setIsVisible(true); setIsVisible(true);
}, []); }, []);
useUiEvent(HelpNameChangeEvent.INIT, onHelpNameChangeEvent); UseUiEvent(HelpNameChangeEvent.INIT, onHelpNameChangeEvent);
const onAction = useCallback((action: string, value?: string) => const onAction = useCallback((action: string, value?: string) =>
{ {

View File

@ -1,10 +1,10 @@
import { AdvancedMap, BadgePointLimitsEvent, BadgeReceivedEvent, BadgesEvent, BotAddedToInventoryEvent, BotInventoryMessageEvent, BotRemovedFromInventoryEvent, FurnitureListAddOrUpdateEvent, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListItemParser, FurnitureListRemovedEvent, FurniturePostItPlacedEvent, PetAddedToInventoryEvent, PetData, PetInventoryEvent, PetRemovedFromInventory, RequestBadgesComposer, TradingAcceptEvent, TradingCloseEvent, TradingCompletedEvent, TradingConfirmationEvent, TradingListItemEvent, TradingNotOpenEvent, TradingOpenEvent, TradingOpenFailedEvent, TradingOtherNotAllowedEvent, TradingYouAreNotAllowedEvent, UnseenItemsEvent } from '@nitrots/nitro-renderer'; import { AdvancedMap, BadgePointLimitsEvent, BadgeReceivedEvent, BadgesEvent, BotAddedToInventoryEvent, BotInventoryMessageEvent, BotRemovedFromInventoryEvent, FurnitureListAddOrUpdateEvent, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListItemParser, FurnitureListRemovedEvent, FurniturePostItPlacedEvent, PetAddedToInventoryEvent, PetData, PetInventoryEvent, PetRemovedFromInventory, RequestBadgesComposer, TradingAcceptEvent, TradingCloseEvent, TradingCompletedEvent, TradingConfirmationEvent, TradingListItemEvent, TradingNotOpenEvent, TradingOpenEvent, TradingOpenFailedEvent, TradingOtherNotAllowedEvent, TradingYouAreNotAllowedEvent, UnseenItemsEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import { GetLocalization, GetRoomSession, GetSessionDataManager, LocalizeText } from '../../api'; import { GetLocalization, GetRoomSession, GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../api';
import { InventoryBadgesUpdatedEvent } from '../../events'; import { InventoryBadgesUpdatedEvent } from '../../events';
import { InventoryBadgesRequestEvent } from '../../events/inventory/InventoryBadgesRequestEvent'; import { InventoryBadgesRequestEvent } from '../../events/inventory/InventoryBadgesRequestEvent';
import { dispatchUiEvent, useUiEvent } from '../../hooks'; import { DispatchUiEvent, UseUiEvent } from '../../hooks';
import { CreateMessageHook, SendMessageHook } from '../../hooks/messages/message-event'; import { UseMessageEventHook } from '../../hooks/messages/UseMessageEventHook';
import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities';
import { mergeFurniFragments } from './common/FurnitureUtilities'; import { mergeFurniFragments } from './common/FurnitureUtilities';
import { mergePetFragments } from './common/PetUtilities'; import { mergePetFragments } from './common/PetUtilities';
@ -326,45 +326,45 @@ export const InventoryMessageHandler: FC<{}> = props =>
for(const data of parser.data) GetLocalization().setBadgePointLimit(data.badgeId, data.limit); for(const data of parser.data) GetLocalization().setBadgePointLimit(data.badgeId, data.limit);
}, []); }, []);
CreateMessageHook(FurnitureListAddOrUpdateEvent, onFurnitureListAddOrUpdateEvent); UseMessageEventHook(FurnitureListAddOrUpdateEvent, onFurnitureListAddOrUpdateEvent);
CreateMessageHook(FurnitureListEvent, onFurnitureListEvent); UseMessageEventHook(FurnitureListEvent, onFurnitureListEvent);
CreateMessageHook(FurnitureListInvalidateEvent, onFurnitureListInvalidateEvent); UseMessageEventHook(FurnitureListInvalidateEvent, onFurnitureListInvalidateEvent);
CreateMessageHook(FurnitureListRemovedEvent, onFurnitureListRemovedEvent); UseMessageEventHook(FurnitureListRemovedEvent, onFurnitureListRemovedEvent);
CreateMessageHook(FurniturePostItPlacedEvent, onFurniturePostItPlacedEvent); UseMessageEventHook(FurniturePostItPlacedEvent, onFurniturePostItPlacedEvent);
CreateMessageHook(BotInventoryMessageEvent, onBotInventoryMessageEvent); UseMessageEventHook(BotInventoryMessageEvent, onBotInventoryMessageEvent);
CreateMessageHook(BotRemovedFromInventoryEvent, onBotRemovedFromInventoryEvent); UseMessageEventHook(BotRemovedFromInventoryEvent, onBotRemovedFromInventoryEvent);
CreateMessageHook(BotAddedToInventoryEvent, onBotAddedToInventoryEvent); UseMessageEventHook(BotAddedToInventoryEvent, onBotAddedToInventoryEvent);
CreateMessageHook(PetInventoryEvent, onPetInventoryEvent); UseMessageEventHook(PetInventoryEvent, onPetInventoryEvent);
CreateMessageHook(PetRemovedFromInventory, onPetRemovedFromInventory); UseMessageEventHook(PetRemovedFromInventory, onPetRemovedFromInventory);
CreateMessageHook(PetAddedToInventoryEvent, onPetAddedToInventoryEvent); UseMessageEventHook(PetAddedToInventoryEvent, onPetAddedToInventoryEvent);
CreateMessageHook(BadgesEvent, onBadgesEvent); UseMessageEventHook(BadgesEvent, onBadgesEvent);
CreateMessageHook(BadgeReceivedEvent, onBadgeReceivedEvent); UseMessageEventHook(BadgeReceivedEvent, onBadgeReceivedEvent);
CreateMessageHook(TradingAcceptEvent, onTradingAcceptEvent); UseMessageEventHook(TradingAcceptEvent, onTradingAcceptEvent);
CreateMessageHook(TradingCloseEvent, onTradingCloseEvent); UseMessageEventHook(TradingCloseEvent, onTradingCloseEvent);
CreateMessageHook(TradingCompletedEvent, onTradingCompletedEvent); UseMessageEventHook(TradingCompletedEvent, onTradingCompletedEvent);
CreateMessageHook(TradingConfirmationEvent, onTradingConfirmationEvent); UseMessageEventHook(TradingConfirmationEvent, onTradingConfirmationEvent);
CreateMessageHook(TradingListItemEvent, onTradingListItemEvent); UseMessageEventHook(TradingListItemEvent, onTradingListItemEvent);
CreateMessageHook(TradingNotOpenEvent, onTradingNotOpenEvent); UseMessageEventHook(TradingNotOpenEvent, onTradingNotOpenEvent);
CreateMessageHook(TradingOpenEvent, onTradingOpenEvent); UseMessageEventHook(TradingOpenEvent, onTradingOpenEvent);
CreateMessageHook(TradingOpenFailedEvent, onTradingOpenFailedEvent); UseMessageEventHook(TradingOpenFailedEvent, onTradingOpenFailedEvent);
CreateMessageHook(TradingOtherNotAllowedEvent, onTradingOtherNotAllowedEvent); UseMessageEventHook(TradingOtherNotAllowedEvent, onTradingOtherNotAllowedEvent);
CreateMessageHook(TradingYouAreNotAllowedEvent, onTradingYouAreNotAllowedEvent); UseMessageEventHook(TradingYouAreNotAllowedEvent, onTradingYouAreNotAllowedEvent);
CreateMessageHook(UnseenItemsEvent, onUnseenItemsEvent); UseMessageEventHook(UnseenItemsEvent, onUnseenItemsEvent);
CreateMessageHook(BadgePointLimitsEvent, onBadgePointLimitsEvent); UseMessageEventHook(BadgePointLimitsEvent, onBadgePointLimitsEvent);
const onInventoryBadgesRequestEvent = useCallback((event: InventoryBadgesRequestEvent) => const onInventoryBadgesRequestEvent = useCallback((event: InventoryBadgesRequestEvent) =>
{ {
if(badgeState.needsBadgeUpdate) if(badgeState.needsBadgeUpdate)
{ {
SendMessageHook(new RequestBadgesComposer()); SendMessageComposer(new RequestBadgesComposer());
return; return;
} }
dispatchUiEvent(new InventoryBadgesUpdatedEvent(InventoryBadgesUpdatedEvent.BADGES_UPDATED, badgeState.badges)); DispatchUiEvent(new InventoryBadgesUpdatedEvent(InventoryBadgesUpdatedEvent.BADGES_UPDATED, badgeState.badges));
}, [ badgeState ]) }, [ badgeState ])
useUiEvent(InventoryBadgesRequestEvent.REQUEST_BADGES, onInventoryBadgesRequestEvent); UseUiEvent(InventoryBadgesRequestEvent.REQUEST_BADGES, onInventoryBadgesRequestEvent);
return null; return null;
} }

View File

@ -1,12 +1,9 @@
import { IRoomSession, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomPreviewer, RoomSessionEvent, TradingCancelComposer, TradingCloseComposer, TradingOpenComposer } from '@nitrots/nitro-renderer'; import { IRoomSession, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomPreviewer, RoomSessionEvent, TradingCancelComposer, TradingCloseComposer, TradingOpenComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useReducer, useState } from 'react'; import { FC, useCallback, useEffect, useReducer, useState } from 'react';
import { GetRoomEngine, LocalizeText } from '../../api'; import { GetRoomEngine, LocalizeText, SendMessageComposer } from '../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common'; import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
import { InventoryBadgesUpdatedEvent, InventoryEvent, InventoryTradeRequestEvent } from '../../events'; import { InventoryBadgesUpdatedEvent, InventoryEvent, InventoryTradeRequestEvent } from '../../events';
import { useRoomEngineEvent } from '../../hooks/events/nitro/room/room-engine-event'; import { DispatchUiEvent, UseRoomEngineEvent, UseRoomSessionManagerEvent, UseUiEvent } from '../../hooks';
import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event';
import { dispatchUiEvent, useUiEvent } from '../../hooks/events/ui/ui-event';
import { SendMessageHook } from '../../hooks/messages';
import { isObjectMoverRequested, setObjectMoverRequested } from './common/InventoryUtilities'; import { isObjectMoverRequested, setObjectMoverRequested } from './common/InventoryUtilities';
import { TradeState } from './common/TradeState'; import { TradeState } from './common/TradeState';
import { IUnseenItemTracker } from './common/unseen/IUnseenItemTracker'; import { IUnseenItemTracker } from './common/unseen/IUnseenItemTracker';
@ -50,10 +47,10 @@ export const InventoryView: FC<{}> = props =>
switch(furnitureState.tradeData.state) switch(furnitureState.tradeData.state)
{ {
case TradeState.TRADING_STATE_RUNNING: case TradeState.TRADING_STATE_RUNNING:
SendMessageHook(new TradingCloseComposer()); SendMessageComposer(new TradingCloseComposer());
return; return;
default: default:
SendMessageHook(new TradingCancelComposer()); SendMessageComposer(new TradingCancelComposer());
return; return;
} }
} }
@ -88,15 +85,15 @@ export const InventoryView: FC<{}> = props =>
case InventoryTradeRequestEvent.REQUEST_TRADE: { case InventoryTradeRequestEvent.REQUEST_TRADE: {
const tradeEvent = (event as InventoryTradeRequestEvent); const tradeEvent = (event as InventoryTradeRequestEvent);
SendMessageHook(new TradingOpenComposer(tradeEvent.objectId)); SendMessageComposer(new TradingOpenComposer(tradeEvent.objectId));
} }
} }
}, [ isVisible, close ]); }, [ isVisible, close ]);
useUiEvent(InventoryEvent.SHOW_INVENTORY, onInventoryEvent); UseUiEvent(InventoryEvent.SHOW_INVENTORY, onInventoryEvent);
useUiEvent(InventoryEvent.HIDE_INVENTORY, onInventoryEvent); UseUiEvent(InventoryEvent.HIDE_INVENTORY, onInventoryEvent);
useUiEvent(InventoryEvent.TOGGLE_INVENTORY, onInventoryEvent); UseUiEvent(InventoryEvent.TOGGLE_INVENTORY, onInventoryEvent);
useUiEvent(InventoryTradeRequestEvent.REQUEST_TRADE, onInventoryEvent); UseUiEvent(InventoryTradeRequestEvent.REQUEST_TRADE, onInventoryEvent);
const onRoomEngineObjectPlacedEvent = useCallback((event: RoomEngineObjectPlacedEvent) => const onRoomEngineObjectPlacedEvent = useCallback((event: RoomEngineObjectPlacedEvent) =>
{ {
@ -107,7 +104,7 @@ export const InventoryView: FC<{}> = props =>
if(!event.placedInRoom) setIsVisible(true); if(!event.placedInRoom) setIsVisible(true);
}, []); }, []);
useRoomEngineEvent(RoomEngineObjectEvent.PLACED, onRoomEngineObjectPlacedEvent); UseRoomEngineEvent(RoomEngineObjectEvent.PLACED, onRoomEngineObjectPlacedEvent);
const onRoomSessionEvent = useCallback((event: RoomSessionEvent) => const onRoomSessionEvent = useCallback((event: RoomSessionEvent) =>
{ {
@ -123,8 +120,8 @@ export const InventoryView: FC<{}> = props =>
} }
}, []); }, []);
useRoomSessionManagerEvent(RoomSessionEvent.CREATED, onRoomSessionEvent); UseRoomSessionManagerEvent(RoomSessionEvent.CREATED, onRoomSessionEvent);
useRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent); UseRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent);
const resetTrackerForTab = useCallback((name: string) => const resetTrackerForTab = useCallback((name: string) =>
{ {
@ -192,7 +189,7 @@ export const InventoryView: FC<{}> = props =>
{ {
if(!badgeState.badges) return; if(!badgeState.badges) return;
dispatchUiEvent(new InventoryBadgesUpdatedEvent(InventoryBadgesUpdatedEvent.BADGES_UPDATED, badgeState.badges)); DispatchUiEvent(new InventoryBadgesUpdatedEvent(InventoryBadgesUpdatedEvent.BADGES_UPDATED, badgeState.badges));
}, [ badgeState.badges ]); }, [ badgeState.badges ]);
return ( return (

View File

@ -1,7 +1,7 @@
import { BotData, RoomObjectCategory, RoomObjectPlacementSource, RoomObjectType } from '@nitrots/nitro-renderer'; import { BotData, RoomObjectCategory, RoomObjectPlacementSource, RoomObjectType } from '@nitrots/nitro-renderer';
import { GetRoomEngine, GetRoomSessionManager } from '../../../api'; import { GetRoomEngine, GetRoomSessionManager } from '../../../api';
import { InventoryEvent } from '../../../events'; import { InventoryEvent } from '../../../events';
import { dispatchUiEvent } from '../../../hooks/events/ui/ui-event'; import { DispatchUiEvent } from '../../../hooks';
import { BotItem } from './BotItem'; import { BotItem } from './BotItem';
import { getPlacingItemId, setObjectMoverRequested, setPlacingItemId } from './InventoryUtilities'; import { getPlacingItemId, setObjectMoverRequested, setPlacingItemId } from './InventoryUtilities';
import { IUnseenItemTracker } from './unseen/IUnseenItemTracker'; import { IUnseenItemTracker } from './unseen/IUnseenItemTracker';
@ -27,7 +27,7 @@ export function attemptBotPlacement(botItem: BotItem, flag: boolean = false): bo
if(!session || !session.isRoomOwner) return false; if(!session || !session.isRoomOwner) return false;
dispatchUiEvent(new InventoryEvent(InventoryEvent.HIDE_INVENTORY)); DispatchUiEvent(new InventoryEvent(InventoryEvent.HIDE_INVENTORY));
if(GetRoomEngine().processRoomObjectPlacement(RoomObjectPlacementSource.INVENTORY, -(botData.id), RoomObjectCategory.UNIT, RoomObjectType.RENTABLE_BOT, botData.figure)) if(GetRoomEngine().processRoomObjectPlacement(RoomObjectPlacementSource.INVENTORY, -(botData.id), RoomObjectCategory.UNIT, RoomObjectType.RENTABLE_BOT, botData.figure))
{ {
@ -98,7 +98,7 @@ export function removeBotItemById(id: number, set: BotItem[]): BotItem
{ {
cancelRoomObjectPlacement(); cancelRoomObjectPlacement();
setTimeout(() => dispatchUiEvent(new InventoryEvent(InventoryEvent.SHOW_INVENTORY)), 1); setTimeout(() => DispatchUiEvent(new InventoryEvent(InventoryEvent.SHOW_INVENTORY)), 1);
} }
set.splice(index, 1); set.splice(index, 1);

View File

@ -1,9 +1,7 @@
import { FurnitureListItemParser, FurniturePlacePaintComposer, IObjectData, RoomObjectCategory, RoomObjectPlacementSource } from '@nitrots/nitro-renderer'; import { FurnitureListItemParser, FurniturePlacePaintComposer, IObjectData, RoomObjectCategory, RoomObjectPlacementSource } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from '../../../api'; import { GetRoomEngine, SendMessageComposer } from '../../../api';
import { InventoryEvent } from '../../../events'; import { CatalogPostMarketplaceOfferEvent, InventoryEvent } from '../../../events';
import { CatalogPostMarketplaceOfferEvent } from '../../../events/catalog/CatalogPostMarketplaceOfferEvent'; import { DispatchUiEvent } from '../../../hooks';
import { dispatchUiEvent } from '../../../hooks/events/ui/ui-event';
import { SendMessageHook } from '../../../hooks/messages/message-event';
import { FurniCategory } from './FurniCategory'; import { FurniCategory } from './FurniCategory';
import { FurnitureItem } from './FurnitureItem'; import { FurnitureItem } from './FurnitureItem';
import { GroupItem } from './GroupItem'; import { GroupItem } from './GroupItem';
@ -23,13 +21,13 @@ export function attemptItemPlacement(groupItem: GroupItem, flag: boolean = false
{ {
if(flag) return false; if(flag) return false;
SendMessageHook(new FurniturePlacePaintComposer(item.id)); SendMessageComposer(new FurniturePlacePaintComposer(item.id));
return false; return false;
} }
else else
{ {
dispatchUiEvent(new InventoryEvent(InventoryEvent.HIDE_INVENTORY)); DispatchUiEvent(new InventoryEvent(InventoryEvent.HIDE_INVENTORY));
let category = 0; let category = 0;
let isMoving = false; let isMoving = false;
@ -64,7 +62,7 @@ export function attemptPlaceMarketplaceOffer(groupItem: GroupItem): boolean
if(!item.sellable) return false; if(!item.sellable) return false;
dispatchUiEvent(new CatalogPostMarketplaceOfferEvent(item)); DispatchUiEvent(new CatalogPostMarketplaceOfferEvent(item));
} }
function cancelRoomObjectPlacement(): void function cancelRoomObjectPlacement(): void
@ -180,7 +178,7 @@ export function removeFurniItemById(id: number, set: GroupItem[]): GroupItem
if(!attemptItemPlacement(group)) if(!attemptItemPlacement(group))
{ {
setTimeout(() => dispatchUiEvent(new InventoryEvent(InventoryEvent.SHOW_INVENTORY)), 1); setTimeout(() => DispatchUiEvent(new InventoryEvent(InventoryEvent.SHOW_INVENTORY)), 1);
} }
} }

View File

@ -1,7 +1,7 @@
import { PetData, RoomObjectCategory, RoomObjectPlacementSource, RoomObjectType } from '@nitrots/nitro-renderer'; import { PetData, RoomObjectCategory, RoomObjectPlacementSource, RoomObjectType } from '@nitrots/nitro-renderer';
import { GetRoomEngine, GetRoomSessionManager } from '../../../api'; import { GetRoomEngine, GetRoomSessionManager } from '../../../api';
import { InventoryEvent } from '../../../events'; import { InventoryEvent } from '../../../events';
import { dispatchUiEvent } from '../../../hooks/events/ui/ui-event'; import { DispatchUiEvent } from '../../../hooks';
import { getPlacingItemId, setObjectMoverRequested, setPlacingItemId } from './InventoryUtilities'; import { getPlacingItemId, setObjectMoverRequested, setPlacingItemId } from './InventoryUtilities';
import { PetItem } from './PetItem'; import { PetItem } from './PetItem';
import { IUnseenItemTracker } from './unseen/IUnseenItemTracker'; import { IUnseenItemTracker } from './unseen/IUnseenItemTracker';
@ -32,7 +32,7 @@ export function attemptPetPlacement(petItem: PetItem, flag: boolean = false): bo
if(!session.allowPets) return false; if(!session.allowPets) return false;
} }
dispatchUiEvent(new InventoryEvent(InventoryEvent.HIDE_INVENTORY)); DispatchUiEvent(new InventoryEvent(InventoryEvent.HIDE_INVENTORY));
if(GetRoomEngine().processRoomObjectPlacement(RoomObjectPlacementSource.INVENTORY, -(petData.id), RoomObjectCategory.UNIT, RoomObjectType.PET, petData.figureData.figuredata)) if(GetRoomEngine().processRoomObjectPlacement(RoomObjectPlacementSource.INVENTORY, -(petData.id), RoomObjectCategory.UNIT, RoomObjectType.PET, petData.figureData.figuredata))
{ {
@ -117,7 +117,7 @@ export function removePetItemById(id: number, set: PetItem[]): PetItem
{ {
cancelRoomObjectPlacement(); cancelRoomObjectPlacement();
setTimeout(() => dispatchUiEvent(new InventoryEvent(InventoryEvent.SHOW_INVENTORY)), 1); setTimeout(() => DispatchUiEvent(new InventoryEvent(InventoryEvent.SHOW_INVENTORY)), 1);
} }
set.splice(index, 1); set.splice(index, 1);

View File

@ -1,6 +1,7 @@
import { UnseenResetCategoryComposer, UnseenResetItemsComposer } from '@nitrots/nitro-renderer'; import { UnseenResetCategoryComposer, UnseenResetItemsComposer } from '@nitrots/nitro-renderer';
import { SendMessageComposer } from '../../../../api';
import { UnseenItemTrackerUpdateEvent } from '../../../../events'; import { UnseenItemTrackerUpdateEvent } from '../../../../events';
import { dispatchUiEvent, SendMessageHook } from '../../../../hooks'; import { DispatchUiEvent } from '../../../../hooks';
import { IUnseenItemTracker } from './IUnseenItemTracker'; import { IUnseenItemTracker } from './IUnseenItemTracker';
export class UnseenItemTracker implements IUnseenItemTracker export class UnseenItemTracker implements IUnseenItemTracker
@ -130,16 +131,16 @@ export class UnseenItemTracker implements IUnseenItemTracker
private dispatchUpdateEvent(): void private dispatchUpdateEvent(): void
{ {
dispatchUiEvent(new UnseenItemTrackerUpdateEvent(this.getFullCount())); DispatchUiEvent(new UnseenItemTrackerUpdateEvent(this.getFullCount()));
} }
private sendResetCategoryMessage(category: number): void private sendResetCategoryMessage(category: number): void
{ {
SendMessageHook(new UnseenResetCategoryComposer(category)); SendMessageComposer(new UnseenResetCategoryComposer(category));
} }
private sendResetItemsMessage(category: number, itemIds: number[]): void private sendResetItemsMessage(category: number, itemIds: number[]): void
{ {
SendMessageHook(new UnseenResetItemsComposer(category, ...itemIds)); SendMessageComposer(new UnseenResetItemsComposer(category, ...itemIds));
} }
} }

View File

@ -1,6 +1,6 @@
import { SetActivatedBadgesComposer } from '@nitrots/nitro-renderer'; import { SetActivatedBadgesComposer } from '@nitrots/nitro-renderer';
import { Reducer } from 'react'; import { Reducer } from 'react';
import { SendMessageHook } from '../../../hooks/messages/message-event'; import { SendMessageComposer } from '../../../api';
export interface IInventoryBadgeState export interface IInventoryBadgeState
{ {
@ -102,7 +102,7 @@ export const InventoryBadgeReducer: Reducer<IInventoryBadgeState, IInventoryBadg
composer.addActivatedBadge(badgeCode); composer.addActivatedBadge(badgeCode);
} }
SendMessageHook(composer); SendMessageComposer(composer);
return { ...state, activeBadges }; return { ...state, activeBadges };
} }
@ -124,7 +124,7 @@ export const InventoryBadgeReducer: Reducer<IInventoryBadgeState, IInventoryBadg
composer.addActivatedBadge(badgeCode); composer.addActivatedBadge(badgeCode);
} }
SendMessageHook(composer); SendMessageComposer(composer);
return { ...state, activeBadges }; return { ...state, activeBadges };
} }

View File

@ -1,13 +1,7 @@
import { RequestBadgesComposer } from '@nitrots/nitro-renderer'; import { RequestBadgesComposer } from '@nitrots/nitro-renderer';
import { FC, useEffect } from 'react'; import { FC, useEffect } from 'react';
import { GetConfiguration, LocalizeBadgeName, LocalizeText } from '../../../../api'; import { GetConfiguration, LocalizeBadgeName, LocalizeText, SendMessageComposer } from '../../../../api';
import { AutoGrid } from '../../../../common/AutoGrid'; import { AutoGrid, Button, Column, Flex, Grid, Text } from '../../../../common';
import { Button } from '../../../../common/Button';
import { Column } from '../../../../common/Column';
import { Flex } from '../../../../common/Flex';
import { Grid } from '../../../../common/Grid';
import { Text } from '../../../../common/Text';
import { SendMessageHook } from '../../../../hooks/messages/message-event';
import { BadgeImageView } from '../../../../views/shared/badge-image/BadgeImageView'; import { BadgeImageView } from '../../../../views/shared/badge-image/BadgeImageView';
import { useInventoryContext } from '../../InventoryContext'; import { useInventoryContext } from '../../InventoryContext';
import { InventoryBadgeActions } from '../../reducers/InventoryBadgeReducer'; import { InventoryBadgeActions } from '../../reducers/InventoryBadgeReducer';
@ -62,7 +56,7 @@ export const InventoryBadgeView: FC<InventoryBadgeViewProps> = props =>
} }
}); });
SendMessageHook(new RequestBadgesComposer()); SendMessageComposer(new RequestBadgesComposer());
} }
else else
{ {

View File

@ -1,6 +1,6 @@
import { MouseEventType } from '@nitrots/nitro-renderer'; import { MouseEventType } from '@nitrots/nitro-renderer';
import { FC, MouseEvent, useEffect, useState } from 'react'; import { FC, MouseEvent, useEffect, useState } from 'react';
import { LayoutGridItem } from '../../../../common/layout/LayoutGridItem'; import { LayoutGridItem } from '../../../../common';
import { AvatarImageView } from '../../../../views/shared/avatar-image/AvatarImageView'; import { AvatarImageView } from '../../../../views/shared/avatar-image/AvatarImageView';
import { BotItem } from '../../common/BotItem'; import { BotItem } from '../../common/BotItem';
import { attemptBotPlacement } from '../../common/BotUtilities'; import { attemptBotPlacement } from '../../common/BotUtilities';

View File

@ -1,12 +1,7 @@
import { GetBotInventoryComposer, IRoomSession, RoomObjectVariable, RoomPreviewer } from '@nitrots/nitro-renderer'; import { GetBotInventoryComposer, IRoomSession, RoomObjectVariable, RoomPreviewer } from '@nitrots/nitro-renderer';
import { FC, useEffect } from 'react'; import { FC, useEffect } from 'react';
import { GetRoomEngine, LocalizeText } from '../../../../api'; import { GetRoomEngine, LocalizeText, SendMessageComposer } from '../../../../api';
import { AutoGrid } from '../../../../common/AutoGrid'; import { AutoGrid, Button, Column, Grid, Text } from '../../../../common';
import { Button } from '../../../../common/Button';
import { Column } from '../../../../common/Column';
import { Grid } from '../../../../common/Grid';
import { Text } from '../../../../common/Text';
import { SendMessageHook } from '../../../../hooks/messages/message-event';
import { RoomPreviewerView } from '../../../../views/shared/room-previewer/RoomPreviewerView'; import { RoomPreviewerView } from '../../../../views/shared/room-previewer/RoomPreviewerView';
import { attemptBotPlacement } from '../../common/BotUtilities'; import { attemptBotPlacement } from '../../common/BotUtilities';
import { useInventoryContext } from '../../InventoryContext'; import { useInventoryContext } from '../../InventoryContext';
@ -37,7 +32,7 @@ export const InventoryBotView: FC<InventoryBotViewProps> = props =>
} }
}); });
SendMessageHook(new GetBotInventoryComposer()); SendMessageComposer(new GetBotInventoryComposer());
} }
else else
{ {

View File

@ -1,12 +1,7 @@
import { FurnitureListComposer, IRoomSession, RoomObjectVariable, RoomPreviewer, Vector3d } from '@nitrots/nitro-renderer'; import { FurnitureListComposer, IRoomSession, RoomObjectVariable, RoomPreviewer, Vector3d } from '@nitrots/nitro-renderer';
import { FC, useEffect, useState } from 'react'; import { FC, useEffect, useState } from 'react';
import { GetRoomEngine, GetSessionDataManager, LocalizeText } from '../../../../api'; import { GetRoomEngine, GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../../api';
import { AutoGrid } from '../../../../common/AutoGrid'; import { AutoGrid, Button, Column, Grid, Text } from '../../../../common';
import { Button } from '../../../../common/Button';
import { Column } from '../../../../common/Column';
import { Grid } from '../../../../common/Grid';
import { Text } from '../../../../common/Text';
import { SendMessageHook } from '../../../../hooks/messages';
import { LimitedEditionCompactPlateView } from '../../../../views/shared/limited-edition/LimitedEditionCompactPlateView'; import { LimitedEditionCompactPlateView } from '../../../../views/shared/limited-edition/LimitedEditionCompactPlateView';
import { RarityLevelView } from '../../../../views/shared/rarity-level/RarityLevelView'; import { RarityLevelView } from '../../../../views/shared/rarity-level/RarityLevelView';
import { RoomPreviewerView } from '../../../../views/shared/room-previewer/RoomPreviewerView'; import { RoomPreviewerView } from '../../../../views/shared/room-previewer/RoomPreviewerView';
@ -43,7 +38,7 @@ export const InventoryFurnitureView: FC<InventoryFurnitureViewProps> = props =>
} }
}); });
SendMessageHook(new FurnitureListComposer()); SendMessageComposer(new FurnitureListComposer());
} }
else else
{ {

View File

@ -1,6 +1,6 @@
import { MouseEventType } from '@nitrots/nitro-renderer'; import { MouseEventType } from '@nitrots/nitro-renderer';
import { FC, MouseEvent, useEffect, useState } from 'react'; import { FC, MouseEvent, useEffect, useState } from 'react';
import { LayoutGridItem } from '../../../../common/layout/LayoutGridItem'; import { LayoutGridItem } from '../../../../common';
import { PetImageView } from '../../../../views/shared/pet-image/PetImageView'; import { PetImageView } from '../../../../views/shared/pet-image/PetImageView';
import { PetItem } from '../../common/PetItem'; import { PetItem } from '../../common/PetItem';
import { attemptPetPlacement } from '../../common/PetUtilities'; import { attemptPetPlacement } from '../../common/PetUtilities';

View File

@ -1,12 +1,7 @@
import { IRoomSession, RequestPetsComposer, RoomObjectVariable, RoomPreviewer } from '@nitrots/nitro-renderer'; import { IRoomSession, RequestPetsComposer, RoomObjectVariable, RoomPreviewer } from '@nitrots/nitro-renderer';
import { FC, useEffect } from 'react'; import { FC, useEffect } from 'react';
import { GetRoomEngine, LocalizeText } from '../../../../api'; import { GetRoomEngine, LocalizeText, SendMessageComposer } from '../../../../api';
import { AutoGrid } from '../../../../common/AutoGrid'; import { AutoGrid, Button, Column, Grid, Text } from '../../../../common';
import { Button } from '../../../../common/Button';
import { Column } from '../../../../common/Column';
import { Grid } from '../../../../common/Grid';
import { Text } from '../../../../common/Text';
import { SendMessageHook } from '../../../../hooks/messages/message-event';
import { RoomPreviewerView } from '../../../../views/shared/room-previewer/RoomPreviewerView'; import { RoomPreviewerView } from '../../../../views/shared/room-previewer/RoomPreviewerView';
import { attemptPetPlacement } from '../../common/PetUtilities'; import { attemptPetPlacement } from '../../common/PetUtilities';
import { useInventoryContext } from '../../InventoryContext'; import { useInventoryContext } from '../../InventoryContext';
@ -37,7 +32,7 @@ export const InventoryPetView: FC<InventoryPetViewProps> = props =>
} }
}); });
SendMessageHook(new RequestPetsComposer()); SendMessageComposer(new RequestPetsComposer());
} }
else else
{ {

View File

@ -1,16 +1,8 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { FurnitureListComposer, IObjectData, TradingAcceptComposer, TradingConfirmationComposer, TradingListAddItemComposer, TradingListAddItemsComposer, TradingListItemRemoveComposer, TradingUnacceptComposer } from '@nitrots/nitro-renderer'; import { FurnitureListComposer, IObjectData, TradingAcceptComposer, TradingConfirmationComposer, TradingListAddItemComposer, TradingListAddItemsComposer, TradingListItemRemoveComposer, TradingUnacceptComposer } from '@nitrots/nitro-renderer';
import { FC, useEffect, useState } from 'react'; import { FC, useEffect, useState } from 'react';
import { LocalizeText } from '../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../api';
import { AutoGrid } from '../../../../common/AutoGrid'; import { AutoGrid, Base, Button, Column, Flex, Grid, LayoutGridItem, Text } from '../../../../common';
import { Base } from '../../../../common/Base';
import { Button } from '../../../../common/Button';
import { Column } from '../../../../common/Column';
import { Flex } from '../../../../common/Flex';
import { Grid } from '../../../../common/Grid';
import { LayoutGridItem } from '../../../../common/layout/LayoutGridItem';
import { Text } from '../../../../common/Text';
import { SendMessageHook } from '../../../../hooks/messages';
import { NotificationAlertType } from '../../../../views/notification-center/common/NotificationAlertType'; import { NotificationAlertType } from '../../../../views/notification-center/common/NotificationAlertType';
import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities';
import { FurniCategory } from '../../common/FurniCategory'; import { FurniCategory } from '../../common/FurniCategory';
@ -93,7 +85,7 @@ export const InventoryTradeView: FC<InventoryTradeViewProps> = props =>
{ {
if(!coreItem.isGroupable && (itemIds.length)) if(!coreItem.isGroupable && (itemIds.length))
{ {
SendMessageHook(new TradingListAddItemComposer(itemIds.pop())); SendMessageComposer(new TradingListAddItemComposer(itemIds.pop()));
} }
else else
{ {
@ -111,11 +103,11 @@ export const InventoryTradeView: FC<InventoryTradeViewProps> = props =>
{ {
if(tradeIds.length === 1) if(tradeIds.length === 1)
{ {
SendMessageHook(new TradingListAddItemComposer(tradeIds.pop())); SendMessageComposer(new TradingListAddItemComposer(tradeIds.pop()));
} }
else else
{ {
SendMessageHook(new TradingListAddItemsComposer(...tradeIds)); SendMessageComposer(new TradingListAddItemsComposer(...tradeIds));
} }
} }
} }
@ -132,7 +124,7 @@ export const InventoryTradeView: FC<InventoryTradeViewProps> = props =>
if(!item) return; if(!item) return;
SendMessageHook(new TradingListItemRemoveComposer(item.id)); SendMessageComposer(new TradingListItemRemoveComposer(item.id));
} }
const progressTrade = () => const progressTrade = () =>
@ -147,15 +139,15 @@ export const InventoryTradeView: FC<InventoryTradeViewProps> = props =>
if(tradeData.ownUser.accepts) if(tradeData.ownUser.accepts)
{ {
SendMessageHook(new TradingUnacceptComposer()); SendMessageComposer(new TradingUnacceptComposer());
} }
else else
{ {
SendMessageHook(new TradingAcceptComposer()); SendMessageComposer(new TradingAcceptComposer());
} }
return; return;
case TradeState.TRADING_STATE_CONFIRMING: case TradeState.TRADING_STATE_CONFIRMING:
SendMessageHook(new TradingConfirmationComposer()); SendMessageComposer(new TradingConfirmationComposer());
dispatchFurnitureState({ dispatchFurnitureState({
type: InventoryFurnitureActions.SET_TRADE_STATE, type: InventoryFurnitureActions.SET_TRADE_STATE,
@ -186,7 +178,7 @@ export const InventoryTradeView: FC<InventoryTradeViewProps> = props =>
} }
}); });
SendMessageHook(new FurnitureListComposer()); SendMessageComposer(new FurnitureListComposer());
} }
}, [ needsFurniUpdate, groupItems, dispatchFurnitureState ]); }, [ needsFurniUpdate, groupItems, dispatchFurnitureState ]);

View File

@ -2,7 +2,7 @@ import { HabboWebTools, RoomSessionEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { AddEventLinkTracker, GetCommunication, RemoveLinkEventTracker } from '../../api'; import { AddEventLinkTracker, GetCommunication, RemoveLinkEventTracker } from '../../api';
import { Base, TransitionAnimation, TransitionAnimationTypes } from '../../common'; import { Base, TransitionAnimation, TransitionAnimationTypes } from '../../common';
import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event'; import { UseRoomSessionManagerEvent } from '../../hooks';
import { CampaignView } from '../../views/campaign/CampaignView'; import { CampaignView } from '../../views/campaign/CampaignView';
import { FloorplanEditorView } from '../../views/floorplan-editor/FloorplanEditorView'; import { FloorplanEditorView } from '../../views/floorplan-editor/FloorplanEditorView';
import { FriendsView } from '../../views/friends/FriendsView'; import { FriendsView } from '../../views/friends/FriendsView';
@ -45,8 +45,8 @@ export const MainView: FC<{}> = props =>
} }
}, []); }, []);
useRoomSessionManagerEvent(RoomSessionEvent.CREATED, onRoomSessionEvent); UseRoomSessionManagerEvent(RoomSessionEvent.CREATED, onRoomSessionEvent);
useRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent); UseRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent);
const onLinkReceived = useCallback((link: string) => const onLinkReceived = useCallback((link: string) =>
{ {

View File

@ -1,12 +1,8 @@
import { CfhSanctionMessageEvent, CfhTopicsInitEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ModeratorActionResultMessageEvent, ModeratorInitMessageEvent, ModeratorToolPreferencesEvent, RoomEngineEvent } from '@nitrots/nitro-renderer'; import { CfhSanctionMessageEvent, CfhTopicsInitEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ModeratorActionResultMessageEvent, ModeratorInitMessageEvent, ModeratorToolPreferencesEvent, RoomEngineEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback } from 'react'; import { FC, useCallback } from 'react';
import { MODTOOLS_NEW_TICKET, PlaySound } from '../../api/utils/PlaySound'; import { MODTOOLS_NEW_TICKET, PlaySound } from '../../api';
import { ModToolsEvent } from '../../events/mod-tools/ModToolsEvent'; import { ModToolsEvent, ModToolsOpenRoomChatlogEvent, ModToolsOpenRoomInfoEvent, ModToolsOpenUserChatlogEvent, ModToolsOpenUserInfoEvent } from '../../events';
import { ModToolsOpenRoomChatlogEvent } from '../../events/mod-tools/ModToolsOpenRoomChatlogEvent'; import { UseMessageEventHook, UseRoomEngineEvent, UseUiEvent } from '../../hooks';
import { ModToolsOpenRoomInfoEvent } from '../../events/mod-tools/ModToolsOpenRoomInfoEvent';
import { ModToolsOpenUserChatlogEvent } from '../../events/mod-tools/ModToolsOpenUserChatlogEvent';
import { ModToolsOpenUserInfoEvent } from '../../events/mod-tools/ModToolsOpenUserInfoEvent';
import { CreateMessageHook, useRoomEngineEvent, useUiEvent } from '../../hooks';
import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType'; import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType';
import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities';
import { SetCfhCategories } from './common/GetCFHCategories'; import { SetCfhCategories } from './common/GetCFHCategories';
@ -152,14 +148,14 @@ export const ModToolsMessageHandler: FC<{}> = props =>
// todo: update sanction data // todo: update sanction data
}, []); }, []);
CreateMessageHook(ModeratorInitMessageEvent, onModeratorInitMessageEvent); UseMessageEventHook(ModeratorInitMessageEvent, onModeratorInitMessageEvent);
CreateMessageHook(IssueInfoMessageEvent, onIssueInfoMessageEvent); UseMessageEventHook(IssueInfoMessageEvent, onIssueInfoMessageEvent);
CreateMessageHook(ModeratorToolPreferencesEvent, onModeratorToolPreferencesEvent); UseMessageEventHook(ModeratorToolPreferencesEvent, onModeratorToolPreferencesEvent);
CreateMessageHook(IssuePickFailedMessageEvent, onIssuePickFailedMessageEvent); UseMessageEventHook(IssuePickFailedMessageEvent, onIssuePickFailedMessageEvent);
CreateMessageHook(IssueDeletedMessageEvent, onIssueDeletedMessageEvent); UseMessageEventHook(IssueDeletedMessageEvent, onIssueDeletedMessageEvent);
CreateMessageHook(ModeratorActionResultMessageEvent, onModeratorActionResultMessageEvent); UseMessageEventHook(ModeratorActionResultMessageEvent, onModeratorActionResultMessageEvent);
CreateMessageHook(CfhTopicsInitEvent, onCfhTopicsInitEvent); UseMessageEventHook(CfhTopicsInitEvent, onCfhTopicsInitEvent);
CreateMessageHook(CfhSanctionMessageEvent, onCfhSanctionMessageEvent); UseMessageEventHook(CfhSanctionMessageEvent, onCfhSanctionMessageEvent);
const onRoomEngineEvent = useCallback((event: RoomEngineEvent) => const onRoomEngineEvent = useCallback((event: RoomEngineEvent) =>
{ {
@ -184,8 +180,8 @@ export const ModToolsMessageHandler: FC<{}> = props =>
} }
}, [ dispatchModToolsState ]); }, [ dispatchModToolsState ]);
useRoomEngineEvent(RoomEngineEvent.INITIALIZED, onRoomEngineEvent); UseRoomEngineEvent(RoomEngineEvent.INITIALIZED, onRoomEngineEvent);
useRoomEngineEvent(RoomEngineEvent.DISPOSED, onRoomEngineEvent); UseRoomEngineEvent(RoomEngineEvent.DISPOSED, onRoomEngineEvent);
const onModToolsEvent = useCallback((event: ModToolsEvent) => const onModToolsEvent = useCallback((event: ModToolsEvent) =>
{ {
@ -254,10 +250,10 @@ export const ModToolsMessageHandler: FC<{}> = props =>
} }
}, [openRooms, dispatchModToolsState, openRoomChatlogs, openUserInfo, openUserChatlogs]); }, [openRooms, dispatchModToolsState, openRoomChatlogs, openUserInfo, openUserChatlogs]);
useUiEvent(ModToolsEvent.OPEN_ROOM_INFO, onModToolsEvent); UseUiEvent(ModToolsEvent.OPEN_ROOM_INFO, onModToolsEvent);
useUiEvent(ModToolsEvent.OPEN_ROOM_CHATLOG, onModToolsEvent); UseUiEvent(ModToolsEvent.OPEN_ROOM_CHATLOG, onModToolsEvent);
useUiEvent(ModToolsEvent.OPEN_USER_INFO, onModToolsEvent); UseUiEvent(ModToolsEvent.OPEN_USER_INFO, onModToolsEvent);
useUiEvent(ModToolsEvent.OPEN_USER_CHATLOG, onModToolsEvent); UseUiEvent(ModToolsEvent.OPEN_USER_CHATLOG, onModToolsEvent);
return null; return null;
} }

View File

@ -3,12 +3,8 @@ import { RoomEngineObjectEvent, RoomObjectCategory } from '@nitrots/nitro-render
import { FC, useCallback, useReducer, useState } from 'react'; import { FC, useCallback, useReducer, useState } from 'react';
import { GetRoomSession } from '../../api'; import { GetRoomSession } from '../../api';
import { Button, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common'; import { Button, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common';
import { ModToolsEvent } from '../../events/mod-tools/ModToolsEvent'; import { ModToolsEvent, ModToolsOpenRoomChatlogEvent, ModToolsOpenRoomInfoEvent, ModToolsOpenUserInfoEvent } from '../../events';
import { ModToolsOpenRoomChatlogEvent } from '../../events/mod-tools/ModToolsOpenRoomChatlogEvent'; import { DispatchUiEvent, UseRoomEngineEvent, UseUiEvent } from '../../hooks';
import { ModToolsOpenRoomInfoEvent } from '../../events/mod-tools/ModToolsOpenRoomInfoEvent';
import { ModToolsOpenUserInfoEvent } from '../../events/mod-tools/ModToolsOpenUserInfoEvent';
import { useRoomEngineEvent } from '../../hooks/events';
import { dispatchUiEvent, useUiEvent } from '../../hooks/events/ui/ui-event';
import { ModToolsContextProvider } from './ModToolsContext'; import { ModToolsContextProvider } from './ModToolsContext';
import { ModToolsMessageHandler } from './ModToolsMessageHandler'; import { ModToolsMessageHandler } from './ModToolsMessageHandler';
import { initialModTools, ModToolsActions, ModToolsReducer } from './reducers/ModToolsReducer'; import { initialModTools, ModToolsActions, ModToolsReducer } from './reducers/ModToolsReducer';
@ -43,9 +39,9 @@ export const ModToolsView: FC<{}> = props =>
} }
}, []); }, []);
useUiEvent(ModToolsEvent.SHOW_MOD_TOOLS, onModToolsEvent); UseUiEvent(ModToolsEvent.SHOW_MOD_TOOLS, onModToolsEvent);
useUiEvent(ModToolsEvent.HIDE_MOD_TOOLS, onModToolsEvent); UseUiEvent(ModToolsEvent.HIDE_MOD_TOOLS, onModToolsEvent);
useUiEvent(ModToolsEvent.TOGGLE_MOD_TOOLS, onModToolsEvent); UseUiEvent(ModToolsEvent.TOGGLE_MOD_TOOLS, onModToolsEvent);
const onRoomEngineObjectEvent = useCallback((event: RoomEngineObjectEvent) => const onRoomEngineObjectEvent = useCallback((event: RoomEngineObjectEvent) =>
{ {
@ -62,7 +58,7 @@ export const ModToolsView: FC<{}> = props =>
setSelectedUser({ userId: userData.webID, username: userData.name }); setSelectedUser({ userId: userData.webID, username: userData.name });
}, []); }, []);
useRoomEngineEvent(RoomEngineObjectEvent.SELECTED, onRoomEngineObjectEvent); UseRoomEngineEvent(RoomEngineObjectEvent.SELECTED, onRoomEngineObjectEvent);
const handleClick = useCallback((action: string, value?: string) => const handleClick = useCallback((action: string, value?: string) =>
{ {
@ -73,7 +69,7 @@ export const ModToolsView: FC<{}> = props =>
case 'toggle_room': { case 'toggle_room': {
if(!openRooms) if(!openRooms)
{ {
dispatchUiEvent(new ModToolsOpenRoomInfoEvent(currentRoomId)); DispatchUiEvent(new ModToolsOpenRoomInfoEvent(currentRoomId));
return; return;
} }
@ -83,7 +79,7 @@ export const ModToolsView: FC<{}> = props =>
} }
else else
{ {
dispatchUiEvent(new ModToolsOpenRoomInfoEvent(currentRoomId)); DispatchUiEvent(new ModToolsOpenRoomInfoEvent(currentRoomId));
} }
return; return;
} }
@ -104,7 +100,7 @@ export const ModToolsView: FC<{}> = props =>
case 'toggle_room_chatlog': { case 'toggle_room_chatlog': {
if(!openRoomChatlogs) if(!openRoomChatlogs)
{ {
dispatchUiEvent(new ModToolsOpenRoomChatlogEvent(currentRoomId)); DispatchUiEvent(new ModToolsOpenRoomChatlogEvent(currentRoomId));
return; return;
} }
@ -114,7 +110,7 @@ export const ModToolsView: FC<{}> = props =>
} }
else else
{ {
dispatchUiEvent(new ModToolsOpenRoomChatlogEvent(currentRoomId)); DispatchUiEvent(new ModToolsOpenRoomChatlogEvent(currentRoomId));
} }
return; return;
} }
@ -140,7 +136,7 @@ export const ModToolsView: FC<{}> = props =>
if(!openUserInfo) if(!openUserInfo)
{ {
dispatchUiEvent(new ModToolsOpenUserInfoEvent(userId)); DispatchUiEvent(new ModToolsOpenUserInfoEvent(userId));
return; return;
} }
@ -150,7 +146,7 @@ export const ModToolsView: FC<{}> = props =>
} }
else else
{ {
dispatchUiEvent(new ModToolsOpenUserInfoEvent(userId)); DispatchUiEvent(new ModToolsOpenUserInfoEvent(userId));
} }
return; return;
} }

View File

@ -1,10 +1,10 @@
import { ChatRecordData, UserProfileComposer } from '@nitrots/nitro-renderer'; import { ChatRecordData, UserProfileComposer } from '@nitrots/nitro-renderer';
import { CSSProperties, FC, Key, useCallback } from 'react'; import { CSSProperties, FC, Key, useCallback } from 'react';
import { AutoSizer, CellMeasurer, CellMeasurerCache, List, ListRowProps } from 'react-virtualized'; import { AutoSizer, CellMeasurer, CellMeasurerCache, List, ListRowProps } from 'react-virtualized';
import { TryVisitRoom } from '../../../../api'; import { SendMessageComposer, TryVisitRoom } from '../../../../api';
import { Base, Button, Column, Flex, Grid, Text } from '../../../../common'; import { Base, Button, Column, Flex, Grid, Text } from '../../../../common';
import { ModToolsOpenRoomInfoEvent } from '../../../../events/mod-tools/ModToolsOpenRoomInfoEvent'; import { ModToolsOpenRoomInfoEvent } from '../../../../events/mod-tools/ModToolsOpenRoomInfoEvent';
import { dispatchUiEvent, SendMessageHook } from '../../../../hooks'; import { DispatchUiEvent } from '../../../../hooks';
interface ChatlogViewProps interface ChatlogViewProps
{ {
@ -29,7 +29,7 @@ export const ChatlogView: FC<ChatlogViewProps> = props =>
> >
<Grid key={ props.key } fullHeight={ false } style={ props.style } gap={ 1 } alignItems="center" className="log-entry py-1 border-bottom"> <Grid key={ props.key } fullHeight={ false } style={ props.style } gap={ 1 } alignItems="center" className="log-entry py-1 border-bottom">
<Text className="g-col-2">{ chatlogEntry.timestamp }</Text> <Text className="g-col-2">{ chatlogEntry.timestamp }</Text>
<Text className="g-col-3" bold underline pointer onClick={ event => SendMessageHook(new UserProfileComposer(chatlogEntry.userId)) }>{ chatlogEntry.userName }</Text> <Text className="g-col-3" bold underline pointer onClick={ event => SendMessageComposer(new UserProfileComposer(chatlogEntry.userId)) }>{ chatlogEntry.userName }</Text>
<Text textBreak wrap className="g-col-7">{ chatlogEntry.message }</Text> <Text textBreak wrap className="g-col-7">{ chatlogEntry.message }</Text>
</Grid> </Grid>
</CellMeasurer> </CellMeasurer>
@ -79,7 +79,7 @@ export const ChatlogView: FC<ChatlogViewProps> = props =>
{ !isRoomInfo && { !isRoomInfo &&
<Grid key={ props.key } style={ props.style } gap={ 1 } alignItems="center" className="log-entry py-1 border-bottom"> <Grid key={ props.key } style={ props.style } gap={ 1 } alignItems="center" className="log-entry py-1 border-bottom">
<Text className="g-col-2">{ chatlogEntry.timestamp }</Text> <Text className="g-col-2">{ chatlogEntry.timestamp }</Text>
<Text className="g-col-3" bold underline pointer onClick={ event => SendMessageHook(new UserProfileComposer(chatlogEntry.userId)) }>{ chatlogEntry.userName }</Text> <Text className="g-col-3" bold underline pointer onClick={ event => SendMessageComposer(new UserProfileComposer(chatlogEntry.userId)) }>{ chatlogEntry.userName }</Text>
<Text textBreak wrap className="g-col-7">{ chatlogEntry.message }</Text> <Text textBreak wrap className="g-col-7">{ chatlogEntry.message }</Text>
</Grid> } </Grid> }
</CellMeasurer> </CellMeasurer>
@ -109,7 +109,7 @@ export const ChatlogView: FC<ChatlogViewProps> = props =>
</Flex> </Flex>
<Flex gap={ 1 }> <Flex gap={ 1 }>
<Button onClick={ event => TryVisitRoom(props.roomId) }>Visit Room</Button> <Button onClick={ event => TryVisitRoom(props.roomId) }>Visit Room</Button>
<Button onClick={ event => dispatchUiEvent(new ModToolsOpenRoomInfoEvent(props.roomId)) }>Room Tools</Button> <Button onClick={ event => DispatchUiEvent(new ModToolsOpenRoomInfoEvent(props.roomId)) }>Room Tools</Button>
</Flex> </Flex>
</Flex> </Flex>
); );

View File

@ -1,7 +1,8 @@
import { ChatRecordData, GetRoomChatlogMessageComposer, RoomChatlogEvent } from '@nitrots/nitro-renderer'; import { ChatRecordData, GetRoomChatlogMessageComposer, RoomChatlogEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { SendMessageComposer } from '../../../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
import { CreateMessageHook, SendMessageHook } from '../../../../hooks/messages'; import { UseMessageEventHook } from '../../../../hooks';
import { ChatlogView } from '../chatlog/ChatlogView'; import { ChatlogView } from '../chatlog/ChatlogView';
interface ModToolsChatlogViewProps interface ModToolsChatlogViewProps
@ -24,11 +25,11 @@ export const ModToolsChatlogView: FC<ModToolsChatlogViewProps> = props =>
setRoomChatlog(parser.data); setRoomChatlog(parser.data);
}, [ roomId ]); }, [ roomId ]);
CreateMessageHook(RoomChatlogEvent, onModtoolRoomChatlogEvent); UseMessageEventHook(RoomChatlogEvent, onModtoolRoomChatlogEvent);
useEffect(() => useEffect(() =>
{ {
SendMessageHook(new GetRoomChatlogMessageComposer(roomId)); SendMessageComposer(new GetRoomChatlogMessageComposer(roomId));
}, [ roomId ]); }, [ roomId ]);
if(!roomChatlog) return null; if(!roomChatlog) return null;

View File

@ -1,10 +1,9 @@
import { GetModeratorRoomInfoMessageComposer, ModerateRoomMessageComposer, ModeratorActionMessageComposer, ModeratorRoomInfoEvent } from '@nitrots/nitro-renderer'; import { GetModeratorRoomInfoMessageComposer, ModerateRoomMessageComposer, ModeratorActionMessageComposer, ModeratorRoomInfoEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { TryVisitRoom } from '../../../../api'; import { SendMessageComposer, TryVisitRoom } from '../../../../api';
import { Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { ModToolsOpenRoomChatlogEvent } from '../../../../events/mod-tools/ModToolsOpenRoomChatlogEvent'; import { ModToolsOpenRoomChatlogEvent } from '../../../../events/mod-tools/ModToolsOpenRoomChatlogEvent';
import { BatchUpdates, dispatchUiEvent } from '../../../../hooks'; import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
import { CreateMessageHook, SendMessageHook } from '../../../../hooks/messages';
interface ModToolsRoomViewProps interface ModToolsRoomViewProps
{ {
@ -48,7 +47,7 @@ export const ModToolsRoomView: FC<ModToolsRoomViewProps> = props =>
}); });
}, [ roomId ]); }, [ roomId ]);
CreateMessageHook(ModeratorRoomInfoEvent, onModtoolRoomInfoEvent); UseMessageEventHook(ModeratorRoomInfoEvent, onModtoolRoomInfoEvent);
const handleClick = useCallback((action: string, value?: string) => const handleClick = useCallback((action: string, value?: string) =>
{ {
@ -59,13 +58,13 @@ export const ModToolsRoomView: FC<ModToolsRoomViewProps> = props =>
case 'alert_only': case 'alert_only':
if(message.trim().length === 0) return; if(message.trim().length === 0) return;
SendMessageHook(new ModeratorActionMessageComposer(ModeratorActionMessageComposer.ACTION_ALERT, message, '')); SendMessageComposer(new ModeratorActionMessageComposer(ModeratorActionMessageComposer.ACTION_ALERT, message, ''));
return; return;
case 'send_message': case 'send_message':
if(message.trim().length === 0) return; if(message.trim().length === 0) return;
SendMessageHook(new ModeratorActionMessageComposer(ModeratorActionMessageComposer.ACTION_MESSAGE, message, '')); SendMessageComposer(new ModeratorActionMessageComposer(ModeratorActionMessageComposer.ACTION_MESSAGE, message, ''));
SendMessageHook(new ModerateRoomMessageComposer(roomId, lockRoom ? 1 : 0, changeRoomName ? 1 : 0, kickUsers ? 1 : 0)) SendMessageComposer(new ModerateRoomMessageComposer(roomId, lockRoom ? 1 : 0, changeRoomName ? 1 : 0, kickUsers ? 1 : 0))
return; return;
} }
}, [ changeRoomName, kickUsers, lockRoom, message, roomId ]); }, [ changeRoomName, kickUsers, lockRoom, message, roomId ]);
@ -74,7 +73,7 @@ export const ModToolsRoomView: FC<ModToolsRoomViewProps> = props =>
{ {
if(infoRequested) return; if(infoRequested) return;
SendMessageHook(new GetModeratorRoomInfoMessageComposer(roomId)); SendMessageComposer(new GetModeratorRoomInfoMessageComposer(roomId));
setInfoRequested(true); setInfoRequested(true);
}, [ roomId, infoRequested, setInfoRequested ]); }, [ roomId, infoRequested, setInfoRequested ]);
@ -99,7 +98,7 @@ export const ModToolsRoomView: FC<ModToolsRoomViewProps> = props =>
</Column> </Column>
<Column gap={ 1 }> <Column gap={ 1 }>
<Button onClick={ event => TryVisitRoom(roomId) }>Visit Room</Button> <Button onClick={ event => TryVisitRoom(roomId) }>Visit Room</Button>
<Button onClick={ event => dispatchUiEvent(new ModToolsOpenRoomChatlogEvent(roomId)) }>Chatlog</Button> <Button onClick={ event => DispatchUiEvent(new ModToolsOpenRoomChatlogEvent(roomId)) }>Chatlog</Button>
</Column> </Column>
</Flex> </Flex>
<Column className="bg-muted rounded p-2" gap={ 1 }> <Column className="bg-muted rounded p-2" gap={ 1 }>

View File

@ -1,7 +1,8 @@
import { CfhChatlogData, CfhChatlogEvent, GetCfhChatlogMessageComposer } from '@nitrots/nitro-renderer'; import { CfhChatlogData, CfhChatlogEvent, GetCfhChatlogMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { SendMessageComposer } from '../../../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
import { CreateMessageHook, SendMessageHook } from '../../../../hooks'; import { UseMessageEventHook } from '../../../../hooks';
import { ChatlogView } from '../chatlog/ChatlogView'; import { ChatlogView } from '../chatlog/ChatlogView';
interface CfhChatlogViewProps interface CfhChatlogViewProps
@ -17,7 +18,7 @@ export const CfhChatlogView: FC<CfhChatlogViewProps> = props =>
useEffect(() => useEffect(() =>
{ {
SendMessageHook(new GetCfhChatlogMessageComposer(issueId)); SendMessageComposer(new GetCfhChatlogMessageComposer(issueId));
}, [issueId]); }, [issueId]);
const onCfhChatlogEvent = useCallback((event: CfhChatlogEvent) => const onCfhChatlogEvent = useCallback((event: CfhChatlogEvent) =>
@ -29,7 +30,7 @@ export const CfhChatlogView: FC<CfhChatlogViewProps> = props =>
setChatlogData(parser.data); setChatlogData(parser.data);
}, [issueId]); }, [issueId]);
CreateMessageHook(CfhChatlogEvent, onCfhChatlogEvent); UseMessageEventHook(CfhChatlogEvent, onCfhChatlogEvent);
return ( return (
<NitroCardView className="nitro-mod-tools-cfh-chatlog" simple={true}> <NitroCardView className="nitro-mod-tools-cfh-chatlog" simple={true}>

View File

@ -1,9 +1,9 @@
import { CloseIssuesMessageComposer, ReleaseIssuesMessageComposer } from '@nitrots/nitro-renderer'; import { CloseIssuesMessageComposer, ReleaseIssuesMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useMemo, useState } from 'react'; import { FC, useMemo, useState } from 'react';
import { LocalizeText } from '../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../api';
import { Button, Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { Button, Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { ModToolsOpenUserInfoEvent } from '../../../../events/mod-tools/ModToolsOpenUserInfoEvent'; import { ModToolsOpenUserInfoEvent } from '../../../../events';
import { dispatchUiEvent, SendMessageHook } from '../../../../hooks'; import { DispatchUiEvent } from '../../../../hooks';
import { getSourceName } from '../../common/IssueCategoryNames'; import { getSourceName } from '../../common/IssueCategoryNames';
import { useModToolsContext } from '../../ModToolsContext'; import { useModToolsContext } from '../../ModToolsContext';
import { CfhChatlogView } from './CfhChatlogView'; import { CfhChatlogView } from './CfhChatlogView';
@ -30,19 +30,19 @@ export const ModToolsIssueInfoView: FC<IssueInfoViewProps> = props =>
const releaseIssue = (issueId: number) => const releaseIssue = (issueId: number) =>
{ {
SendMessageHook(new ReleaseIssuesMessageComposer([ issueId ])); SendMessageComposer(new ReleaseIssuesMessageComposer([ issueId ]));
onIssueInfoClosed(issueId); onIssueInfoClosed(issueId);
} }
const closeIssue = (resolutionType: number) => const closeIssue = (resolutionType: number) =>
{ {
SendMessageHook(new CloseIssuesMessageComposer([ issueId ], resolutionType)); SendMessageComposer(new CloseIssuesMessageComposer([ issueId ], resolutionType));
onIssueInfoClosed(issueId) onIssueInfoClosed(issueId)
} }
const openUserInfo = (userId: number) => dispatchUiEvent(new ModToolsOpenUserInfoEvent(userId)); const openUserInfo = (userId: number) => DispatchUiEvent(new ModToolsOpenUserInfoEvent(userId));
return ( return (
<> <>

View File

@ -1,7 +1,7 @@
import { IssueMessageData, ReleaseIssuesMessageComposer } from '@nitrots/nitro-renderer'; import { IssueMessageData, ReleaseIssuesMessageComposer } from '@nitrots/nitro-renderer';
import { FC } from 'react'; import { FC } from 'react';
import { SendMessageComposer } from '../../../../api';
import { Base, Button, Column, Grid } from '../../../../common'; import { Base, Button, Column, Grid } from '../../../../common';
import { SendMessageHook } from '../../../../hooks';
interface ModToolsMyIssuesTabViewProps interface ModToolsMyIssuesTabViewProps
{ {
@ -13,7 +13,7 @@ export const ModToolsMyIssuesTabView: FC<ModToolsMyIssuesTabViewProps> = props =
{ {
const { myIssues = null, onIssueHandleClick = null } = props; const { myIssues = null, onIssueHandleClick = null } = props;
const onReleaseIssue = (issueId: number) => SendMessageHook(new ReleaseIssuesMessageComposer([issueId])); const onReleaseIssue = (issueId: number) => SendMessageComposer(new ReleaseIssuesMessageComposer([issueId]));
return ( return (
<Column gap={ 0 } overflow="hidden"> <Column gap={ 0 } overflow="hidden">

View File

@ -1,7 +1,7 @@
import { IssueMessageData, PickIssuesMessageComposer } from '@nitrots/nitro-renderer'; import { IssueMessageData, PickIssuesMessageComposer } from '@nitrots/nitro-renderer';
import { FC } from 'react'; import { FC } from 'react';
import { SendMessageComposer } from '../../../../api';
import { Base, Button, Column, Grid } from '../../../../common'; import { Base, Button, Column, Grid } from '../../../../common';
import { SendMessageHook } from '../../../../hooks';
interface ModToolsOpenIssuesTabViewProps interface ModToolsOpenIssuesTabViewProps
{ {
@ -12,7 +12,7 @@ export const ModToolsOpenIssuesTabView: FC<ModToolsOpenIssuesTabViewProps> = pro
{ {
const { openIssues = null } = props; const { openIssues = null } = props;
const onPickIssue = (issueId: number) => SendMessageHook(new PickIssuesMessageComposer([issueId], false, 0, 'pick issue button')); const onPickIssue = (issueId: number) => SendMessageComposer(new PickIssuesMessageComposer([issueId], false, 0, 'pick issue button'));
return ( return (
<Column gap={ 0 } overflow="hidden"> <Column gap={ 0 } overflow="hidden">

View File

@ -1,7 +1,8 @@
import { ChatRecordData, GetUserChatlogMessageComposer, UserChatlogEvent } from '@nitrots/nitro-renderer'; import { ChatRecordData, GetUserChatlogMessageComposer, UserChatlogEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { SendMessageComposer } from '../../../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
import { BatchUpdates, CreateMessageHook, SendMessageHook } from '../../../../hooks'; import { BatchUpdates, UseMessageEventHook } from '../../../../hooks';
import { ChatlogView } from '../chatlog/ChatlogView'; import { ChatlogView } from '../chatlog/ChatlogView';
interface ModToolsUserChatlogViewProps interface ModToolsUserChatlogViewProps
@ -29,11 +30,11 @@ export const ModToolsUserChatlogView: FC<ModToolsUserChatlogViewProps> = props =
}); });
}, [ userId ]); }, [ userId ]);
CreateMessageHook(UserChatlogEvent, onModtoolUserChatlogEvent); UseMessageEventHook(UserChatlogEvent, onModtoolUserChatlogEvent);
useEffect(() => useEffect(() =>
{ {
SendMessageHook(new GetUserChatlogMessageComposer(userId)); SendMessageComposer(new GetUserChatlogMessageComposer(userId));
}, [ userId ]); }, [ userId ]);
return ( return (

View File

@ -1,8 +1,7 @@
import { CallForHelpTopicData, DefaultSanctionMessageComposer, ModAlertMessageComposer, ModBanMessageComposer, ModKickMessageComposer, ModMessageMessageComposer, ModMuteMessageComposer, ModTradingLockMessageComposer } from '@nitrots/nitro-renderer'; import { CallForHelpTopicData, DefaultSanctionMessageComposer, ModAlertMessageComposer, ModBanMessageComposer, ModKickMessageComposer, ModMessageMessageComposer, ModMuteMessageComposer, ModTradingLockMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useMemo, useState } from 'react'; import { FC, useMemo, useState } from 'react';
import { LocalizeText } from '../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../api';
import { Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { SendMessageHook } from '../../../../hooks';
import { NotificationAlertType } from '../../../../views/notification-center/common/NotificationAlertType'; import { NotificationAlertType } from '../../../../views/notification-center/common/NotificationAlertType';
import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities'; import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities';
import { useModToolsContext } from '../../ModToolsContext'; import { useModToolsContext } from '../../ModToolsContext';
@ -61,7 +60,7 @@ export const ModToolsUserModActionView: FC<ModToolsUserModActionViewProps> = pro
const sendDefaultSanction = () => const sendDefaultSanction = () =>
{ {
SendMessageHook(new DefaultSanctionMessageComposer(user.userId, selectedTopic, message)); SendMessageComposer(new DefaultSanctionMessageComposer(user.userId, selectedTopic, message));
onCloseClick(); onCloseClick();
} }
@ -104,11 +103,11 @@ export const ModToolsUserModActionView: FC<ModToolsUserModActionViewProps> = pro
return; return;
} }
SendMessageHook(new ModAlertMessageComposer(user.userId, message, category.id)); SendMessageComposer(new ModAlertMessageComposer(user.userId, message, category.id));
break; break;
} }
case ModActionDefinition.MUTE: case ModActionDefinition.MUTE:
SendMessageHook(new ModMuteMessageComposer(user.userId, messageOrDefault, category.id)); SendMessageComposer(new ModMuteMessageComposer(user.userId, messageOrDefault, category.id));
break; break;
case ModActionDefinition.BAN: { case ModActionDefinition.BAN: {
if(!settings.banPermission) if(!settings.banPermission)
@ -118,7 +117,7 @@ export const ModToolsUserModActionView: FC<ModToolsUserModActionViewProps> = pro
return; return;
} }
SendMessageHook(new ModBanMessageComposer(user.userId, messageOrDefault, category.id, selectedAction, (sanction.actionId === 106))); SendMessageComposer(new ModBanMessageComposer(user.userId, messageOrDefault, category.id, selectedAction, (sanction.actionId === 106)));
break; break;
} }
case ModActionDefinition.KICK: { case ModActionDefinition.KICK: {
@ -128,13 +127,13 @@ export const ModToolsUserModActionView: FC<ModToolsUserModActionViewProps> = pro
return; return;
} }
SendMessageHook(new ModKickMessageComposer(user.userId, messageOrDefault, category.id)); SendMessageComposer(new ModKickMessageComposer(user.userId, messageOrDefault, category.id));
break; break;
} }
case ModActionDefinition.TRADE_LOCK: { case ModActionDefinition.TRADE_LOCK: {
const numSeconds = (sanction.actionLengthHours * 60); const numSeconds = (sanction.actionLengthHours * 60);
SendMessageHook(new ModTradingLockMessageComposer(user.userId, messageOrDefault, numSeconds, category.id)); SendMessageComposer(new ModTradingLockMessageComposer(user.userId, messageOrDefault, numSeconds, category.id));
break; break;
} }
case ModActionDefinition.MESSAGE: { case ModActionDefinition.MESSAGE: {
@ -145,7 +144,7 @@ export const ModToolsUserModActionView: FC<ModToolsUserModActionViewProps> = pro
return; return;
} }
SendMessageHook(new ModMessageMessageComposer(user.userId, message, category.id)); SendMessageComposer(new ModMessageMessageComposer(user.userId, message, category.id));
break; break;
} }
} }

View File

@ -1,9 +1,9 @@
import { GetRoomVisitsMessageComposer, RoomVisitsData, RoomVisitsEvent } from '@nitrots/nitro-renderer'; import { GetRoomVisitsMessageComposer, RoomVisitsData, RoomVisitsEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { AutoSizer, List, ListRowProps } from 'react-virtualized'; import { AutoSizer, List, ListRowProps } from 'react-virtualized';
import { TryVisitRoom } from '../../../../api'; import { SendMessageComposer, TryVisitRoom } from '../../../../api';
import { Base, Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { Base, Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { CreateMessageHook, SendMessageHook } from '../../../../hooks'; import { UseMessageEventHook } from '../../../../hooks';
interface ModToolsUserRoomVisitsViewProps interface ModToolsUserRoomVisitsViewProps
{ {
@ -25,7 +25,7 @@ export const ModToolsUserRoomVisitsView: FC<ModToolsUserRoomVisitsViewProps> = p
setRoomVisitData(parser.data); setRoomVisitData(parser.data);
}, [ userId ]); }, [ userId ]);
CreateMessageHook(RoomVisitsEvent, onModtoolReceivedRoomsUserEvent); UseMessageEventHook(RoomVisitsEvent, onModtoolReceivedRoomsUserEvent);
const RowRenderer = (props: ListRowProps) => const RowRenderer = (props: ListRowProps) =>
{ {
@ -42,7 +42,7 @@ export const ModToolsUserRoomVisitsView: FC<ModToolsUserRoomVisitsViewProps> = p
useEffect(() => useEffect(() =>
{ {
SendMessageHook(new GetRoomVisitsMessageComposer(userId)); SendMessageComposer(new GetRoomVisitsMessageComposer(userId));
}, [userId]); }, [userId]);
if(!userId) return null; if(!userId) return null;

View File

@ -1,8 +1,9 @@
import { ModMessageMessageComposer } from '@nitrots/nitro-renderer'; import { ModMessageMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { SendMessageComposer } from '../../../../api';
import { Button, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { Button, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { NotificationAlertEvent } from '../../../../events'; import { NotificationAlertEvent } from '../../../../events';
import { dispatchUiEvent, SendMessageHook } from '../../../../hooks'; import { DispatchUiEvent } from '../../../../hooks';
import { ISelectedUser } from '../../utils/ISelectedUser'; import { ISelectedUser } from '../../utils/ISelectedUser';
interface ModToolsUserSendMessageViewProps interface ModToolsUserSendMessageViewProps
@ -20,12 +21,12 @@ export const ModToolsUserSendMessageView: FC<ModToolsUserSendMessageViewProps> =
{ {
if(message.trim().length === 0) if(message.trim().length === 0)
{ {
dispatchUiEvent(new NotificationAlertEvent([ 'Please write a message to user.' ], null, null, null, 'Error', null)); DispatchUiEvent(new NotificationAlertEvent([ 'Please write a message to user.' ], null, null, null, 'Error', null));
return; return;
} }
SendMessageHook(new ModMessageMessageComposer(user.userId, message, -999)); SendMessageComposer(new ModMessageMessageComposer(user.userId, message, -999));
onCloseClick(); onCloseClick();
}, [ message, user, onCloseClick ]); }, [ message, user, onCloseClick ]);

View File

@ -1,9 +1,9 @@
import { FriendlyTime, GetModeratorUserInfoMessageComposer, ModeratorUserInfoData, ModeratorUserInfoEvent } from '@nitrots/nitro-renderer'; import { FriendlyTime, GetModeratorUserInfoMessageComposer, ModeratorUserInfoData, ModeratorUserInfoEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { LocalizeText } from '../../../../api'; import { LocalizeText, SendMessageComposer } from '../../../../api';
import { Button, Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common'; import { Button, Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
import { ModToolsOpenUserChatlogEvent } from '../../../../events/mod-tools/ModToolsOpenUserChatlogEvent'; import { ModToolsOpenUserChatlogEvent } from '../../../../events';
import { CreateMessageHook, dispatchUiEvent, SendMessageHook } from '../../../../hooks'; import { DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
import { ModToolsUserModActionView } from './ModToolsUserModActionView'; import { ModToolsUserModActionView } from './ModToolsUserModActionView';
import { ModToolsUserRoomVisitsView } from './ModToolsUserRoomVisitsView'; import { ModToolsUserRoomVisitsView } from './ModToolsUserRoomVisitsView';
import { ModToolsUserSendMessageView } from './ModToolsUserSendMessageView'; import { ModToolsUserSendMessageView } from './ModToolsUserSendMessageView';
@ -31,7 +31,7 @@ export const ModToolsUserView: FC<ModToolsUserViewProps> = props =>
setUserInfo(parser.data); setUserInfo(parser.data);
}, [ userId ]); }, [ userId ]);
CreateMessageHook(ModeratorUserInfoEvent, onModtoolUserInfoEvent); UseMessageEventHook(ModeratorUserInfoEvent, onModtoolUserInfoEvent);
const userProperties = useMemo(() => const userProperties = useMemo(() =>
{ {
@ -100,7 +100,7 @@ export const ModToolsUserView: FC<ModToolsUserViewProps> = props =>
useEffect(() => useEffect(() =>
{ {
SendMessageHook(new GetModeratorUserInfoMessageComposer(userId)); SendMessageComposer(new GetModeratorUserInfoMessageComposer(userId));
}, [ userId ]); }, [ userId ]);
if(!userInfo) return null; if(!userInfo) return null;
@ -132,7 +132,7 @@ export const ModToolsUserView: FC<ModToolsUserViewProps> = props =>
</table> </table>
</Column> </Column>
<Column size={ 4 } gap={ 1 }> <Column size={ 4 } gap={ 1 }>
<Button onClick={ event => dispatchUiEvent(new ModToolsOpenUserChatlogEvent(userId)) }> <Button onClick={ event => DispatchUiEvent(new ModToolsOpenUserChatlogEvent(userId)) }>
Room Chat Room Chat
</Button> </Button>
<Button onClick={ event => setSendMessageVisible(!sendMessageVisible) }> <Button onClick={ event => setSendMessageVisible(!sendMessageVisible) }>

Some files were not shown because too many files have changed in this diff Show More