Skip to content

Commit f8904b2

Browse files
committed
Rename connected/UsersAvatar to AccountAvatar
1 parent 735390f commit f8904b2

12 files changed

Lines changed: 44 additions & 44 deletions

File tree

src/components/Avatar/connected/AccountAvatar.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type {ValueOf} from 'type-fest';
1313

1414
import React from 'react';
1515

16-
type UserAvatarProps = {
16+
type AccountAvatarProps = {
1717
/** Account ID of the user to display the avatar for */
1818
accountID: number;
1919

@@ -31,10 +31,10 @@ type UserAvatarProps = {
3131
};
3232

3333
/**
34-
* Renders a single user's avatar, resolving the icon from the personal-details context (zero Onyx subscriptions).
35-
* Use whenever exactly one user is rendered.
34+
* Renders a single account's avatar, resolving the icon from the personal-details context (zero Onyx subscriptions).
35+
* Use whenever exactly one account is rendered. Pass `Avatar/UserAvatar` a `source` instead when the avatar is already resolved.
3636
*/
37-
function UserAvatar({accountID, size = CONST.AVATAR_SIZE.DEFAULT, shouldShowTooltip = true, fallbackDisplayName, containerStyle}: UserAvatarProps) {
37+
function AccountAvatar({accountID, size = CONST.AVATAR_SIZE.DEFAULT, shouldShowTooltip = true, fallbackDisplayName, containerStyle}: AccountAvatarProps) {
3838
const personalDetails = usePersonalDetails();
3939
const defaultAvatars = useDefaultAvatars();
4040
const StyleUtils = useStyleUtils();
@@ -52,4 +52,4 @@ function UserAvatar({accountID, size = CONST.AVATAR_SIZE.DEFAULT, shouldShowTool
5252
);
5353
}
5454

55-
export default UserAvatar;
55+
export default AccountAvatar;

src/components/SelectionList/ListItem/TableListItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import UserAvatar from '@components/Avatar/connected/UserAvatar';
1+
import AccountAvatar from '@components/Avatar/connected/AccountAvatar';
22
import TextWithTooltip from '@components/TextWithTooltip';
33

44
import useAnimatedHighlightStyle from '@hooks/useAnimatedHighlightStyle';
@@ -53,7 +53,7 @@ function TableListItem<TItem extends ListItem>({
5353
const rowContent = () => (
5454
<>
5555
{!!item.accountID && (
56-
<UserAvatar
56+
<AccountAvatar
5757
accountID={item.accountID}
5858
fallbackDisplayName={item.text ?? item.alternateText ?? undefined}
5959
shouldShowTooltip={showTooltip}

src/components/Tables/AgentsTable/AgentsTableRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import UserAvatar from '@components/Avatar/connected/UserAvatar';
1+
import AccountAvatar from '@components/Avatar/connected/AccountAvatar';
22
import Button from '@components/ButtonComposed';
33
import Icon from '@components/Icon';
44
import type {TableRow} from '@components/Table';
@@ -67,7 +67,7 @@ export default function AgentsTableRow({item, rowIndex, shouldUseNarrowTableLayo
6767
style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}
6868
{...getCellAccessibilityProps(isTableSemanticsEnabled)}
6969
>
70-
<UserAvatar
70+
<AccountAvatar
7171
size={avatarSize}
7272
accountID={item.accountID}
7373
fallbackDisplayName={item.displayName}

src/components/Tables/DomainAdminsTable/DomainAdminsTableRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import UserAvatar from '@components/Avatar/connected/UserAvatar';
1+
import AccountAvatar from '@components/Avatar/connected/AccountAvatar';
22
import Badge from '@components/Badge';
33
import Icon from '@components/Icon';
44
import Table from '@components/Table';
@@ -62,7 +62,7 @@ export default function DomainAdminsTableRow({item, rowIndex, shouldUseNarrowTab
6262
style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}
6363
{...getCellAccessibilityProps(isTableSemanticsEnabled)}
6464
>
65-
<UserAvatar
65+
<AccountAvatar
6666
size={avatarSize}
6767
accountID={item.accountID}
6868
fallbackDisplayName={item.name}

src/components/Tables/DomainMembersTable/DomainMembersTableRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import UserAvatar from '@components/Avatar/connected/UserAvatar';
1+
import AccountAvatar from '@components/Avatar/connected/AccountAvatar';
22
import Icon from '@components/Icon';
33
import Table from '@components/Table';
44
import {getCellAccessibilityProps, shouldUseTableSemantics} from '@components/Table/tableAccessibility';
@@ -66,7 +66,7 @@ export default function DomainMembersTableRow({item, rowIndex, shouldUseNarrowTa
6666
style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}
6767
{...getCellAccessibilityProps(isTableSemanticsEnabled)}
6868
>
69-
<UserAvatar
69+
<AccountAvatar
7070
size={avatarSize}
7171
accountID={item.accountID}
7272
fallbackDisplayName={item.name}

src/components/Tables/ReportParticipantsTable/ReportParticipantsTableRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import UserAvatar from '@components/Avatar/connected/UserAvatar';
1+
import AccountAvatar from '@components/Avatar/connected/AccountAvatar';
22
import Icon from '@components/Icon';
33
import Table from '@components/Table';
44
import {getCellAccessibilityProps, shouldUseTableSemantics} from '@components/Table/tableAccessibility';
@@ -59,7 +59,7 @@ export default function ReportParticipantsTableRow({item, rowIndex, shouldUseNar
5959
style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}
6060
{...getCellAccessibilityProps(isTableSemanticsEnabled)}
6161
>
62-
<UserAvatar
62+
<AccountAvatar
6363
size={avatarSize}
6464
accountID={item.accountID}
6565
fallbackDisplayName={item.name ?? item.email}

src/components/Tables/RoomMembersTable/RoomMembersTableRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import UserAvatar from '@components/Avatar/connected/UserAvatar';
1+
import AccountAvatar from '@components/Avatar/connected/AccountAvatar';
22
import Icon from '@components/Icon';
33
import Table from '@components/Table';
44
import TextWithTooltip from '@components/TextWithTooltip';
@@ -48,7 +48,7 @@ export default function RoomMembersTableRow({item, rowIndex}: RoomMembersTableRo
4848
{({hovered}) => (
4949
<>
5050
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter, styles.gap1]}>
51-
<UserAvatar
51+
<AccountAvatar
5252
accountID={item.accountID}
5353
fallbackDisplayName={item.name ?? item.email}
5454
/>

src/components/Tables/WorkspaceMembersTable/WorkspaceMembersTableRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import UserAvatar from '@components/Avatar/connected/UserAvatar';
1+
import AccountAvatar from '@components/Avatar/connected/AccountAvatar';
22
import Icon from '@components/Icon';
33
import Table from '@components/Table';
44
import {getCellAccessibilityProps, shouldUseTableSemantics} from '@components/Table/tableAccessibility';
@@ -69,7 +69,7 @@ export default function WorkspaceMembersTableRow({item, rowIndex, shouldShowCust
6969
style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}
7070
{...getCellAccessibilityProps(isTableSemanticsEnabled)}
7171
>
72-
<UserAvatar
72+
<AccountAvatar
7373
size={avatarSize}
7474
accountID={item.accountID}
7575
fallbackDisplayName={item.name ?? item.email}

src/pages/home/report/ConciergeThinkingMessage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import UserAvatar from '@components/Avatar/connected/UserAvatar';
1+
import AccountAvatar from '@components/Avatar/connected/AccountAvatar';
22
import Icon from '@components/Icon';
33
import OfflineWithFeedback from '@components/OfflineWithFeedback';
44
import {PressableWithoutFeedback} from '@components/Pressable';
@@ -177,7 +177,7 @@ function ConciergeThinkingMessageContent({accountID, reasoningHistory, statusLab
177177
</PressableWithoutFeedback>
178178
</UserDetailsTooltip>
179179
) : (
180-
<UserAvatar
180+
<AccountAvatar
181181
containerStyle={styles.actionAvatar}
182182
shouldShowTooltip
183183
accountID={accountID}

tests/unit/ConciergeThinkingMessageAvatarTest.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ import Onyx from 'react-native-onyx';
1010
import {createAdminRoom, createAnnounceRoom} from '../utils/collections/reports';
1111
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';
1212

13-
// Capture props passed to UserAvatar (only rendered for non-Concierge agents).
13+
// Capture props passed to AccountAvatar (only rendered for non-Concierge agents).
1414
let mockCapturedAvatarProps: Record<string, unknown> = {};
1515

16-
jest.mock('@components/Avatar/connected/UserAvatar', () => {
16+
jest.mock('@components/Avatar/connected/AccountAvatar', () => {
1717
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1818
const {View} = require('react-native');
1919
return (props: Record<string, unknown>) => {
2020
mockCapturedAvatarProps = props;
21-
return <View testID="MockedUserAvatar" />;
21+
return <View testID="MockedAccountAvatar" />;
2222
};
2323
});
2424

25-
// Concierge renders a branded Lottie animation instead of UserAvatar; stub it so the test
25+
// Concierge renders a branded Lottie animation instead of AccountAvatar; stub it so the test
2626
// doesn't pull in Lottie and so we can assert it rendered.
2727
jest.mock('@pages/home/report/ConciergeAnimatedAvatar', () => {
2828
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
@@ -110,18 +110,18 @@ afterEach(() => {
110110

111111
describe('ConciergeThinkingMessage avatar prop integration', () => {
112112
describe('Concierge bubble', () => {
113-
test('should render the animated avatar (not UserAvatar) in admin room', () => {
113+
test('should render the animated avatar (not AccountAvatar) in admin room', () => {
114114
render(<ConciergeThinkingMessage reportID={mockAdminRoom.reportID} />);
115115

116116
expect(screen.getByTestId('MockedConciergeAnimatedAvatar')).toBeTruthy();
117-
expect(screen.queryByTestId('MockedUserAvatar')).toBeNull();
117+
expect(screen.queryByTestId('MockedAccountAvatar')).toBeNull();
118118
});
119119

120-
test('should render the animated avatar (not UserAvatar) in announce room', () => {
120+
test('should render the animated avatar (not AccountAvatar) in announce room', () => {
121121
render(<ConciergeThinkingMessage reportID={mockAnnounceRoom.reportID} />);
122122

123123
expect(screen.getByTestId('MockedConciergeAnimatedAvatar')).toBeTruthy();
124-
expect(screen.queryByTestId('MockedUserAvatar')).toBeNull();
124+
expect(screen.queryByTestId('MockedAccountAvatar')).toBeNull();
125125
});
126126
});
127127

@@ -130,14 +130,14 @@ describe('ConciergeThinkingMessage avatar prop integration', () => {
130130
mockCandidateAgentIDs = [customAgentAccountID];
131131
});
132132

133-
test('should render UserAvatar (not the Concierge animation)', () => {
133+
test('should render AccountAvatar (not the Concierge animation)', () => {
134134
render(<ConciergeThinkingMessage reportID={mockAdminRoom.reportID} />);
135135

136-
expect(screen.getByTestId('MockedUserAvatar')).toBeTruthy();
136+
expect(screen.getByTestId('MockedAccountAvatar')).toBeTruthy();
137137
expect(screen.queryByTestId('MockedConciergeAnimatedAvatar')).toBeNull();
138138
});
139139

140-
test('should pass accountID=agentAccountID to UserAvatar', () => {
140+
test('should pass accountID=agentAccountID to AccountAvatar', () => {
141141
render(<ConciergeThinkingMessage reportID={mockAdminRoom.reportID} />);
142142

143143
expect(mockCapturedAvatarProps.accountID).toBe(customAgentAccountID);

0 commit comments

Comments
 (0)