From 4ecb6ba5b6622d5b1e44d59b79ea427968236293 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 21 Jul 2021 22:31:01 -0400 Subject: [PATCH] Add hotel view button --- src/views/toolbar/ToolbarView.tsx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/views/toolbar/ToolbarView.tsx b/src/views/toolbar/ToolbarView.tsx index a807308d..97e654eb 100644 --- a/src/views/toolbar/ToolbarView.tsx +++ b/src/views/toolbar/ToolbarView.tsx @@ -1,11 +1,12 @@ -import { Dispose, DropBounce, EaseOut, JumpBy, Motions, NitroToolbarAnimateIconEvent, Queue, UserFigureEvent, UserInfoDataParser, UserInfoEvent, Wait } from 'nitro-renderer'; +import { DesktopViewComposer, Dispose, DropBounce, EaseOut, JumpBy, Motions, NitroToolbarAnimateIconEvent, Queue, UserFigureEvent, UserInfoDataParser, UserInfoEvent, Wait } from 'nitro-renderer'; import { FC, useCallback, useState } from 'react'; +import { GetRoomSession, GetRoomSessionManager } from '../../api'; import { AvatarEditorEvent, CatalogEvent, FriendListEvent, InventoryEvent, NavigatorEvent, RoomWidgetCameraEvent } from '../../events'; import { AchievementsUIEvent } from '../../events/achievements'; import { UnseenItemTrackerUpdateEvent } from '../../events/inventory/UnseenItemTrackerUpdateEvent'; import { ModToolsEvent } from '../../events/mod-tools/ModToolsEvent'; import { dispatchUiEvent, useRoomEngineEvent, useUiEvent } from '../../hooks'; -import { CreateMessageHook } from '../../hooks/messages/message-event'; +import { CreateMessageHook, SendMessageHook } from '../../hooks/messages/message-event'; import { TransitionAnimation } from '../../layout/transitions/TransitionAnimation'; import { TransitionAnimationTypes } from '../../layout/transitions/TransitionAnimation.types'; import { AvatarImageView } from '../shared/avatar-image/AvatarImageView'; @@ -124,6 +125,14 @@ export const ToolbarView: FC = props => } }, []); + const visitDesktop = useCallback(() => + { + if(!GetRoomSession()) return; + + SendMessageHook(new DesktopViewComposer()); + GetRoomSessionManager().removeSession(-1); + }, []); + return (
@@ -134,17 +143,17 @@ export const ToolbarView: FC = props =>
setMeExpanded(!isMeExpanded) }> - { userFigure && } +
{ (unseenAchievementsCount > 0) && (
{ unseenAchievementsCount }
) }
- {/* { isInRoom && ( -
- -
) } */} + { isInRoom && ( +
+ +
) } { !isInRoom && (