diff --git a/src/app/components/user-profile/UserHero.tsx b/src/app/components/user-profile/UserHero.tsx index 73cb7cac..a486779b 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, + TooltipProvider, } from 'folds'; import classNames from 'classnames'; import FocusTrap from 'focus-trap-react'; @@ -17,12 +19,14 @@ 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 { BreakWord, DotDivider, HoverUnderline, 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'; import { LINKIFY_OPTS } from '../../plugins/react-custom-html-parser'; +import { useSetting } from '../../state/hooks/settings'; +import { settingsAtom } from '../../state/settings'; type UserHeroProps = { userId: string; @@ -112,15 +116,45 @@ export function UserHero({ userId, avatarUrl, bannerUrl, presence }: UserHeroPro ); } +export function UserTimezone({ timezone }: { timezone: string }) { + const [hour24Clock] = useSetting(settingsAtom, 'hour24Clock'); + + const time = new Intl.DateTimeFormat('en-US', { + timeZone: timezone, + hour: '2-digit', + minute: '2-digit', + hour12: !hour24Clock, + }).format(new Date()); + + return ( + + {timezone} + + } + > + {(triggerRef) => ( + + {time} + + )} + + ); +} + type UserHeroNameProps = { displayName?: string; userId: string; + timezone?: string; }; -export function UserHeroName({ displayName, userId }: UserHeroNameProps) { +export function UserHeroName({ displayName, userId, timezone }: UserHeroNameProps) { const username = getMxIdLocalPart(userId); return ( - + @{username} + {timezone && } + {timezone && } ); diff --git a/src/app/components/user-profile/UserRoomProfile.tsx b/src/app/components/user-profile/UserRoomProfile.tsx index 85155a26..97d09772 100644 --- a/src/app/components/user-profile/UserRoomProfile.tsx +++ b/src/app/components/user-profile/UserRoomProfile.tsx @@ -102,7 +102,11 @@ export function UserRoomProfile({ userId }: UserRoomProfileProps) { - + {userId !== myUserId && (