mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +01:00
Fix MeToolbar actions
This commit is contained in:
parent
9638dbdd1e
commit
e83ddc7aec
@ -1,12 +1,13 @@
|
||||
import { Dispose, DropBounce, EaseOut, FigureUpdateEvent, JumpBy, Motions, NitroToolbarAnimateIconEvent, Queue, UserInfoDataParser, UserInfoEvent, 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 { GetRoomSession, GetRoomSessionManager, GoToDesktop } from '../../api';
|
||||
import { GetRoomSession, GetRoomSessionManager, GetSessionDataManager, GoToDesktop } 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 { UserSettingsUIEvent } from '../../events/user-settings/UserSettingsUIEvent';
|
||||
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';
|
||||
@ -122,6 +123,14 @@ export const ToolbarView: FC<ToolbarViewProps> = props =>
|
||||
dispatchUiEvent(new AchievementsUIEvent(AchievementsUIEvent.TOGGLE_ACHIEVEMENTS));
|
||||
setMeExpanded(false);
|
||||
return;
|
||||
case ToolbarViewItems.PROFILE_ITEM:
|
||||
SendMessageHook(new UserProfileComposer(GetSessionDataManager().userId));
|
||||
setMeExpanded(false);
|
||||
return;
|
||||
case ToolbarViewItems.SETTINGS_ITEM:
|
||||
dispatchUiEvent(new UserSettingsUIEvent(UserSettingsUIEvent.TOGGLE_USER_SETTINGS));
|
||||
setMeExpanded(false);
|
||||
return;
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
@ -13,4 +13,6 @@ export class ToolbarViewItems
|
||||
public static CAMERA_ITEM: string = 'TVI_CAMERA_ITEM';
|
||||
public static MOD_TOOLS_ITEM: string = 'TVI_MOD_TOOLS_ITEM';
|
||||
public static ACHIEVEMENTS_ITEM: string = 'TVI_ACHIEVEMENTS_ITEM';
|
||||
public static PROFILE_ITEM: string = 'TVI_PROFILE_ITEM';
|
||||
public static SETTINGS_ITEM: string = 'TVI_SETTINGS_ITEM';
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { MouseEventType, UserProfileComposer } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useRef } from 'react';
|
||||
import { GetSessionDataManager } from '../../../api';
|
||||
import { SendMessageHook } from '../../../hooks';
|
||||
import { MouseEventType } from '@nitrots/nitro-renderer';
|
||||
import { FC, useEffect, useRef } from 'react';
|
||||
import { ToolbarViewItems } from '../ToolbarView.types';
|
||||
import { ToolbarMeViewProps } from './ToolbarMeView.types';
|
||||
|
||||
@ -31,11 +29,6 @@ export const ToolbarMeView: FC<ToolbarMeViewProps> = props =>
|
||||
}
|
||||
}, [ elementRef, setMeExpanded ]);
|
||||
|
||||
const openProfile = useCallback(() =>
|
||||
{
|
||||
SendMessageHook(new UserProfileComposer(GetSessionDataManager().userId));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div ref={ elementRef } className="d-flex nitro-toolbar-me px-1 py-2">
|
||||
<div className="navigation-items">
|
||||
@ -45,22 +38,22 @@ export const ToolbarMeView: FC<ToolbarMeViewProps> = props =>
|
||||
<div className="navigation-item">
|
||||
<i className="icon icon-me-helper-tool"></i>
|
||||
</div>
|
||||
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.ACHIEVEMENTS_ITEM) }>
|
||||
<div className="navigation-item" onClick={ () => handleToolbarItemClick(ToolbarViewItems.ACHIEVEMENTS_ITEM) }>
|
||||
<i className="icon icon-me-achievements"></i>
|
||||
</div>
|
||||
<div className="navigation-item">
|
||||
<i className="icon icon-me-profile" onClick={() => openProfile()}></i>
|
||||
<div className="navigation-item" onClick={ () => handleToolbarItemClick(ToolbarViewItems.PROFILE_ITEM) }>
|
||||
<i className="icon icon-me-profile"></i>
|
||||
</div>
|
||||
<div className="navigation-item">
|
||||
<i className="icon icon-me-rooms"></i>
|
||||
</div>
|
||||
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.CLOTHING_ITEM) }>
|
||||
<div className="navigation-item" onClick={ () => handleToolbarItemClick(ToolbarViewItems.CLOTHING_ITEM) }>
|
||||
<i className="icon icon-me-clothing"></i>
|
||||
</div>
|
||||
<div className="navigation-item">
|
||||
<i className="icon icon-me-forums"></i>
|
||||
</div>
|
||||
<div className="navigation-item">
|
||||
<div className="navigation-item" onClick={ () => handleToolbarItemClick(ToolbarViewItems.SETTINGS_ITEM) }>
|
||||
<i className="icon icon-me-settings"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user