mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
UX: Remove Portfolio from Token Overview Page (#19988)
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
This commit is contained in:
parent
47fe542273
commit
0ba409662e
@ -28,7 +28,6 @@ import { INVALID_ASSET_TYPE } from '../../../helpers/constants/error-keys';
|
||||
import { showModal } from '../../../store/actions';
|
||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||
import {
|
||||
MetaMetricsContextProp,
|
||||
MetaMetricsEventCategory,
|
||||
MetaMetricsEventName,
|
||||
MetaMetricsSwapsEventSource,
|
||||
@ -36,12 +35,7 @@ import {
|
||||
import { AssetType } from '../../../../shared/constants/transaction';
|
||||
import useRamps from '../../../hooks/experiences/useRamps';
|
||||
|
||||
import {
|
||||
ButtonIcon,
|
||||
ButtonIconSize,
|
||||
Icon,
|
||||
IconName,
|
||||
} from '../../component-library';
|
||||
import { Icon, IconName } from '../../component-library';
|
||||
import { IconColor } from '../../../helpers/constants/design-system';
|
||||
|
||||
import { getPortfolioUrl } from '../../../helpers/utils/portfolio';
|
||||
@ -93,34 +87,6 @@ const TokenOverview = ({ className, token }) => {
|
||||
displayValue={balanceToRender}
|
||||
suffix={token.symbol}
|
||||
/>
|
||||
<ButtonIcon
|
||||
className="token-overview__portfolio-button"
|
||||
data-testid="home__portfolio-site"
|
||||
color={IconColor.primaryDefault}
|
||||
iconName={IconName.Diagram}
|
||||
ariaLabel={t('portfolio')}
|
||||
size={ButtonIconSize.Lg}
|
||||
onClick={() => {
|
||||
const portfolioUrl = getPortfolioUrl('', 'ext', metaMetricsId);
|
||||
global.platform.openTab({
|
||||
url: portfolioUrl,
|
||||
});
|
||||
trackEvent(
|
||||
{
|
||||
category: MetaMetricsEventCategory.Home,
|
||||
event: MetaMetricsEventName.PortfolioLinkClicked,
|
||||
properties: {
|
||||
url: portfolioUrl,
|
||||
},
|
||||
},
|
||||
{
|
||||
contextPropsIntoEventProperties: [
|
||||
MetaMetricsContextProp.PageTitle,
|
||||
],
|
||||
},
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{formattedFiatBalance ? (
|
||||
<CurrencyDisplay
|
||||
|
@ -233,48 +233,6 @@ describe('TokenOverview', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should always show the Portfolio button', () => {
|
||||
const mockToken = {
|
||||
name: 'test',
|
||||
isERC721: false,
|
||||
address: '0x7ceb23fd6bc0add59e62ac25578270cff1B9f619',
|
||||
symbol: 'test',
|
||||
};
|
||||
const { queryByTestId } = renderWithProvider(
|
||||
<TokenOverview token={mockToken} />,
|
||||
store,
|
||||
);
|
||||
const portfolioButton = queryByTestId('home__portfolio-site');
|
||||
expect(portfolioButton).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should open the Portfolio URI when clicking on Portfolio button', async () => {
|
||||
const mockToken = {
|
||||
name: 'test',
|
||||
isERC721: false,
|
||||
address: '0x7ceb23fd6bc0add59e62ac25578270cff1B9f619',
|
||||
symbol: 'test',
|
||||
};
|
||||
const { queryByTestId } = renderWithProvider(
|
||||
<TokenOverview token={mockToken} />,
|
||||
store,
|
||||
);
|
||||
|
||||
const portfolioButton = queryByTestId('home__portfolio-site');
|
||||
|
||||
expect(portfolioButton).toBeInTheDocument();
|
||||
expect(portfolioButton).not.toBeDisabled();
|
||||
|
||||
fireEvent.click(portfolioButton);
|
||||
expect(openTabSpy).toHaveBeenCalledTimes(1);
|
||||
|
||||
await waitFor(() =>
|
||||
expect(openTabSpy).toHaveBeenCalledWith({
|
||||
url: expect.stringContaining(`?metamaskEntry=ext`),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('should show the Bridge button if chain id and token are supported', async () => {
|
||||
const mockToken = {
|
||||
name: 'test',
|
||||
|
Loading…
Reference in New Issue
Block a user