diff --git a/src/app/components/presence/Presence.tsx b/src/app/components/presence/Presence.tsx index 7b4e5587..e6ac463b 100644 --- a/src/app/components/presence/Presence.tsx +++ b/src/app/components/presence/Presence.tsx @@ -22,10 +22,9 @@ const PresenceToColor: Record = { type PresenceBadgeProps = { presence: Presence; - status?: string; size?: '200' | '300' | '400' | '500'; }; -export function PresenceBadge({ presence, status, size }: PresenceBadgeProps) { +export function PresenceBadge({ presence, size }: PresenceBadgeProps) { const label = usePresenceLabel(); const badgeLabelId = useId(); @@ -39,8 +38,6 @@ export function PresenceBadge({ presence, status, size }: PresenceBadgeProps) { {label[presence]} - {status && •} - {status && {status}} } diff --git a/src/app/components/user-profile/UserHero.tsx b/src/app/components/user-profile/UserHero.tsx index 2f6eb84d..1b913080 100644 --- a/src/app/components/user-profile/UserHero.tsx +++ b/src/app/components/user-profile/UserHero.tsx @@ -9,6 +9,8 @@ import { OverlayBackdrop, OverlayCenter, Text, + Tooltip, + toRem, } from 'folds'; import classNames from 'classnames'; import FocusTrap from 'focus-trap-react'; @@ -34,6 +36,7 @@ type UserHeroProps = { }; export function UserHero({ userId, avatarUrl, bannerUrl, presence }: UserHeroProps) { const [viewAvatar, setViewAvatar] = useState(); + const [isFullStatus, setIsFullStatus] = useState(false); const cachedBannerUrl = useBlobCache(bannerUrl); const cachedAvatarUrl = useBlobCache(avatarUrl); @@ -58,51 +61,80 @@ export function UserHero({ userId, avatarUrl, bannerUrl, presence }: UserHeroPro /> )} -
- - } - > - setViewAvatar(avatarUrl) : undefined} - className={css.UserHeroAvatar} - size="500" + +
+ } > - } - /> - - - {viewAvatar && ( - }> - - setViewAvatar(undefined), - clickOutsideDeactivates: true, - escapeDeactivates: stopPropagation, + setViewAvatar(avatarUrl) : undefined} + className={css.UserHeroAvatar} + size="500" + > + } + /> + + + {viewAvatar && ( + }> + + setViewAvatar(undefined), + clickOutsideDeactivates: true, + escapeDeactivates: stopPropagation, + }} + > + evt.stopPropagation()}> + setViewAvatar(undefined)} + /> + + + + + )} +
+ {presence?.status?.length && ( +
+ setIsFullStatus(!isFullStatus)} + className={css.UserHeroStatusTooltip} + style={{ + maxHeight: isFullStatus ? toRem(105) : toRem(48), + }} + > + - evt.stopPropagation()}> - setViewAvatar(undefined)} - /> - - - - + {presence.status} + + {presence.status.length > 70 && ( + + )} + +
)} -
+ ); } diff --git a/src/app/components/user-profile/styles.css.ts b/src/app/components/user-profile/styles.css.ts index 33fcd096..10b0c9e5 100644 --- a/src/app/components/user-profile/styles.css.ts +++ b/src/app/components/user-profile/styles.css.ts @@ -31,17 +31,38 @@ export const UserHeroCoverFallback = style({ transform: 'scale(2)', }); -export const UserHeroAvatarContainer = style({ +export const UserHeroAvatarStatusContainer = style({ position: 'relative', height: toRem(29), + width: '100%', +}); +export const UserHeroAvatarContainer = style({ + position: 'relative', + paddingLeft: config.space.S400, }); export const UserAvatarContainer = style({ - position: 'absolute', - left: config.space.S400, + position: 'relative', top: 0, transform: 'translateY(-50%)', backgroundColor: color.Surface.Container, }); +export const UserHeroStatusContainer = style({ + position: 'relative', + transform: 'translateY(-50%)', + textAlign: 'justify', + display: 'grid', + width: '100%', + paddingLeft: '2%', +}); +export const UserHeroStatusTooltip = style({ + maxWidth: '98%', + justifySelf: 'left', + cursor: 'pointer', + ':hover': { + filter: 'brightness(0.8)', + transform: 'translateY(-1px)', + }, +}); export const UserHeroAvatar = style({ outline: `${config.borderWidth.B600} solid ${color.Surface.Container}`, selectors: { diff --git a/src/app/features/room/MembersDrawer.tsx b/src/app/features/room/MembersDrawer.tsx index 40c14f26..a7004ff7 100644 --- a/src/app/features/room/MembersDrawer.tsx +++ b/src/app/features/room/MembersDrawer.tsx @@ -30,6 +30,8 @@ import { MatrixClient, Room, RoomMember } from '$types/matrix-sdk'; import { useVirtualizer } from '@tanstack/react-virtual'; import classNames from 'classnames'; +import { AvatarPresence, PresenceBadge } from '$components/presence'; +import { useUserPresence } from '$hooks/useUserPresence'; import { useMatrixClient } from '$hooks/useMatrixClient'; import { UseStateProvider } from '$components/UseStateProvider'; import { SearchItemStrGetter, UseAsyncSearchOptions, useAsyncSearch } from '$hooks/useAsyncSearch'; @@ -128,6 +130,7 @@ function MemberItem({ ? mx.mxcUrlToHttp(avatarMxcUrl, 100, 100, 'crop', undefined, false, useAuthentication) : undefined; + const presence = useUserPresence(member.userId); const { color, font } = useSableCosmetics(member.userId, room); return ( @@ -139,14 +142,18 @@ function MemberItem({ radii="400" onClick={onClick} before={ - - } - /> - + } + > + + } + /> + + } after={ typing && ( @@ -156,10 +163,15 @@ function MemberItem({ ) } > - + {name} + {presence?.status && ( + + {presence.status} + + )} );