mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
Switch profile if you click another user
This commit is contained in:
parent
c27f4d7db1
commit
cecac30562
@ -1,8 +1,8 @@
|
|||||||
import { RelationshipStatusInfoEvent, RelationshipStatusInfoMessageParser, UserCurrentBadgesComposer, UserCurrentBadgesEvent, UserProfileEvent, UserProfileParser, UserRelationshipsComposer } from '@nitrots/nitro-renderer';
|
import { RelationshipStatusInfoEvent, RelationshipStatusInfoMessageParser, RoomEngineObjectEvent, RoomObjectCategory, RoomObjectType, UserCurrentBadgesComposer, UserCurrentBadgesEvent, UserProfileEvent, UserProfileParser, UserRelationshipsComposer } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useState } from 'react';
|
||||||
import { GetSessionDataManager, GetUserProfile, LocalizeText, SendMessageComposer } from '../../api';
|
import { GetRoomSession, GetSessionDataManager, GetUserProfile, LocalizeText, SendMessageComposer } from '../../api';
|
||||||
import { Column, Flex, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common';
|
import { Column, Flex, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common';
|
||||||
import { BatchUpdates, UseMessageEventHook } from '../../hooks';
|
import { BatchUpdates, UseMessageEventHook, UseRoomEngineEvent } from '../../hooks';
|
||||||
import { BadgesContainerView } from './views/BadgesContainerView';
|
import { BadgesContainerView } from './views/BadgesContainerView';
|
||||||
import { FriendsContainerView } from './views/FriendsContainerView';
|
import { FriendsContainerView } from './views/FriendsContainerView';
|
||||||
import { GroupsContainerView } from './views/GroupsContainerView';
|
import { GroupsContainerView } from './views/GroupsContainerView';
|
||||||
@ -70,6 +70,21 @@ export const UserProfileView: FC<{}> = props =>
|
|||||||
|
|
||||||
UseMessageEventHook(UserProfileEvent, onUserProfileEvent);
|
UseMessageEventHook(UserProfileEvent, onUserProfileEvent);
|
||||||
|
|
||||||
|
const onRoomEngineObjectEvent = useCallback((event: RoomEngineObjectEvent) =>
|
||||||
|
{
|
||||||
|
if(!userProfile) return;
|
||||||
|
|
||||||
|
if(event.category !== RoomObjectCategory.UNIT) return;
|
||||||
|
|
||||||
|
const userData = GetRoomSession().userDataManager.getUserDataByIndex(event.objectId);
|
||||||
|
|
||||||
|
if(userData.type !== RoomObjectType.USER) return;
|
||||||
|
|
||||||
|
GetUserProfile(userData.webID);
|
||||||
|
}, [ userProfile ]);
|
||||||
|
|
||||||
|
UseRoomEngineEvent(RoomEngineObjectEvent.SELECTED, onRoomEngineObjectEvent);
|
||||||
|
|
||||||
if(!userProfile) return null;
|
if(!userProfile) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user