π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π style(user): draw pixel avatars for people without a profile image (#21632)
LiJianf212efe2ad00
diff --git a/src/components/UserAvatar/index.tsx b/src/components/UserAvatar/index.tsxnew file mode 100644index 00000000000..2092b600fac--- /dev/null+++ b/src/components/UserAvatar/index.tsx@@ -0,0 +1,33 @@+'use client';++import { memo } from 'react';++import Avatar, { type AvatarProps } from '@/components/Avatar';++export interface UserAvatarProps extends Omit<AvatarProps, 'avatar' | 'name'> {+ /** Profile image URL (or emoji). Empty draws the generated fallback. */+ avatar?: string | null;+ /** Display name: seeds the generated fallback and labels the image. */+ name?: string | null;+}++/**+ * A person's avatar. Without a profile image it draws the pixel-style avatar+ * `@lobehub/ui` generates from the name, so people read apart from agents and+ * projects, whose image-less fallback is the smooth gradient.+ */+const UserAvatar = memo<UserAvatarProps>(+ ({ avatar, fallbackVariant = 'pixel', name, title, ...rest }) => (+ <Avatar+ {...rest}+ avatar={avatar || undefined}+ fallbackVariant={fallbackVariant}+ name={name || undefined}+ title={title ?? (name || undefined)}+ />+ ),+);++UserAvatar.displayName = 'UserAvatar';++export default UserAvatar;diff --git a/src/features/AgentTasks/features/AssigneeMemberSelector.tsx b/src/features/AgentTasks/features/AssigneeMemberSelector.tsxindex 6f5f880042b..1e1436109c4 100644--- a/src/features/AgentTasks/features/AssigneeMemberSelector.tsx+++ b/src/features/AgentTasks/features/AssigneeMemberSelector.tsx@@ -8,7 +8,7 @@ import { useTranslation } from 'react-i18next';import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';import { useFetchWorkspaceMembers } from '@/business/client/hooks/useFetchWorkspaceMembers';import { useWorkspaceMembers } from '@/business/client/hooks/useWorkspaceMembers';-import Avatar from '@/components/Avatar';+import UserAvatar from '@/components/UserAvatar';import NavItem from '@/features/NavPanel/components/NavItem';import SkeletonList from '@/features/NavPanel/components/SkeletonList';import { usePermission } from '@/hooks/usePermission';@@ -245,8 +245,8 @@ const AssigneeMemberSelector = memo<AssigneeMemberSelectorProps>(title={member ? memberName(member) : unassignedLabel}icon={member ? (- <Avatar- avatar={member.user?.avatar || undefined}+ <UserAvatar+ avatar={member.user?.avatar}name={memberName(member)}shape={'circle'}size={22}diff --git a/src/features/AgentTasks/features/AssigneeUserAvatar.tsx b/src/features/AgentTasks/features/AssigneeUserAvatar.tsxindex ddbf59ad989..f1b0191442a 100644--- a/src/features/AgentTasks/features/AssigneeUserAvatar.tsx+++ b/src/features/AgentTasks/features/AssigneeUserAvatar.tsx@@ -2,7 +2,7 @@ import { Center, cssVar, Icon, Tooltip } from '@lobehub/ui';import { CircleUser } from 'lucide-react';import { memo } from 'react';-import Avatar from '@/components/Avatar';+import UserAvatar from '@/components/UserAvatar';import { useUserDisplayMeta } from '../shared/useUserDisplayMeta';@@ -33,12 +33,11 @@ const AssigneeUserAvatar = memo<AssigneeUserAvatarProps>(({ userId, size = 18, t}const avatar = (- <Avatar- avatar={displayMeta.avatar || undefined}- name={displayMeta.title || undefined}+ <UserAvatar+ avatar={displayMeta.avatar}+ name={displayMeta.title}shape={'circle'}size={size}- title={displayMeta.title || undefined}variant={'outlined'}/>);diff --git a/src/features/CommunityWorkspaceSettings/index.tsx b/src/features/CommunityWorkspaceSettings/index.tsxindex 33fa64f99b7..88cbb4f9955 100644--- a/src/features/CommunityWorkspaceSettings/index.tsx+++ b/src/features/CommunityWorkspaceSettings/index.tsx@@ -3,7 +3,6 @@import { OFFICIAL_URL } from '@lobechat/const';import { Block, Center, createStaticStyles, cssVar, Flexbox, Icon, Tooltip } from '@lobehub/ui';import {- Avatar,Button,Input,Table,@@ -47,6 +46,7 @@ import {updateCommunityWorkspaceProfile,} from '@/business/client/services/communityWorkspaceProfile';import EmojiPicker from '@/components/EmojiPicker';+import UserAvatar from '@/components/UserAvatar';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import { usePermission } from '@/hooks/usePermission';import { useFileStore } from '@/store/file';@@ -194,7 +194,7 @@ const MembersCard = memo<{ canManage: boolean }>(({ canManage }) => {return (<Flexbox horizontal align="center" gap={12}>- <Avatar avatar={member.avatarUrl || undefined} size={36} title={name} />+ <UserAvatar avatar={member.avatarUrl} name={name} size={36} /><Flexbox gap={2}>{profileUrl ? (<adiff --git a/src/features/DeviceManager/DeviceActivity/RunningUsers.tsx b/src/features/DeviceManager/DeviceActivity/RunningUsers.tsxindex f38f3d6df70..6b1ff9a65fa 100644--- a/src/features/DeviceManager/DeviceActivity/RunningUsers.tsx+++ b/src/features/DeviceManager/DeviceActivity/RunningUsers.tsx@@ -1,12 +1,12 @@'use client';-import { DEFAULT_USER_AVATAR_URL } from '@lobechat/const';import type { DeviceEnroller } from '@lobechat/types';-import { Avatar, createStaticStyles, cssVar, Flexbox, Icon, Text, Tooltip } from '@lobehub/ui';+import { createStaticStyles, cssVar, Flexbox, Icon, Text, Tooltip } from '@lobehub/ui';import { TriangleAlertIcon } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';+import UserAvatar from '@/components/UserAvatar';import RunningGlyph from '@/features/Home/components/RunningGlyph';import { useClientDataSWR } from '@/libs/swr';import { deviceService } from '@/services/device';@@ -42,9 +42,10 @@ const userName = (user: DeviceEnroller) => user.fullName || user.username || '';export const RunUserAvatar = memo<{ className?: string; size?: number; user: DeviceEnroller }>(({ className, size = 20, user }) => (<Tooltip title={userName(user)}>- <Avatar- avatar={user.avatar || DEFAULT_USER_AVATAR_URL}+ <UserAvatar+ avatar={user.avatar}className={className}+ name={userName(user)}shape={'circle'}size={size}style={{ flex: 'none' }}diff --git a/src/features/DeviceManager/DeviceCard.tsx b/src/features/DeviceManager/DeviceCard.tsxindex bcba0f8312a..47f86665147 100644--- a/src/features/DeviceManager/DeviceCard.tsx+++ b/src/features/DeviceManager/DeviceCard.tsx@@ -3,7 +3,6 @@import type { DeviceListItem } from '@lobechat/types';import {ActionIcon,- Avatar,confirmModal,createStaticStyles,cssVar,@@ -26,6 +25,7 @@ import {import { memo, useRef } from 'react';import { useTranslation } from 'react-i18next';+import UserAvatar from '@/components/UserAvatar';import VisibilityConfirmContent from '@/features/VisibilityConfirmContent';import { useUserStore } from '@/store/user';import { userProfileSelectors } from '@/store/user/selectors';@@ -303,7 +303,7 @@ const DeviceCard = memo<DeviceCardProps>(({ device, isCurrent, onOpen }) => {// shared workspace pools. Hidden in personal scope (always the// caller) and for ghost rows (no row yet).<Tooltip title={t('workspaceSetting.devices.enrolledBy', { name: enrollerName })}>- <Avatar avatar={device.enroller.avatar ?? undefined} size={20} />+ <UserAvatar avatar={device.enroller.avatar} name={enrollerName} size={20} /></Tooltip>)}{canEdit && (diff --git a/src/features/DeviceManager/DeviceOverview.tsx b/src/features/DeviceManager/DeviceOverview.tsxindex 400bd089251..9e9f3089e66 100644--- a/src/features/DeviceManager/DeviceOverview.tsx+++ b/src/features/DeviceManager/DeviceOverview.tsx@@ -3,7 +3,6 @@import type { DeviceListItem, DeviceWorkspaceShare } from '@lobechat/types';import {ActionIcon,- Avatar,confirmModal,createStaticStyles,cssVar,@@ -39,6 +38,7 @@ import type { ReactNode } from 'react';import { useTranslation } from 'react-i18next';import SkeletonBar from '@/components/Skeleton/Bar';+import UserAvatar from '@/components/UserAvatar';import { createWorkspaceLambdaClient } from '@/libs/trpc/client';import { formatSize } from '@/utils/format';@@ -331,7 +331,7 @@ const DeviceOverview = ({ canOperate, device }: DeviceOverviewProps) => {</InfoRow>{device.scope === 'workspace' && device.enroller && (<InfoRow icon={UserIcon} label={t('workspaceSetting.devices.enrolledByLabel')}>- <Avatar avatar={device.enroller.avatar ?? undefined} size={20} />+ <UserAvatar avatar={device.enroller.avatar} name={enrollerName} size={20} /><Text ellipsis>{enrollerName}</Text></InfoRow>)}diff --git a/src/features/EnvironmentManager/EnvironmentDetailPanel.tsx b/src/features/EnvironmentManager/EnvironmentDetailPanel.tsxindex 60b2062d6c3..e1e70e6cc03 100644--- a/src/features/EnvironmentManager/EnvironmentDetailPanel.tsx+++ b/src/features/EnvironmentManager/EnvironmentDetailPanel.tsx@@ -3,7 +3,6 @@import { Github } from '@lobehub/icons';import {ActionIcon,- Avatar,createStaticStyles,cssVar,Flexbox,@@ -26,6 +25,8 @@ import {import { memo, useState } from 'react';import { useTranslation } from 'react-i18next';+import UserAvatar from '@/components/UserAvatar';+import EnvironmentForm, { type EnvironmentFormSection } from './EnvironmentForm';import PanelSection from './PanelSection';import { repositoryPath } from './repository';@@ -128,8 +129,7 @@ const EnvironmentDetailPanel = memo<EnvironmentDetailPanelProps>(({ environment,<Tag size={'small'}>{t('environments.visibility.publicTag')}</Tag>)}<Flexbox horizontal align={'center'} gap={6}>- {/* Name as the avatar value β see EnvironmentItem for why `title` alone does not reach the fallback text. */}- <Avatar avatar={environment.creator?.avatar || creator} size={16} title={creator} />+ <UserAvatar avatar={environment.creator?.avatar} name={creator} size={16} /><Text fontSize={12} type={'secondary'}>{creator}</Text>diff --git a/src/features/EnvironmentManager/EnvironmentItem.tsx b/src/features/EnvironmentManager/EnvironmentItem.tsxindex e1f261b0d7a..31f6dced47c 100644--- a/src/features/EnvironmentManager/EnvironmentItem.tsx+++ b/src/features/EnvironmentManager/EnvironmentItem.tsx@@ -2,7 +2,6 @@import { Github } from '@lobehub/icons';import {- Avatar,Button,confirmModal,createStaticStyles,@@ -20,6 +19,7 @@ import { EyeOffIcon, GlobeIcon, MoreHorizontalIcon, Trash2Icon } from 'lucide-reimport { memo } from 'react';import { useTranslation } from 'react-i18next';+import UserAvatar from '@/components/UserAvatar';import VisibilityConfirmContent from '@/features/VisibilityConfirmContent';import { describeError } from './errorMessage';@@ -262,14 +262,7 @@ const EnvironmentItem = memo<EnvironmentItemProps>(({ environment, onSelect, sel// gives with the enroller's avatar.<Tooltip title={t('environments.meta.creatorTooltip', { name: creator })}><span onClick={(event) => event.stopPropagation()}>- {/* The name is passed as the avatar itself, not only as- `title`. `Avatar` derives its fallback text from- `String(avatar)` first, so an undefined picture becomes the- literal string "undefined" and every author without one- renders the same "UN" β `title` never gets a turn. Since the- row carries no badge, that placeholder would be the only- thing left saying whose environment this is. */}- <Avatar avatar={environment.creator.avatar || creator} size={20} title={creator} />+ <UserAvatar avatar={environment.creator.avatar} name={creator} size={20} /></span></Tooltip>)}diff --git a/src/features/PageEditor/DocumentLikes/index.tsx b/src/features/PageEditor/DocumentLikes/index.tsxindex 8b1d21578cf..a345c8dd808 100644--- a/src/features/PageEditor/DocumentLikes/index.tsx+++ b/src/features/PageEditor/DocumentLikes/index.tsx@@ -1,22 +1,14 @@'use client';import type { DocumentLikeSummary } from '@lobechat/types';-import {- Avatar,- createStaticStyles,- cssVar,- Flexbox,- Skeleton,- Text,- toast,- Tooltip,-} from '@lobehub/ui';+import { createStaticStyles, cssVar, Flexbox, Skeleton, Text, toast, Tooltip } from '@lobehub/ui';import { ThumbsUp } from 'lucide-react';import { memo, useCallback, useRef } from 'react';import { useTranslation } from 'react-i18next';import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';import AsyncError from '@/components/AsyncError';+import UserAvatar from '@/components/UserAvatar';import { useClientDataSWR } from '@/libs/swr';import { documentLikeKeys } from '@/libs/swr/keys';import { documentLikeService } from '@/services/documentLike';@@ -267,7 +259,7 @@ const DocumentLikes = memo<{ documentId: string }>(({ documentId }) => {const name = liker.fullName || liker.username || liker.id;return (<Tooltip key={liker.id} title={name}>- <Avatar avatar={liker.avatar || name} size={32} />+ <UserAvatar avatar={liker.avatar} name={name} size={32} /></Tooltip>);})}diff --git a/src/features/Projects/Review/MemberRow.tsx b/src/features/Projects/Review/MemberRow.tsxindex 9b1b17419bf..592ff9ad034 100644--- a/src/features/Projects/Review/MemberRow.tsx+++ b/src/features/Projects/Review/MemberRow.tsx@@ -1,7 +1,8 @@import { PROJECT_MEMBER_ROLES, type ProjectMemberRole } from '@lobechat/types';-import { Avatar, Flexbox, Select, Text } from '@lobehub/ui';+import { Flexbox, Select, Text } from '@lobehub/ui';import { useTranslation } from 'react-i18next';+import UserAvatar from '@/components/UserAvatar';import type { ProjectMemberItem } from '@/services/projectReview';interface MemberRowProps {@@ -15,7 +16,7 @@ export function MemberRow({ busy, member, onRoleChange }: MemberRowProps) {const name = member.user?.name ?? member.userId;return (<Flexbox horizontal align="center" gap={12} paddingBlock={12} paddingInline={16}>- <Avatar avatar={member.user?.avatar || undefined} size={28} title={name} />+ <UserAvatar avatar={member.user?.avatar} name={name} size={28} /><Flexbox flex={1} style={{ minWidth: 0 }}><Text ellipsis>{name}</Text>{member.user?.email && name !== member.user.email && (diff --git a/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.test.tsx b/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.test.tsxindex ba0fa511678..5a48689bc41 100644--- a/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.test.tsx+++ b/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.test.tsx@@ -5,7 +5,11 @@ import FileListItem from './index';vi.mock('@lobehub/ui', async (importOriginal) => ({...(await importOriginal<object>()),- Avatar: ({ alt }: { alt: string }) => <span data-testid="avatar">{alt}</span>,+ Avatar: ({ alt, fallbackVariant }: { alt: string; fallbackVariant?: string }) => (+ <span data-fallback-variant={fallbackVariant} data-testid="avatar">+ {alt}+ </span>+ ),}));vi.mock('react-i18next', () => ({@@ -130,6 +134,12 @@ describe('FileListItem', () => {expect(screen.getByText('1.0 KB')).toBeInTheDocument();});+ it('draws the pixel avatar for an uploader without a profile image', () => {+ render(<FileListItem {...baseProps} />);++ expect(screen.getByTestId('avatar')).toHaveAttribute('data-fallback-variant', 'pixel');+ });+it('disables selection for rows the workspace member did not upload', () => {render(<FileListItem {...baseProps} selectable={false} />);diff --git a/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx b/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsxindex 50b93f1222a..d3143fd28d6 100644--- a/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx+++ b/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx@@ -1,5 +1,4 @@import {- Avatar,Center,Checkbox,ContextMenuTrigger,@@ -15,6 +14,7 @@ import { useTranslation } from 'react-i18next';import { shallow } from 'zustand/shallow';import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import UserAvatar from '@/components/UserAvatar';import { useResourceManagerStore } from '@/features/ResourceManager/store';import { isExplorerItemSelected } from '@/features/ResourceManager/store/selectors';import { fileManagerSelectors, getChunkTargetId, useFileStore } from '@/store/file';@@ -396,9 +396,9 @@ const FileListItem = ({{uploaderName ? (<Tooltip title={t('file:listView.uploadedBy', { name: uploaderName })}><Flexbox horizontal align={'center'} gap={8} style={{ minWidth: 0 }}>- <Avatar- alt={uploaderName}- avatar={uploader?.avatar || uploaderName}+ <UserAvatar+ avatar={uploader?.avatar}+ name={uploaderName}shape={'circle'}size={20}style={{ flexShrink: 0 }}diff --git a/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsx b/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsxindex 3bfd1fd949c..930d29526ea 100644--- a/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsx+++ b/src/features/ResourcePermission/Collaborators/AddCollaboratorsContent.tsx@@ -2,7 +2,6 @@import { MAX_RESOURCE_COLLABORATORS_PER_ADD } from '@lobechat/const';import {- Avatar,Button,createStaticStyles,cssVar,@@ -24,6 +23,7 @@ import { useTranslation } from 'react-i18next';import { useFetchWorkspaceMembers } from '@/business/client/hooks/useFetchWorkspaceMembers';import { useWorkspaceMembers } from '@/business/client/hooks/useWorkspaceMembers';+import UserAvatar from '@/components/UserAvatar';import type { PermissionResourceType, ResourceAccessLevel } from '@/services/resourcePermission';import { useResourceCollaborators } from '../useResourceCollaborators';@@ -136,12 +136,7 @@ const MemberRow = memo<{onToggle(member.userId);}}>- <Avatar- animation={isHovering}- avatar={member.user?.avatar || undefined}- size={40}- title={name}- />+ <UserAvatar animation={isHovering} avatar={member.user?.avatar} name={name} size={40} /><Flexbox flex={1} gap={2} style={{ minWidth: 0 }}><Text ellipsis weight={500}>{name}diff --git a/src/features/ResourcePermission/Collaborators/CollaboratorList.tsx b/src/features/ResourcePermission/Collaborators/CollaboratorList.tsxindex 7d525d0df75..7faa4539e77 100644--- a/src/features/ResourcePermission/Collaborators/CollaboratorList.tsx+++ b/src/features/ResourcePermission/Collaborators/CollaboratorList.tsx@@ -2,7 +2,6 @@import {ActionIcon,- Avatar,confirmModal,createStaticStyles,cssVar,@@ -17,6 +16,7 @@ import { memo } from 'react';import { useTranslation } from 'react-i18next';import AsyncError from '@/components/AsyncError';+import UserAvatar from '@/components/UserAvatar';import type { PermissionResourceType, ResourceCollaborator } from '@/services/resourcePermission';import { useAccessLevelOptions } from '../useAccessLevelOptions';@@ -90,7 +90,7 @@ const CollaboratorList = memo<CollaboratorListProps>(({ resourceId, resourceTypegap={12}key={collaborator.userId}>- <Avatar avatar={collaborator.user?.avatar || undefined} size={32} title={name} />+ <UserAvatar avatar={collaborator.user?.avatar} name={name} size={32} /><Flexbox flex={1} style={{ minWidth: 0 }}><Text ellipsis weight={500}>{name}diff --git a/src/features/SandboxDrive/UsageBreakdown.tsx b/src/features/SandboxDrive/UsageBreakdown.tsxindex f1952d4f792..cd788cd4a1c 100644--- a/src/features/SandboxDrive/UsageBreakdown.tsx+++ b/src/features/SandboxDrive/UsageBreakdown.tsx@@ -1,6 +1,6 @@'use client';-import { ActionIcon, Avatar, Button, Flexbox, Icon, Text, toast, Tooltip } from '@lobehub/ui';+import { ActionIcon, Button, Flexbox, Icon, Text, toast, Tooltip } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import type { LucideIcon } from 'lucide-react';@@ -10,6 +10,7 @@ import { useTranslation } from 'react-i18next';import RetainedMemberDrives from '@/business/client/features/RetainedMemberDrives';import SandboxStorageOverQuotaAction from '@/business/client/features/SandboxStorageOverQuotaAction';+import UserAvatar from '@/components/UserAvatar';import { formatSize } from '@/utils/format';import type { useDriveUsage } from './useDriveData';@@ -332,7 +333,7 @@ export const UsageBreakdown = memo<{flex={1}gap={8}>- <Avatar avatar={member.avatar || member.name || member.userId} size={22} />+ <UserAvatar avatar={member.avatar} name={member.name || member.userId} size={22} /><Text ellipsis fontSize={13}>{member.name || member.userId}</Text>diff --git a/src/features/TopicCreatorAvatar/index.tsx b/src/features/TopicCreatorAvatar/index.tsxindex 74130f0a877..9500973f327 100644--- a/src/features/TopicCreatorAvatar/index.tsx+++ b/src/features/TopicCreatorAvatar/index.tsx@@ -6,7 +6,7 @@ import { memo, type ReactNode } from 'react';import { useAuthorInfo } from '@/business/client/hooks/useAuthorInfo';import { useHasActiveWorkspace } from '@/business/client/hooks/useHasActiveWorkspace';-import Avatar from '@/components/Avatar';+import UserAvatar from '@/components/UserAvatar';/*** Prefer the bot-channel initiator over the account that owns the bot.@@ -52,13 +52,12 @@ const TopicCreatorAvatar = memo<TopicCreatorAvatarProps>(const avatar = (<Tooltip title={author.fullName}>- <Avatar- avatar={author.avatar ?? undefined}- name={author.fullName ?? undefined}+ <UserAvatar+ avatar={author.avatar}+ name={author.fullName}shape={'circle'}size={size}style={{ flex: 'none' }}- title={author.fullName ?? undefined}/></Tooltip>);diff --git a/src/features/User/UserAvatar.tsx b/src/features/User/UserAvatar.tsxindex 434eb3de28d..9c1be4d8a5a 100644--- a/src/features/User/UserAvatar.tsx+++ b/src/features/User/UserAvatar.tsx@@ -1,10 +1,12 @@'use client';import { BRANDING_NAME } from '@lobechat/business-const';-import { Avatar, type AvatarProps } from '@lobehub/ui';import { createStaticStyles, cssVar } from '@lobehub/ui';import { useMemo } from 'react';+import BaseUserAvatar, {+ type UserAvatarProps as BaseUserAvatarProps,+} from '@/components/UserAvatar';import { DEFAULT_USER_AVATAR_URL } from '@/const/meta';import { isDesktop } from '@/const/version';import { useElectronStore } from '@/store/electron';@@ -44,7 +46,7 @@ const styles = createStaticStyles(({ css }) => ({`,}));-export interface UserAvatarProps extends AvatarProps {+export interface UserAvatarProps extends BaseUserAvatarProps {/*** Override the avatar URL/emoji β used when the component is acting as a* generic "active identity" avatar (e.g. showing the active team workspace@@ -93,17 +95,19 @@ const UserAvatar = ({// mode (e.g. active team workspace). Stay inside that identity β don't fall// through to the signed-in user's avatar/name, or the icon and the label// will disagree. When `nameOverride` is absent, keep the original user flow.- const avatarValue = nameOverride- ? avatarOverride || nameOverride- : avatarOverride || userAvatarUrl || nickName || username;+ const avatarValue = nameOverride ? avatarOverride : avatarOverride || userAvatarUrl;+ const name = nameOverride || nickName || username;const altText = nameOverride || (isSignedIn ? nickName || username || 'User' : BRANDING_NAME);return (- <Avatar+ <BaseUserAvataralt={altText}avatar={avatarValue}background={background}className={clickable ? styles.clickable : className}+ // A workspace identity is not a person, so it keeps the gradient fallback.+ fallbackVariant={nameOverride ? 'marble' : 'pixel'}+ name={name}ref={ref}shape={'square'}size={size}diff --git a/src/features/User/__tests__/UserAvatar.test.tsx b/src/features/User/__tests__/UserAvatar.test.tsxindex 2faf19fd787..ee46f019c43 100644--- a/src/features/User/__tests__/UserAvatar.test.tsx+++ b/src/features/User/__tests__/UserAvatar.test.tsx@@ -40,6 +40,8 @@ describe('UserAvatar', () => {// labelled with the username, not an <img />const fallback = screen.getByRole('img', { name: mockUsername });expect(fallback.tagName.toLowerCase()).toBe('svg');+ // A person draws the pixel variant: a grid of 10Γ10 cells+ expect(fallback.querySelectorAll('rect[width="10"][height="10"]').length).toBeGreaterThan(0);expect(screen.queryByAltText(mockUsername)).not.toBeInTheDocument();});