1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

UX: Remove portfolio from global menu (#20221)

* UX: Remove portfolio from global menu

* Remove unused locale string

* Code-fence the metaMetricsId
This commit is contained in:
David Walsh 2023-07-27 11:35:27 -05:00 committed by GitHub
parent e5ec12027e
commit cd68bf9d09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 53 deletions

View File

@ -3248,9 +3248,6 @@
"portfolioDashboard": {
"message": "Portfolio Dashboard"
},
"portfolioView": {
"message": "Portfolio view"
},
"preferredLedgerConnectionType": {
"message": "Preferred Ledger connection type",
"description": "A header for a dropdown in Settings > Advanced. Appears above the ledgerConnectionPreferenceDescription message"

View File

@ -33,9 +33,6 @@ import {
MetaMetricsEventCategory,
MetaMetricsContextProp,
} from '../../../../shared/constants/metametrics';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import { getPortfolioUrl } from '../../../helpers/utils/portfolio';
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
import {
getMmiPortfolioEnabled,
@ -43,7 +40,9 @@ import {
} from '../../../selectors/institutional/selectors';
///: END:ONLY_INCLUDE_IN
import {
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
getMetaMetricsId,
///: END:ONLY_INCLUDE_IN(build-mmi)
getSelectedAddress,
///: BEGIN:ONLY_INCLUDE_IN(snaps)
getUnreadNotificationsCount,
@ -69,13 +68,13 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
const dispatch = useDispatch();
const trackEvent = useContext(MetaMetricsContext);
const history = useHistory();
const metaMetricsId = useSelector(getMetaMetricsId);
const address = useSelector(getSelectedAddress);
const hasUnapprovedTransactions = useSelector(
(state) => Object.keys(state.metamask.unapprovedTxs).length > 0,
);
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
const metaMetricsId = useSelector(getMetaMetricsId);
const mmiPortfolioUrl = useSelector(getMmiPortfolioUrl);
const mmiPortfolioEnabled = useSelector(getMmiPortfolioEnabled);
///: END:ONLY_INCLUDE_IN
@ -145,40 +144,6 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
)
///: END:ONLY_INCLUDE_IN
}
{
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
<MenuItem
iconName={IconName.Diagram}
onClick={() => {
const portfolioUrl = getPortfolioUrl('', 'ext', metaMetricsId);
global.platform.openTab({
url: portfolioUrl,
});
trackEvent(
{
category: MetaMetricsEventCategory.Home,
event: MetaMetricsEventName.PortfolioLinkClicked,
properties: {
url: portfolioUrl,
location: METRICS_LOCATION,
},
},
{
contextPropsIntoEventProperties: [
MetaMetricsContextProp.PageTitle,
],
},
);
closeMenu();
}}
data-testid="global-menu-portfolio"
>
{t('portfolioView')}
</MenuItem>
///: END:ONLY_INCLUDE_IN
}
{getEnvironmentType() === ENVIRONMENT_TYPE_FULLSCREEN ? null : (
<MenuItem
iconName={IconName.Expand}

View File

@ -33,18 +33,6 @@ describe('AccountListItem', () => {
});
});
it('opens the portfolio site when item is clicked', async () => {
global.platform = { openTab: jest.fn() };
const { getByTestId } = render();
fireEvent.click(getByTestId('global-menu-portfolio'));
await waitFor(() => {
expect(global.platform.openTab).toHaveBeenCalledWith({
url: `/?metamaskEntry=ext&metametricsId=`,
});
});
});
it('opens the support site when item is clicked', async () => {
global.platform = { openTab: jest.fn() };