:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(desktop): standardize on gravatar avatars for people (#82908)
Charles Vien14c77cb2ea29
diff --git a/products/desktop/packages/core/src/auth/userInitials.ts b/products/desktop/packages/core/src/auth/userInitials.tsindex c51b6589050d..2874c7b7cadc 100644--- a/products/desktop/packages/core/src/auth/userInitials.ts+++ b/products/desktop/packages/core/src/auth/userInitials.ts@@ -1,4 +1,4 @@-interface UserLike {+export interface UserLike {first_name?: string | null;last_name?: string | null;email?: string | null;diff --git a/products/desktop/packages/core/src/inbox/artefacts.test.ts b/products/desktop/packages/core/src/inbox/artefacts.test.tsindex 3d733ffbd3ac..d35891fd0309 100644--- a/products/desktop/packages/core/src/inbox/artefacts.test.ts+++ b/products/desktop/packages/core/src/inbox/artefacts.test.ts@@ -7,7 +7,6 @@ import {buildReviewerOptions,extractSuggestedReviewers,orderSuggestedReviewers,- reviewerInitials,reviewerMatchesAvailable,reviewerOptionLabel,suggestedReviewerDisplayName,@@ -74,11 +73,6 @@ describe("artefacts", () => {).toBe("Ben W.");});- it("derives reviewer initials from names and emails", () => {- expect(reviewerInitials("Ben W.", null)).toBe("BW");- expect(reviewerInitials("", "[email protected]")).toBe("BE");- });-it("moves the current user to the front", () => {const reviewers = [makeReviewer({diff --git a/products/desktop/packages/core/src/inbox/artefacts.ts b/products/desktop/packages/core/src/inbox/artefacts.tsindex dc5b2eddb28a..d5e8294832fa 100644--- a/products/desktop/packages/core/src/inbox/artefacts.ts+++ b/products/desktop/packages/core/src/inbox/artefacts.ts@@ -133,42 +133,3 @@ export function toSuggestedReviewerWriteContent(}).filter((entry): entry is SuggestedReviewerWriteEntry => entry !== null);}--const AVATAR_PALETTE = [- "bg-(--orange-9) text-white",- "bg-(--blue-9) text-white",- "bg-(--purple-9) text-white",- "bg-(--green-9) text-white",- "bg-(--pink-9) text-white",- "bg-(--teal-9) text-white",-] as const;--export function reviewerAvatarToneClass(seed: string): string {- let hash = 0;- for (let i = 0; i < seed.length; i += 1) {- hash = (hash + seed.charCodeAt(i) * (i + 1)) % 9973;- }- return AVATAR_PALETTE[hash % AVATAR_PALETTE.length];-}--export function reviewerInitials(- name: string | null | undefined,- email: string | null | undefined,-): string {- const trimmedName = name?.trim() ?? "";- if (trimmedName) {- const parts = trimmedName.split(/\s+/).filter(Boolean);- if (parts.length >= 2) {- return `${parts[0][0] ?? ""}${parts[parts.length - 1][0] ?? ""}`.toUpperCase();- }- return trimmedName.slice(0, 2).toUpperCase();- }-- const trimmedEmail = email?.trim() ?? "";- if (trimmedEmail) {- const local = trimmedEmail.split("@")[0] ?? trimmedEmail;- return local.slice(0, 2).toUpperCase();- }-- return "??";-}diff --git a/products/desktop/packages/ui/src/features/auth/UserAvatar.tsx b/products/desktop/packages/ui/src/features/auth/UserAvatar.tsxindex 2bb24d6ef691..892fc175fdf8 100644--- a/products/desktop/packages/ui/src/features/auth/UserAvatar.tsx+++ b/products/desktop/packages/ui/src/features/auth/UserAvatar.tsx@@ -1,16 +1,23 @@import { avatarColor } from "@posthog/core/auth/avatarColor";+import type { UserLike } from "@posthog/core/auth/userInitials";import { Avatar, AvatarFallback, AvatarImage } from "@posthog/quill";-import type { UserBasic } from "@posthog/shared/domain-types";import { useGravatarUrl } from "@posthog/ui/features/auth/useGravatarUrl";import { getUserInitials } from "@posthog/ui/features/auth/userInitials";import { userDisplayName } from "@posthog/ui/features/canvas/utils/userDisplay";type AvatarSize = "lg" | "default" | "sm" | "xs";+// The minimum a surface needs to know about a person to draw them. `UserBasic`+// satisfies it, and so do leaner shapes like inbox teammates.+export interface AvatarPerson extends UserLike {+ uuid?: string | null;+}+interface UserAvatarProps {- user?: UserBasic | null;+ user?: AvatarPerson | null;size?: AvatarSize;className?: string;+ title?: string;}// A person's avatar: Gravatar (by email) when one exists, otherwise a colored@@ -20,13 +27,14 @@ export function UserAvatar({user,size = "default",className,+ title,}: UserAvatarProps) {const gravatarUrl = useGravatarUrl(user?.email);const seed = user?.uuid ?? user?.email ?? userDisplayName(user);const color = avatarColor(seed);return (- <Avatar size={size} className={className}>+ <Avatar size={size} className={className} title={title}>{gravatarUrl ? (<AvatarImage src={gravatarUrl} alt={userDisplayName(user)} />) : null}diff --git a/products/desktop/packages/ui/src/features/canvas/components/MentionComposer.tsx b/products/desktop/packages/ui/src/features/canvas/components/MentionComposer.tsxindex 825a6e218188..4a82f14e1686 100644--- a/products/desktop/packages/ui/src/features/canvas/components/MentionComposer.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/MentionComposer.tsx@@ -1,7 +1,7 @@import { RobotIcon } from "@phosphor-icons/react";import { Avatar, AvatarFallback, InputGroup } from "@posthog/quill";import type { UserBasic } from "@posthog/shared/domain-types";-import { getUserInitials } from "@posthog/ui/features/auth/userInitials";+import { UserAvatar } from "@posthog/ui/features/auth/UserAvatar";import {type ComposerMentionCandidate,contentToDoc,@@ -268,15 +268,19 @@ export function MentionComposer({index === highlightedIndex ? "bg-[var(--accent-a4)]" : ""}`}>- <Avatar size="xs" className="shrink-0">- <AvatarFallback>- {candidate.kind === "agent" ? (+ {candidate.kind === "agent" ? (+ <Avatar size="xs" className="shrink-0">+ <AvatarFallback><RobotIcon size={12} />- ) : (- getUserInitials(candidate.member)- )}- </AvatarFallback>- </Avatar>+ </AvatarFallback>+ </Avatar>+ ) : (+ <UserAvatar+ user={candidate.member}+ size="xs"+ className="shrink-0"+ />+ )}<span className="truncate font-medium text-xs">{candidate.kind === "agent"? "Agent"diff --git a/products/desktop/packages/ui/src/features/canvas/utils/userDisplay.test.ts b/products/desktop/packages/ui/src/features/canvas/utils/userDisplay.test.tsnew file mode 100644index 000000000000..869479090948--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/utils/userDisplay.test.ts@@ -0,0 +1,26 @@+import { describe, expect, it } from "vitest";+import { userDisplayName } from "./userDisplay";++describe("userDisplayName", () => {+ it.each([+ ["a missing user", null, "Unknown"],+ [+ "a full name",+ { first_name: "Ada", last_name: "Lovelace", email: "[email protected]" },+ "Ada Lovelace",+ ],+ [+ "a first name only",+ { first_name: "Ada", email: "[email protected]" },+ "Ada",+ ],+ ["an email only", { email: "[email protected]" }, "[email protected]"],+ [+ "empty name fields and no email",+ { first_name: "", last_name: "" },+ "Unknown",+ ],+ ])("renders %s", (_label, user, expected) => {+ expect(userDisplayName(user)).toBe(expected);+ });+});diff --git a/products/desktop/packages/ui/src/features/canvas/utils/userDisplay.ts b/products/desktop/packages/ui/src/features/canvas/utils/userDisplay.tsindex 9eaf539f88ea..ae40a5b09566 100644--- a/products/desktop/packages/ui/src/features/canvas/utils/userDisplay.ts+++ b/products/desktop/packages/ui/src/features/canvas/utils/userDisplay.ts@@ -1,12 +1,9 @@-import type { UserBasic } from "@posthog/shared/domain-types";+import type { UserLike } from "@posthog/core/auth/userInitials";-/**- * Display name for a task/thread author's `UserBasic`, shared by the channel- * feed and the thread panel. Avatar initials come from the app-wide- * `getUserInitials` (`@posthog/ui/features/auth/userInitials`).- */-export function userDisplayName(user: UserBasic | null | undefined): string {+// Display name for a task/thread author, shared by the channel feed and the+// thread panel.+export function userDisplayName(user: UserLike | null | undefined): string {if (!user) return "Unknown";const name = [user.first_name, user.last_name].filter(Boolean).join(" ");- return name || user.email;+ return name || user.email || "Unknown";}diff --git a/products/desktop/packages/ui/src/features/inbox/components/ReviewerAvatar.test.tsx b/products/desktop/packages/ui/src/features/inbox/components/ReviewerAvatar.test.tsxnew file mode 100644index 000000000000..d9899df7145e--- /dev/null+++ b/products/desktop/packages/ui/src/features/inbox/components/ReviewerAvatar.test.tsx@@ -0,0 +1,23 @@+import { render, screen } from "@testing-library/react";+import { act } from "react";+import { describe, expect, it } from "vitest";+import { ReviewerAvatar } from "./ReviewerAvatar";++describe("ReviewerAvatar", () => {+ it.each([+ ["a first and last name", { name: "Ben W.", email: null }, "BW"],+ [+ "a many-word name",+ { name: "Ada Byron King Lovelace", email: null },+ "AL",+ ],+ ["a single-word name", { name: "Cher", email: null }, "C"],+ ["no name, an email", { name: null, email: "[email protected]" }, "BE"],+ ["no name and no email", { name: null, email: null }, "U"],+ ])("derives initials from %s", async (_label, props, expected) => {+ await act(async () => {+ render(<ReviewerAvatar seed="seed-1" {...props} />);+ });+ expect(screen.getByText(expected)).toBeTruthy();+ });+});diff --git a/products/desktop/packages/ui/src/features/inbox/components/ReviewerAvatar.tsx b/products/desktop/packages/ui/src/features/inbox/components/ReviewerAvatar.tsxindex 245038ca7a66..8026bb87b6ab 100644--- a/products/desktop/packages/ui/src/features/inbox/components/ReviewerAvatar.tsx+++ b/products/desktop/packages/ui/src/features/inbox/components/ReviewerAvatar.tsx@@ -1,7 +1,4 @@-import {- reviewerAvatarToneClass,- reviewerInitials,-} from "@posthog/core/inbox/artefacts";+import { UserAvatar } from "@posthog/ui/features/auth/UserAvatar";interface ReviewerAvatarProps {name?: string | null;@@ -11,32 +8,28 @@ interface ReviewerAvatarProps {className?: string;}-const SIZE_CLASS = {- sm: "h-5 w-5 text-[9px]",- md: "h-6 w-6 text-[10px]",-} as const;+const QUILL_SIZE = { sm: "xs", md: "sm" } as const;+// Adapts a teammate's flat display name onto the app-wide UserAvatar, which+// wants first/last for initials.export function ReviewerAvatar({name,email,seed,size = "md",- className = "",+ className,}: ReviewerAvatarProps) {- const initials = reviewerInitials(name, email);- const toneClass = reviewerAvatarToneClass(seed);-+ const parts = name?.trim().split(/\s+/).filter(Boolean) ?? [];return (- <span- className={[- "inline-flex shrink-0 items-center justify-center rounded-full font-semibold leading-none",- SIZE_CLASS[size],- toneClass,- className,- ].join(" ")}- aria-hidden- >- {initials}- </span>+ <UserAvatar+ user={{+ uuid: seed,+ email,+ first_name: parts[0],+ last_name: parts.length > 1 ? parts[parts.length - 1] : undefined,+ }}+ size={QUILL_SIZE[size]}+ className={className}+ />);}diff --git a/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayAuditLog.tsx b/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayAuditLog.tsxindex 38db67275346..8cac031ff642 100644--- a/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayAuditLog.tsx+++ b/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayAuditLog.tsx@@ -6,10 +6,10 @@ import {AUDIT_DECISION_LABELS,formatAuditTime,} from "@posthog/core/mcp-gateway/gatewayServers";+import { UserAvatar } from "@posthog/ui/features/auth/UserAvatar";import {gatewayUserName,RobotAvatar,- UserAvatar,} from "@posthog/ui/features/mcp-gateway/components/parts/avatars";import {AUDIT_PAGE_SIZE,@@ -256,7 +256,7 @@ function AuditRow({ event }: { event: McpAuditEvent }) {{agent ? (<RobotAvatar size="sm" />) : user ? (- <UserAvatar user={user} size="sm" />+ <UserAvatar user={user} size="xs" />) : null}<Text truncate className="text-xs">{agentdiff --git a/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayMemberDetail.tsx b/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayMemberDetail.tsxindex 8a83d0f258fa..192bd8756485 100644--- a/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayMemberDetail.tsx+++ b/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayMemberDetail.tsx@@ -1,9 +1,7 @@import { ArrowLeft, Plugs, Sliders } from "@phosphor-icons/react";import { formatAgo } from "@posthog/core/mcp-gateway/gatewayServers";-import {- gatewayUserName,- UserAvatar,-} from "@posthog/ui/features/mcp-gateway/components/parts/avatars";+import { UserAvatar } from "@posthog/ui/features/auth/UserAvatar";+import { gatewayUserName } from "@posthog/ui/features/mcp-gateway/components/parts/avatars";import type { GatewayRoute } from "@posthog/ui/features/mcp-gateway/gatewayRoute";import { useGatewayMembers } from "@posthog/ui/features/mcp-gateway/hooks/useGatewayMembers";import { useGatewayServers } from "@posthog/ui/features/mcp-gateway/hooks/useGatewayServers";diff --git a/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayServerDetail.tsx b/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayServerDetail.tsxindex 9c37909860c4..935a8b0d13cf 100644--- a/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayServerDetail.tsx+++ b/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayServerDetail.tsx@@ -30,11 +30,11 @@ import {} from "@posthog/core/mcp-gateway/gatewayServers";import { usableInstallationId } from "@posthog/core/mcp-gateway/gatewayToolDiscovery";import { useOptionalAuthenticatedClient } from "@posthog/ui/features/auth/authClient";+import { UserAvatar } from "@posthog/ui/features/auth/UserAvatar";import { useCurrentUser } from "@posthog/ui/features/auth/useCurrentUser";import {gatewayUserName,RobotAvatar,- UserAvatar,} from "@posthog/ui/features/mcp-gateway/components/parts/avatars";import { GatewayConnectDialog } from "@posthog/ui/features/mcp-gateway/components/parts/GatewayConnectDialog";import { GatewayDeleteServerDialog } from "@posthog/ui/features/mcp-gateway/components/parts/GatewayDeleteServerDialog";@@ -878,7 +878,7 @@ function AccessSection({accessRevoked ? "bg-gray-2 opacity-60" : ""}`}>- <UserAvatar user={connection.user} />+ <UserAvatar user={connection.user} size="sm" /><Flex direction="column" className="min-w-0 flex-1"><Flex align="center" gap="2"><Text truncate className="font-medium text-sm">diff --git a/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayTeamView.tsx b/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayTeamView.tsxindex 51783bcfa56e..aa42a3e415c2 100644--- a/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayTeamView.tsx+++ b/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/GatewayTeamView.tsx@@ -4,10 +4,10 @@ import type {McpGatewayServer,McpServiceAccount,} from "@posthog/api-client/posthog-client";+import { UserAvatar } from "@posthog/ui/features/auth/UserAvatar";import {gatewayUserName,RobotAvatar,- UserAvatar,} from "@posthog/ui/features/mcp-gateway/components/parts/avatars";import type { GatewayRoute } from "@posthog/ui/features/mcp-gateway/gatewayRoute";import { useGatewayMembers } from "@posthog/ui/features/mcp-gateway/hooks/useGatewayMembers";@@ -223,9 +223,9 @@ function MemberRow({<buttontype="button"onClick={onOpen}- className="grid w-full grid-cols-[26px_1fr_auto_auto_auto] items-center gap-3 border-gray-5 border-b px-3 py-2 text-left transition-colors last:border-b-0 hover:bg-gray-3"+ className="grid w-full grid-cols-[24px_1fr_auto_auto_auto] items-center gap-3 border-gray-5 border-b px-3 py-2 text-left transition-colors last:border-b-0 hover:bg-gray-3">- <UserAvatar user={member.user} />+ <UserAvatar user={member.user} size="sm" /><Flex direction="column" className="min-w-0"><Text truncate className="font-medium text-sm">{gatewayUserName(member.user)}diff --git a/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/avatars.tsx b/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/avatars.tsxindex 017e5f0da752..d02c4934debc 100644--- a/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/avatars.tsx+++ b/products/desktop/packages/ui/src/features/mcp-gateway/components/parts/avatars.tsx@@ -1,6 +1,7 @@import { Robot } from "@phosphor-icons/react";import type { McpGatewayUser } from "@posthog/api-client/posthog-client";-import { Avatar, Flex } from "@radix-ui/themes";+import { Avatar, AvatarFallback, AvatarGroup, cn } from "@posthog/quill";+import { UserAvatar } from "@posthog/ui/features/auth/UserAvatar";export function gatewayUserName(user: McpGatewayUser): string {const name = [user.first_name, user.last_name]@@ -10,97 +11,26 @@ export function gatewayUserName(user: McpGatewayUser): string {return name || user.email;}-function initialsOf(user: McpGatewayUser): string {- const parts = [user.first_name, user.last_name].filter(- (part): part is string => !!part,- );- if (parts.length) {- return parts- .map((part) => part[0])- .join("")- .slice(0, 2)- .toUpperCase();- }- return user.email.slice(0, 2).toUpperCase();-}--const USER_AVATAR_COLORS = [- "amber",- "blue",- "cyan",- "green",- "indigo",- "orange",- "pink",- "purple",- "teal",-] as const;--// Keep a stable color for each member while staying inside the Radix theme-// palette rather than synthesizing colors outside the design system.-function avatarColorOf(- user: McpGatewayUser,-): (typeof USER_AVATAR_COLORS)[number] {- const seed = user.uuid || user.email;- let hash = 0;- for (let i = 0; i < seed.length; i++) {- hash = (hash * 31 + seed.charCodeAt(i)) | 0;- }- return (- USER_AVATAR_COLORS[(hash >>> 0) % USER_AVATAR_COLORS.length] ?? "amber"- );-}--const AVATAR_SIZES = {- sm: { radix: "1", pixels: 20 },- md: { radix: "2", pixels: 26 },- lg: { radix: "3", pixels: 40 },+const ROBOT_SIZES = {+ sm: { quill: "xs", icon: 12 },+ md: { quill: "sm", icon: 14 },+ lg: { quill: "lg", icon: 22 },} as const;-export function UserAvatar({- user,- size = "md",- className,-}: {- user: McpGatewayUser;- size?: keyof typeof AVATAR_SIZES;- className?: string;-}) {- const avatarSize = AVATAR_SIZES[size];- return (- <Avatar- fallback={initialsOf(user)}- color={avatarColorOf(user)}- radius="full"- size={avatarSize.radix}- title={gatewayUserName(user)}- className={`shrink-0 font-semibold ${className ?? ""}`}- style={{- width: avatarSize.pixels,- height: avatarSize.pixels,- fontSize: Math.round(avatarSize.pixels * 0.38),- }}- />- );-}-export function RobotAvatar({size = "md",className,}: {- size?: keyof typeof AVATAR_SIZES;+ size?: keyof typeof ROBOT_SIZES;className?: string;}) {- const avatarSize = AVATAR_SIZES[size];+ const avatarSize = ROBOT_SIZES[size];return (- <Avatar- fallback={<Robot size={Math.round(avatarSize.pixels * 0.62)} />}- color="gray"- radius="medium"- size={avatarSize.radix}- className={`shrink-0 ${className ?? ""}`}- style={{ width: avatarSize.pixels, height: avatarSize.pixels }}- />+ <Avatar size={avatarSize.quill} className={cn("shrink-0", className)}>+ <AvatarFallback>+ <Robot size={avatarSize.icon} />+ </AvatarFallback>+ </Avatar>);}@@ -114,24 +44,22 @@ export function AvatarStack({const shown = users.slice(0, max);const extra = users.length - shown.length;return (- <Flex align="center" className="-space-x-1">+ <AvatarGroup stacked size="xs">{shown.map((user) => (<UserAvatarkey={user.uuid || user.email}user={user}- size="sm"- className="ring-(--gray-1) ring-1"+ size="xs"+ title={gatewayUserName(user)}/>))}{extra > 0 && (- <Flex- align="center"- justify="center"- className="h-[20px] w-[20px] shrink-0 rounded-full bg-gray-4 font-medium text-[9px] text-gray-11 ring-(--gray-1) ring-1"- >- +{extra}- </Flex>+ <Avatar size="xs">+ <AvatarFallback className="font-medium text-[9px]">+ +{extra}+ </AvatarFallback>+ </Avatar>)}- </Flex>+ </AvatarGroup>);}diff --git a/products/desktop/packages/ui/src/features/settings/components/SettingsPanel.tsx b/products/desktop/packages/ui/src/features/settings/components/SettingsPanel.tsxindex 8259d14c3bb9..4c7c84605dd5 100644--- a/products/desktop/packages/ui/src/features/settings/components/SettingsPanel.tsx+++ b/products/desktop/packages/ui/src/features/settings/components/SettingsPanel.tsx@@ -23,13 +23,13 @@ import {TreeStructure,Wrench,} from "@phosphor-icons/react";-import { Avatar, AvatarFallback, Input, MenuLabel } from "@posthog/quill";+import { Input, MenuLabel } from "@posthog/quill";import { BILLING_FLAG } from "@posthog/shared";import { useOptionalAuthenticatedClient } from "@posthog/ui/features/auth/authClient";import { useAuthStateValue } from "@posthog/ui/features/auth/store";+import { UserAvatar } from "@posthog/ui/features/auth/UserAvatar";import { useLogoutMutation } from "@posthog/ui/features/auth/useAuthMutations";import { useCurrentUser } from "@posthog/ui/features/auth/useCurrentUser";-import { getUserInitials } from "@posthog/ui/features/auth/userInitials";import { useChannelsLayout } from "@posthog/ui/features/canvas/hooks/useChannelsLayout";import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";import { SettingsPageContent } from "@posthog/ui/features/settings/components/SettingsPageContent";@@ -187,8 +187,6 @@ export function SettingsPanel({(item) => item.id === activeSidebarCategory,)?.icon;- const initials = getUserInitials(user);-return (<divclassName="flex h-full w-full bg-(--color-background)"@@ -199,9 +197,7 @@ export function SettingsPanel({{isAuthenticated && user && (<div className="flex items-center gap-3 border-b border-b-(--gray-5) px-3 py-3">- <Avatar size="default">- <AvatarFallback>{initials}</AvatarFallback>- </Avatar>+ <UserAvatar user={user} /><div className="flex min-w-0 flex-col"><span className="truncate font-medium text-sm">{user.email}</span></div>diff --git a/products/desktop/packages/ui/src/features/settings/sections/AccountSettings.tsx b/products/desktop/packages/ui/src/features/settings/sections/AccountSettings.tsxdeleted file mode 100644index a5e4838c8f19..000000000000--- a/products/desktop/packages/ui/src/features/settings/sections/AccountSettings.tsx+++ /dev/null@@ -1,81 +0,0 @@-import { SignOut } from "@phosphor-icons/react";-import { formatRegionBadge } from "@posthog/shared";-import { useOptionalAuthenticatedClient } from "@posthog/ui/features/auth/authClient";-import { useAuthStateValue } from "@posthog/ui/features/auth/store";-import { useLogoutMutation } from "@posthog/ui/features/auth/useAuthMutations";-import { useCurrentUser } from "@posthog/ui/features/auth/useCurrentUser";-import { getUserInitials } from "@posthog/ui/features/auth/userInitials";-import { Avatar, Badge, Button, Flex, Spinner, Text } from "@radix-ui/themes";--export function AccountSettings() {- const isAuthenticated = useAuthStateValue(- (state) => state.status === "authenticated",- );- const cloudRegion = useAuthStateValue((state) => state.cloudRegion);- const logoutMutation = useLogoutMutation();- const client = useOptionalAuthenticatedClient();- const { data: user, isLoading } = useCurrentUser({- client,- enabled: isAuthenticated,- });-- const handleLogout = () => {- logoutMutation.mutate();- };-- if (!isAuthenticated) {- return (- <Flex direction="column" gap="3" py="4">- <Text color="gray" className="text-sm">- You are not currently authenticated. Please sign in from the main- screen.- </Text>- </Flex>- );- }-- if (isLoading || !user) {- return (- <Flex direction="column" gap="3" py="4">- <Spinner size="3" />- </Flex>- );- }-- const initials = getUserInitials(user);-- return (- <Flex direction="column">- <Flex align="center" gap="4" py="4">- <Avatar size="4" fallback={initials} radius="full" color="amber" />- <Flex direction="column" gap="1" className="flex-1">- <Text className="font-medium text-base">- {user.first_name && user.last_name- ? `${user.first_name} ${user.last_name}`- : user.email}- </Text>- <Flex align="center" gap="2">- <Text color="gray" className="text-sm">- {user.email}- </Text>- {cloudRegion && (- <Badge size="1" variant="soft">- {formatRegionBadge(cloudRegion)}- </Badge>- )}- </Flex>- </Flex>- <Button- variant="outline"- color="red"- size="1"- onClick={handleLogout}- className="cursor-pointer"- >- <SignOut size={14} />- Sign out- </Button>- </Flex>- </Flex>- );-}