mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-27 08:00:51 +01:00
Fix homeroom button
This commit is contained in:
parent
1569af402a
commit
b107c2b713
@ -27,7 +27,7 @@ export const NavigatorView: FC<NavigatorViewProps> = 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<NavigatorViewProps> = 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<NavigatorViewProps> = props =>
|
||||
switch(parts[2])
|
||||
{
|
||||
case 'home':
|
||||
//goToHomeRoom();
|
||||
goToHomeRoom();
|
||||
break;
|
||||
default: {
|
||||
const roomId = parseInt(parts[2]);
|
||||
@ -148,7 +155,7 @@ export const NavigatorView: FC<NavigatorViewProps> = props =>
|
||||
setCreatorOpen(true);
|
||||
return;
|
||||
}
|
||||
}, []);
|
||||
}, [ goToHomeRoom ]);
|
||||
|
||||
const closePendingDoorState = useCallback((state: string) =>
|
||||
{
|
||||
|
@ -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<ToolbarViewProps> = props =>
|
||||
<i className="icon icon-habbo"></i>
|
||||
</div>) }
|
||||
{ !isInRoom && (
|
||||
<div className="navigation-item">
|
||||
<div className="navigation-item" onClick={ event => CreateLinkEvent('navigator/goto/home') }>
|
||||
<i className="icon icon-house"></i>
|
||||
</div>) }
|
||||
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.NAVIGATOR_ITEM) }>
|
||||
|
Loading…
Reference in New Issue
Block a user