This commit is contained in:
Layne 2022-03-16 18:18:41 -04:00
commit e5fca84ef7
3 changed files with 31 additions and 13 deletions

View File

@ -132,9 +132,6 @@
width: 100%; width: 100%;
min-width: 100%; min-width: 100%;
max-width: 100%; max-width: 100%;
height: 90px;
min-height: 90px;
max-height: 90px;
border: none; border: none;
resize: none; resize: none;
outline: none; outline: none;

View File

@ -1,4 +1,5 @@
import { FC } from 'react'; import { FC } from 'react';
import { Column, Flex, Text } from '..';
import { LocalizeText } from '../../api'; import { LocalizeText } from '../../api';
import { LayoutAvatarImageView } from './LayoutAvatarImageView'; import { LayoutAvatarImageView } from './LayoutAvatarImageView';
@ -16,18 +17,23 @@ export const LayoutGiftTagView: FC<LayoutGiftTagViewProps> = props =>
const { figure = null, userName = null, message = null, editable = false, onChange = null } = props; const { figure = null, userName = null, message = null, editable = false, onChange = null } = props;
return ( return (
<div className="nitro-gift-card d-flex text-black"> <Flex overflow="hidden" className="nitro-gift-card text-black">
<div className="d-flex align-items-center justify-content-center gift-face flex-shrink-0"> <div className="d-flex align-items-center justify-content-center gift-face flex-shrink-0">
{ !userName && <div className="gift-incognito"></div> } { !userName && <div className="gift-incognito"></div> }
{ figure && <div className="gift-avatar"> { figure && <div className="gift-avatar">
<LayoutAvatarImageView figure={ figure } direction={ 2 } headOnly={ true } /> <LayoutAvatarImageView figure={ figure } direction={ 2 } headOnly={ true } />
</div> } </div> }
</div> </div>
<div className="d-flex flex-column w-100 pt-4 pb-4 pe-4 ps-3"> <Flex overflow="hidden" className="w-100 pt-4 pb-4 pe-4 ps-3">
{ !editable && <div className="gift-message">{ message }</div> } <Column grow overflow="auto" justifyContent="between">
{ editable && onChange && <textarea className="gift-message" maxLength={ 140 } value={ message } onChange={ (e) => onChange(e.target.value) } placeholder={ LocalizeText('catalog.gift_wrapping_new.message_hint') }></textarea> } { !editable &&
{ userName && <div className="mt-auto text-end fst-italic">{ LocalizeText('catalog.gift_wrapping_new.message_from', ['name'], [userName]) }</div> } <Text textBreak className="gift-message">{ message }</Text> }
</div> { editable && (onChange !== null) &&
</div> <textarea className="gift-message h-100" maxLength={ 140 } value={ message } onChange={ (e) => onChange(e.target.value) } placeholder={ LocalizeText('catalog.gift_wrapping_new.message_hint') }></textarea> }
{ userName &&
<Text italics textEnd className="pe-1">{ LocalizeText('catalog.gift_wrapping_new.message_from', ['name'], [userName]) }</Text> }
</Column>
</Flex>
</Flex>
); );
}; };

View File

@ -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 (