mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
Merge branch 'dev' of https://git.krews.org/nitro/nitro-react into dev
This commit is contained in:
commit
e5fca84ef7
@ -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;
|
||||
|
@ -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<LayoutGiftTagViewProps> = props =>
|
||||
const { figure = null, userName = null, message = null, editable = false, onChange = null } = props;
|
||||
|
||||
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">
|
||||
{ !userName && <div className="gift-incognito"></div> }
|
||||
{ figure && <div className="gift-avatar">
|
||||
<LayoutAvatarImageView figure={ figure } direction={ 2 } headOnly={ true } />
|
||||
</div> }
|
||||
</div>
|
||||
<div className="d-flex flex-column w-100 pt-4 pb-4 pe-4 ps-3">
|
||||
{ !editable && <div className="gift-message">{ message }</div> }
|
||||
{ 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> }
|
||||
{ userName && <div className="mt-auto text-end fst-italic">{ LocalizeText('catalog.gift_wrapping_new.message_from', ['name'], [userName]) }</div> }
|
||||
</div>
|
||||
</div>
|
||||
<Flex overflow="hidden" className="w-100 pt-4 pb-4 pe-4 ps-3">
|
||||
<Column grow overflow="auto" justifyContent="between">
|
||||
{ !editable &&
|
||||
<Text textBreak className="gift-message">{ message }</Text> }
|
||||
{ editable && (onChange !== null) &&
|
||||
<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>
|
||||
);
|
||||
};
|
||||
|
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user