Skip to content

Commit 1ca6538

Browse files
authored
fix: multichain site tooltip (#37957)
## **Description** 1. Restores the user's preferred avatar in the site cell tooltip that was hardcoded to Jazzicon in [this PR](#37510) 2. Uses the correct seed address ## **Changelog** CHANGELOG entry: fix: multichain site toolip ## **Related issues** Fixes: ## **Manual testing steps** 1. Connect to dApp 2. Menu > All permissions 4. Click on connected site ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <img width="259" height="278" alt="image" src="https://github.com/user-attachments/assets/485ecde0-c926-474d-a324-c097afda794a" /> ### **After** <img width="169" height="200" alt="image" src="https://github.com/user-attachments/assets/42513df8-b346-4f48-9c43-0c6c05113e28" /> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Restores preferred avatar variant and uses the correct seed address for account avatars in the multichain site tooltip. > > - **UI (Multichain site tooltip)** > - Selects preferred avatar variant via `getAvatarType` and passes it to `TooltipContent`. > - Uses `seedAddresses[acc.id]` for `AvatarAccount` `address` and replaces hardcoded `Jazzicon` with the selected `variant`. > - Plumbs `seedAddresses` and `avatarAccountVariant` through tooltip props; updates avatar rendering for account list accordingly. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit aa8309f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent e2a2da5 commit 1ca6538

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

ui/components/multichain-accounts/multichain-site-cell/tool-tip/multichain-site-cell-tooltip.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
MultichainAvatarGroupType,
3434
} from '../avatar-group/multichain-avatar-group';
3535
import { getIconSeedAddressesByAccountGroups } from '../../../../selectors/multichain-accounts/account-tree';
36+
import { getAvatarType } from '../../../app/preferred-avatar/preferred-avatar';
3637

3738
export type MultichainSiteCellTooltipProps = {
3839
accountGroups?: AccountGroupWithInternalAccounts[];
@@ -47,10 +48,19 @@ type TooltipContentProps = {
4748
networks?: EvmAndMultichainNetworkConfigurationsWithCaipChainId[];
4849
moreAccountsText?: string;
4950
moreNetworksText?: string;
51+
avatarAccountVariant?: AvatarAccountVariant;
52+
seedAddresses?: Record<string, string>;
5053
};
5154

5255
const TooltipContent = React.memo<TooltipContentProps>(
53-
({ accountGroups, networks, moreAccountsText, moreNetworksText }) => {
56+
({
57+
accountGroups,
58+
networks,
59+
moreAccountsText,
60+
moreNetworksText,
61+
avatarAccountVariant,
62+
seedAddresses,
63+
}) => {
5464
const displayAccountGroups = accountGroups?.slice(0, TOOLTIP_LIMIT) ?? [];
5565
const displayNetworks = networks?.slice(0, TOOLTIP_LIMIT) ?? [];
5666
const hasMoreAccounts =
@@ -77,8 +87,8 @@ const TooltipContent = React.memo<TooltipContentProps>(
7787
>
7888
<AvatarAccount
7989
size={AvatarAccountSize.Xs}
80-
address={acc.id}
81-
variant={AvatarAccountVariant.Jazzicon}
90+
address={seedAddresses?.[acc.id] ?? ''}
91+
variant={avatarAccountVariant}
8292
/>
8393
<Text
8494
color={TextColor.overlayInverse}
@@ -166,6 +176,7 @@ TooltipContent.displayName = 'TooltipContent';
166176
export const MultichainSiteCellTooltip =
167177
React.memo<MultichainSiteCellTooltipProps>(({ accountGroups, networks }) => {
168178
const t = useI18nContext();
179+
const avatarAccountVariant = useSelector(getAvatarType);
169180

170181
const seedAddresses = useSelector((state: MultichainAccountsState) =>
171182
getIconSeedAddressesByAccountGroups(state, accountGroups ?? []),
@@ -225,6 +236,8 @@ export const MultichainSiteCellTooltip =
225236
networks={networks}
226237
moreAccountsText={moreAccountsText}
227238
moreNetworksText={moreNetworksText}
239+
avatarAccountVariant={avatarAccountVariant}
240+
seedAddresses={seedAddresses}
228241
/>
229242
}
230243
arrow

0 commit comments

Comments
 (0)