diff --git a/src/views/navigator/NavigatorView.tsx b/src/views/navigator/NavigatorView.tsx index 892fa2ae..d26d9147 100644 --- a/src/views/navigator/NavigatorView.tsx +++ b/src/views/navigator/NavigatorView.tsx @@ -27,7 +27,7 @@ export const NavigatorView: FC = props => const [ isRoomLinkOpen, setRoomLinkOpen ] = useState(false); const [ pendingDoorState, setPendingDoorState ] = useState<{ roomData: RoomDataParser, state: string }>(null); const [ navigatorState, dispatchNavigatorState ] = useReducer(NavigatorReducer, initialNavigator); - const { needsNavigatorUpdate = false, topLevelContext = null, topLevelContexts = null } = navigatorState; + const { needsNavigatorUpdate = false, topLevelContext = null, topLevelContexts = null, homeRoomId } = navigatorState; const onNavigatorEvent = useCallback((event: NavigatorEvent) => { @@ -119,6 +119,13 @@ export const NavigatorView: FC = props => SendMessageHook(new NavigatorSearchComposer(contextCode, searchValue)); }, []); + const goToHomeRoom = useCallback(() => + { + if(homeRoomId <= 0) return; + + TryVisitRoom(homeRoomId); + }, [ homeRoomId ]); + const linkReceived = useCallback((url: string) => { const parts = url.split('/'); @@ -133,7 +140,7 @@ export const NavigatorView: FC = props => switch(parts[2]) { case 'home': - //goToHomeRoom(); + goToHomeRoom(); break; default: { const roomId = parseInt(parts[2]); @@ -147,8 +154,8 @@ export const NavigatorView: FC = props => setIsVisible(true); setCreatorOpen(true); return; - } - }, []); + } + }, [ goToHomeRoom ]); const closePendingDoorState = useCallback((state: string) => { diff --git a/src/views/toolbar/ToolbarView.tsx b/src/views/toolbar/ToolbarView.tsx index 4fbaf697..45e42781 100644 --- a/src/views/toolbar/ToolbarView.tsx +++ b/src/views/toolbar/ToolbarView.tsx @@ -1,6 +1,6 @@ import { Dispose, DropBounce, EaseOut, FigureUpdateEvent, JumpBy, Motions, NitroToolbarAnimateIconEvent, Queue, UserInfoDataParser, UserInfoEvent, UserProfileComposer, Wait } from '@nitrots/nitro-renderer'; import { FC, useCallback, useState } from 'react'; -import { GetRoomSession, GetRoomSessionManager, GetSessionDataManager, GoToDesktop, OpenMessengerChat } from '../../api'; +import { CreateLinkEvent, GetRoomSession, GetRoomSessionManager, GetSessionDataManager, GoToDesktop, OpenMessengerChat } from '../../api'; import { AvatarEditorEvent, CatalogEvent, FriendsEvent, FriendsMessengerIconEvent, InventoryEvent, NavigatorEvent, RoomWidgetCameraEvent } from '../../events'; import { AchievementsUIEvent, AchievementsUIUnseenCountEvent } from '../../events/achievements'; import { UnseenItemTrackerUpdateEvent } from '../../events/inventory/UnseenItemTrackerUpdateEvent'; @@ -182,7 +182,7 @@ export const ToolbarView: FC = props => ) } { !isInRoom && ( -
+
CreateLinkEvent('navigator/goto/home') }>
) }
handleToolbarItemClick(ToolbarViewItems.NAVIGATOR_ITEM) }>