diff --git a/src/app/components/presence/Presence.tsx b/src/app/components/presence/Presence.tsx index 380ab731..96b5aef2 100644 --- a/src/app/components/presence/Presence.tsx +++ b/src/app/components/presence/Presence.tsx @@ -17,7 +17,7 @@ import { usePresenceLabel } from '../../hooks/useUserPresence'; const PresenceToColor: Record = { online: 'Success', - unavailable: 'Warning', + unavailable: 'Critical', offline: 'Secondary', }; diff --git a/src/app/components/user-profile/UserHero.tsx b/src/app/components/user-profile/UserHero.tsx index a486779b..6684eca0 100644 --- a/src/app/components/user-profile/UserHero.tsx +++ b/src/app/components/user-profile/UserHero.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { ReactNode, useState } from 'react'; import { Avatar, Box, @@ -28,103 +28,127 @@ import { LINKIFY_OPTS } from '../../plugins/react-custom-html-parser'; import { useSetting } from '../../state/hooks/settings'; import { settingsAtom } from '../../state/settings'; -type UserHeroProps = { +export function UserHero({ children }: { children: ReactNode }) { + return ( + + {children} + + ); +} + +export function UserHeroCover({ + userId, + avatarUrl, + bannerUrl, + hasStatus, +}: { userId: string; avatarUrl?: string; bannerUrl?: string; + hasStatus: boolean; +}) { + return ( +
+ {bannerUrl && ( + {userId} + )} +
+ ); +} +type UserHeroAvatarProps = { + userId: string; + avatarUrl?: string; presence?: UserPresence; }; -export function UserHero({ userId, avatarUrl, bannerUrl, presence }: UserHeroProps) { +export function UserHeroAvatar({ userId, avatarUrl, presence }: UserHeroAvatarProps) { const [viewAvatar, setViewAvatar] = useState(); const { status } = presence ?? {}; return ( - -
+ } > - {bannerUrl && ( - {userId} - )} -
-
- } + setViewAvatar(avatarUrl) : undefined} + className={css.UserHeroAvatar} + size="500" > - setViewAvatar(avatarUrl) : undefined} - className={css.UserHeroAvatar} - size="500" - > - } - /> - - - {status && ( -
-
- - {status} - -
+ } + /> + + + {status && ( +
+
+ + {status} +
- )} - {viewAvatar && ( - }> - - setViewAvatar(undefined), - clickOutsideDeactivates: true, - escapeDeactivates: stopPropagation, - }} - > - evt.stopPropagation()}> - setViewAvatar(undefined)} - /> - - - - - )} -
- +
+ )} + {viewAvatar && ( + }> + + setViewAvatar(undefined), + clickOutsideDeactivates: true, + escapeDeactivates: stopPropagation, + }} + > + evt.stopPropagation()}> + setViewAvatar(undefined)} + /> + + + + + )} +
); } 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()); + let time: string | undefined; + try { + time = new Intl.DateTimeFormat('en-US', { + timeZone: timezone, + hour: '2-digit', + minute: '2-digit', + hour12: !hour24Clock, + }).format(new Date()); + } catch (e) { + console.error(e); + } return ( - + - + + + {userId !== myUserId && ( + + + + )} + + - - - {userId !== myUserId && ( - - - - )} - + {server && } diff --git a/src/app/components/user-profile/styles.css.ts b/src/app/components/user-profile/styles.css.ts index 7a5578af..7ea20903 100644 --- a/src/app/components/user-profile/styles.css.ts +++ b/src/app/components/user-profile/styles.css.ts @@ -70,7 +70,7 @@ export const UserHeroStatus = style({ position: 'absolute', left: toRem(78), bottom: toRem(58), - marginRight: config.space.S100, + marginRight: config.space.S400, animation: `${StatusAnime} 100ms`, @@ -106,3 +106,11 @@ export const UserHeroStatusContent = style({ color: color.Surface.OnContainer, borderRadius: config.radii.R500, }); + +export const UserActionButton = style({ + position: 'absolute', + right: config.space.S400, + zIndex: 1, + transform: 'translateY(-10%)', + outline: `${config.borderWidth.B600} solid ${color.Surface.Container}`, +});