From 33fc3a00a948eda8413ec6acdc4351209a1c2e93 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Tue, 21 Jul 2026 23:16:43 +0530 Subject: [PATCH] display presence status message in profile banner --- src/app/components/presence/Presence.tsx | 5 +- src/app/components/user-profile/UserHero.tsx | 15 ++++-- .../user-profile/UserRoomProfile.tsx | 2 + src/app/components/user-profile/styles.css.ts | 52 ++++++++++++++++++- 4 files changed, 66 insertions(+), 8 deletions(-) diff --git a/src/app/components/presence/Presence.tsx b/src/app/components/presence/Presence.tsx index a3253673..380ab731 100644 --- a/src/app/components/presence/Presence.tsx +++ b/src/app/components/presence/Presence.tsx @@ -23,10 +23,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(); @@ -40,8 +39,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 0e7fb748..0425f950 100644 --- a/src/app/components/user-profile/UserHero.tsx +++ b/src/app/components/user-profile/UserHero.tsx @@ -30,6 +30,8 @@ type UserHeroProps = { export function UserHero({ userId, avatarUrl, presence }: UserHeroProps) { const [viewAvatar, setViewAvatar] = useState(); + const { status } = presence ?? {}; + return (
- } + badge={presence && } > + {status && ( +
+
+ + {status} + +
+
+ )} {viewAvatar && ( }> diff --git a/src/app/components/user-profile/UserRoomProfile.tsx b/src/app/components/user-profile/UserRoomProfile.tsx index b96e7906..f5b98af0 100644 --- a/src/app/components/user-profile/UserRoomProfile.tsx +++ b/src/app/components/user-profile/UserRoomProfile.tsx @@ -83,6 +83,8 @@ export function UserRoomProfile({ userId }: UserRoomProfileProps) { navigate(withSearchParam(getDirectCreatePath(), directSearchParam)); }; + ct.storage.presence.read.getAll().then((a) => console.log(a.filter((p) => p.content.status_msg))); + return ( diff --git a/src/app/components/user-profile/styles.css.ts b/src/app/components/user-profile/styles.css.ts index 62272a2e..7ccbd2d0 100644 --- a/src/app/components/user-profile/styles.css.ts +++ b/src/app/components/user-profile/styles.css.ts @@ -1,4 +1,4 @@ -import { style } from '@vanilla-extract/css'; +import { keyframes, style } from '@vanilla-extract/css'; import { color, config, toRem } from 'folds'; export const UserHeader = style({ @@ -52,3 +52,53 @@ export const UserHeroAvatarImg = style({ }, }, }); + +const StatusAnime = keyframes({ + '0%': { + transform: 'translateY(2px)', + }, + '100%': { + transform: 'translateY(0)', + }, +}); + +export const UserHeroStatus = style({ + position: 'absolute', + left: toRem(78), + bottom: toRem(58), + marginRight: config.space.S100, + + animation: `${StatusAnime} 100ms`, + + selectors: { + '&::before, &::after': { + content: '', + position: 'absolute', + left: toRem(5), + bottom: toRem(-4), + + width: toRem(10), + height: toRem(10), + + background: color.Surface.Container, + borderRadius: 999, + transform: 'rotate(45deg)', + }, + '&::after': { + left: toRem(5), + bottom: toRem(-10), + + width: toRem(5), + height: toRem(5), + }, + }, +}); + +export const UserHeroStatusContent = style({ + position: 'relative', + zIndex: 1, + padding: `${config.space.S100} ${config.space.S200}`, + backgroundColor: color.Surface.Container, + color: color.Surface.OnContainer, + borderRadius: config.radii.R500, +});