From cecac305629b06ee5d4de9dc0e7beebf3b39db85 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 16 Mar 2022 18:01:57 -0400 Subject: [PATCH 1/2] Switch profile if you click another user --- .../user-profile/UserProfileView.tsx | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/components/user-profile/UserProfileView.tsx b/src/components/user-profile/UserProfileView.tsx index c8d005f1..9454370a 100644 --- a/src/components/user-profile/UserProfileView.tsx +++ b/src/components/user-profile/UserProfileView.tsx @@ -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 { 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 { BatchUpdates, UseMessageEventHook } from '../../hooks'; +import { BatchUpdates, UseMessageEventHook, UseRoomEngineEvent } from '../../hooks'; import { BadgesContainerView } from './views/BadgesContainerView'; import { FriendsContainerView } from './views/FriendsContainerView'; import { GroupsContainerView } from './views/GroupsContainerView'; @@ -70,6 +70,21 @@ export const UserProfileView: FC<{}> = props => 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; return ( From 8b2d9dc098fe19042ac4685479c05ba652f1581d Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 16 Mar 2022 18:12:17 -0400 Subject: [PATCH 2/2] Fix gift tags --- src/common/index.scss | 3 --- src/common/layout/LayoutGiftTagView.tsx | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/common/index.scss b/src/common/index.scss index 69f24cbd..b62c340c 100644 --- a/src/common/index.scss +++ b/src/common/index.scss @@ -132,9 +132,6 @@ width: 100%; min-width: 100%; max-width: 100%; - height: 90px; - min-height: 90px; - max-height: 90px; border: none; resize: none; outline: none; diff --git a/src/common/layout/LayoutGiftTagView.tsx b/src/common/layout/LayoutGiftTagView.tsx index 41bb1b2e..0db589b0 100644 --- a/src/common/layout/LayoutGiftTagView.tsx +++ b/src/common/layout/LayoutGiftTagView.tsx @@ -1,4 +1,5 @@ import { FC } from 'react'; +import { Column, Flex, Text } from '..'; import { LocalizeText } from '../../api'; import { LayoutAvatarImageView } from './LayoutAvatarImageView'; @@ -16,18 +17,23 @@ export const LayoutGiftTagView: FC = props => const { figure = null, userName = null, message = null, editable = false, onChange = null } = props; return ( -
+
{ !userName &&
} { figure &&
}
-
- { !editable &&
{ message }
} - { editable && onChange && } - { userName &&
{ LocalizeText('catalog.gift_wrapping_new.message_from', ['name'], [userName]) }
} -
-
+ + + { !editable && + { message } } + { editable && (onChange !== null) && + } + { userName && + { LocalizeText('catalog.gift_wrapping_new.message_from', ['name'], [userName]) } } + + + ); };