import React, { useState } from 'react'; import { Avatar, Box, Icon, Icons, Modal, Overlay, OverlayBackdrop, OverlayCenter, Text, } from 'folds'; import classNames from 'classnames'; import FocusTrap from 'focus-trap-react'; import * as css from './styles.css'; import { UserAvatar } from '../user-avatar'; import colorMXID from '../../../util/colorMXID'; import { getMxIdLocalPart } from '../../utils/matrix'; import { BreakWord, LineClamp3 } from '../../styles/Text.css'; import { UserPresence } from '../../hooks/useUserPresence'; import { AvatarPresence, PresenceBadge } from '../presence'; import { ImageViewer } from '../image-viewer'; import { stopPropagation } from '../../utils/keyboard'; type UserHeroProps = { userId: string; avatarUrl?: string; presence?: UserPresence; }; export function UserHero({ userId, avatarUrl, presence }: UserHeroProps) { const [viewAvatar, setViewAvatar] = useState(); return (
{avatarUrl && ( {userId} )}
} > setViewAvatar(avatarUrl) : undefined} className={css.UserHeroAvatar} size="500" > } /> {viewAvatar && ( }> setViewAvatar(undefined), clickOutsideDeactivates: true, escapeDeactivates: stopPropagation, }} > evt.stopPropagation()}> setViewAvatar(undefined)} /> )}
); } type UserHeroNameProps = { displayName?: string; userId: string; }; export function UserHeroName({ displayName, userId }: UserHeroNameProps) { const username = getMxIdLocalPart(userId); return ( {displayName ?? username ?? userId} @{username} ); }