@@ -2,20 +2,44 @@ import React from 'react';
22import PropTypes from 'prop-types' ;
33import './PeopleSelector.scss' ;
44
5+ import ReactDOMServer from 'react-dom/server' ;
56import { twemojify } from '../../../util/twemojify' ;
67
78import { blurOnBubbling } from '../../atoms/button/script' ;
89
910import Text from '../../atoms/text/Text' ;
1011import Avatar from '../../atoms/avatar/Avatar' ;
11- import { getUserStatus , updateUserStatusIcon } from '../../../util/onlineStatus' ;
12+ import { getUserStatus , updateUserStatusIcon , getPresence } from '../../../util/onlineStatus' ;
1213
1314function PeopleSelector ( {
1415 avatarSrc, name, color, peopleRole, onClick, user, disableStatus
1516} ) {
1617
1718 const statusRef = React . useRef ( null ) ;
1819 const customStatusRef = React . useRef ( null ) ;
20+
21+ const getCustomStatus = ( content ) => {
22+
23+ // Custom Status
24+ if ( customStatusRef && customStatusRef . current ) {
25+
26+ // Get Status
27+ const customStatus = customStatusRef . current ;
28+
29+ if ( content && content . presenceStatusMsg && typeof content . presenceStatusMsg . msg === 'string' && content . presenceStatusMsg . msg . length > 0 ) {
30+ customStatus . innerHTML = ReactDOMServer . renderToStaticMarkup ( twemojify ( content . presenceStatusMsg . msg . substring ( 0 , 100 ) , undefined , true , false , true ) ) ;
31+ } else {
32+ customStatus . innerHTML = '' ;
33+ }
34+
35+ }
36+
37+ } ;
38+
39+ if ( user ) {
40+ getCustomStatus ( getPresence ( user ) ) ;
41+ }
42+
1943 React . useEffect ( ( ) => {
2044 if ( user ) {
2145
@@ -27,7 +51,7 @@ function PeopleSelector({
2751 const status = statusRef . current ;
2852
2953 // Update Status Icon
30- updateUserStatusIcon ( status , tinyUser ) ;
54+ getCustomStatus ( updateUserStatusIcon ( status , tinyUser ) ) ;
3155
3256 }
3357 } ;
@@ -58,7 +82,7 @@ function PeopleSelector({
5882
5983 < div className = "small people-selector__name emoji-size-fix text-start" >
6084 { twemojify ( name ) }
61- < div ref = { customStatusRef } className = 'very-small' />
85+ < div ref = { customStatusRef } className = 'very-small text-gray text-truncate ' />
6286 </ div >
6387
6488 { peopleRole !== null && < Text className = "people-selector__role" variant = "b3" > { peopleRole } </ Text > }
0 commit comments