Skip to content

Commit 73c5dec

Browse files
committed
extract constant
1 parent c74d2d3 commit 73c5dec

File tree

4 files changed

+8
-27
lines changed

4 files changed

+8
-27
lines changed

ui/components/app/assets/asset-list/cells/asset-title.tsx

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import {
3-
Display,
43
FontWeight,
54
TextVariant,
65
} from '../../../../../helpers/constants/design-system';
@@ -10,7 +9,6 @@ import {
109
networkTitleOverrides,
1110
} from '../../util/networkTitleOverrides';
1211
import { useI18nContext } from '../../../../../hooks/useI18nContext';
13-
import Tooltip from '../../../../ui/tooltip';
1412

1513
type AssetCellTitleProps = {
1614
title: string;
@@ -19,27 +17,6 @@ type AssetCellTitleProps = {
1917
export const AssetCellTitle = ({ title }: AssetCellTitleProps) => {
2018
const t = useI18nContext();
2119

22-
if (false &&title && title.length > 12) {
23-
return (
24-
<Tooltip
25-
position="bottom"
26-
html={title}
27-
wrapperClassName="token-cell-title--ellipsis"
28-
>
29-
<Text
30-
as="span"
31-
data-testid="multichain-token-list-item-token-name"
32-
fontWeight={FontWeight.Medium}
33-
variant={TextVariant.bodyMd}
34-
display={Display.Block}
35-
ellipsis
36-
>
37-
{networkTitleOverrides(t as TranslateFunction, { title })}
38-
</Text>
39-
</Tooltip>
40-
);
41-
}
42-
4320
// non-ellipsized title
4421
return (
4522
<Text

ui/components/app/assets/asset-list/cells/generic-asset-cell-layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
BlockSize,
77
JustifyContent,
88
} from '../../../../../helpers/constants/design-system';
9+
import { ASSET_CELL_HEIGHT } from '../../constants';
910

1011
type GenericAssetCellLayoutProps = {
1112
onClick?: () => void;
@@ -54,7 +55,7 @@ export default function GenericAssetCellLayout({
5455
paddingRight={4}
5556
width={BlockSize.Full}
5657
style={{
57-
height: 62,
58+
height: ASSET_CELL_HEIGHT,
5859
cursor: onClick ? 'pointer' : 'auto',
5960
backgroundColor:
6061
!disableHover && isHovered

ui/components/app/assets/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ export const ACCOUNT_TYPE_LABELS: Partial<Record<KeyringAccountType, string>> =
99
[BtcAccountType.P2wpkh]: 'Native SegWit',
1010
[BtcAccountType.P2tr]: 'Taproot',
1111
};
12+
13+
export const ASSET_CELL_HEIGHT = 62;

ui/components/app/assets/token-list/token-list.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React, { useContext, useEffect, useMemo, useRef } from 'react';
1+
import React, { useContext, useEffect, useMemo } from 'react';
22
import { useSelector } from 'react-redux';
33
import { type CaipChainId, type Hex } from '@metamask/utils';
44
import { NON_EVM_TESTNET_IDS } from '@metamask/multichain-network-controller';
55
import { useVirtualizer } from '@tanstack/react-virtual';
66
import TokenCell from '../token-cell';
7+
import { ASSET_CELL_HEIGHT } from '../constants';
78
import {
89
getEnabledNetworksByNamespace,
910
getIsMultichainAccountsState2Enabled,
@@ -150,8 +151,8 @@ function TokenList({ onTokenClick, safeChains }: TokenListProps) {
150151

151152
const virtualizer = useVirtualizer({
152153
count: sortedFilteredTokens.length,
153-
getScrollElement: () => scrollContainerRef.current,
154-
estimateSize: () => 62, // TokenCell height from generic-asset-cell-layout.tsx
154+
getScrollElement: () => scrollContainerRef?.current || null,
155+
estimateSize: () => ASSET_CELL_HEIGHT,
155156
overscan: 5,
156157
});
157158

0 commit comments

Comments
 (0)