mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +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 [ isRoomLinkOpen, setRoomLinkOpen ] = useState(false);
|
||||||
const [ pendingDoorState, setPendingDoorState ] = useState<{ roomData: RoomDataParser, state: string }>(null);
|
const [ pendingDoorState, setPendingDoorState ] = useState<{ roomData: RoomDataParser, state: string }>(null);
|
||||||
const [ navigatorState, dispatchNavigatorState ] = useReducer(NavigatorReducer, initialNavigator);
|
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) =>
|
const onNavigatorEvent = useCallback((event: NavigatorEvent) =>
|
||||||
{
|
{
|
||||||
@ -119,6 +119,13 @@ export const NavigatorView: FC<NavigatorViewProps> = props =>
|
|||||||
SendMessageHook(new NavigatorSearchComposer(contextCode, searchValue));
|
SendMessageHook(new NavigatorSearchComposer(contextCode, searchValue));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const goToHomeRoom = useCallback(() =>
|
||||||
|
{
|
||||||
|
if(homeRoomId <= 0) return;
|
||||||
|
|
||||||
|
TryVisitRoom(homeRoomId);
|
||||||
|
}, [ homeRoomId ]);
|
||||||
|
|
||||||
const linkReceived = useCallback((url: string) =>
|
const linkReceived = useCallback((url: string) =>
|
||||||
{
|
{
|
||||||
const parts = url.split('/');
|
const parts = url.split('/');
|
||||||
@ -133,7 +140,7 @@ export const NavigatorView: FC<NavigatorViewProps> = props =>
|
|||||||
switch(parts[2])
|
switch(parts[2])
|
||||||
{
|
{
|
||||||
case 'home':
|
case 'home':
|
||||||
//goToHomeRoom();
|
goToHomeRoom();
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
const roomId = parseInt(parts[2]);
|
const roomId = parseInt(parts[2]);
|
||||||
@ -148,7 +155,7 @@ export const NavigatorView: FC<NavigatorViewProps> = props =>
|
|||||||
setCreatorOpen(true);
|
setCreatorOpen(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, []);
|
}, [ goToHomeRoom ]);
|
||||||
|
|
||||||
const closePendingDoorState = useCallback((state: string) =>
|
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 { Dispose, DropBounce, EaseOut, FigureUpdateEvent, JumpBy, Motions, NitroToolbarAnimateIconEvent, Queue, UserInfoDataParser, UserInfoEvent, UserProfileComposer, Wait } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useState } from 'react';
|
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 { AvatarEditorEvent, CatalogEvent, FriendsEvent, FriendsMessengerIconEvent, InventoryEvent, NavigatorEvent, RoomWidgetCameraEvent } from '../../events';
|
||||||
import { AchievementsUIEvent, AchievementsUIUnseenCountEvent } from '../../events/achievements';
|
import { AchievementsUIEvent, AchievementsUIUnseenCountEvent } from '../../events/achievements';
|
||||||
import { UnseenItemTrackerUpdateEvent } from '../../events/inventory/UnseenItemTrackerUpdateEvent';
|
import { UnseenItemTrackerUpdateEvent } from '../../events/inventory/UnseenItemTrackerUpdateEvent';
|
||||||
@ -182,7 +182,7 @@ export const ToolbarView: FC<ToolbarViewProps> = props =>
|
|||||||
<i className="icon icon-habbo"></i>
|
<i className="icon icon-habbo"></i>
|
||||||
</div>) }
|
</div>) }
|
||||||
{ !isInRoom && (
|
{ !isInRoom && (
|
||||||
<div className="navigation-item">
|
<div className="navigation-item" onClick={ event => CreateLinkEvent('navigator/goto/home') }>
|
||||||
<i className="icon icon-house"></i>
|
<i className="icon icon-house"></i>
|
||||||
</div>) }
|
</div>) }
|
||||||
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.NAVIGATOR_ITEM) }>
|
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.NAVIGATOR_ITEM) }>
|
||||||
|
Loading…
Reference in New Issue
Block a user