mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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:
parent
e5ec12027e
commit
cd68bf9d09
3
app/_locales/en/messages.json
generated
3
app/_locales/en/messages.json
generated
@ -3248,9 +3248,6 @@
|
|||||||
"portfolioDashboard": {
|
"portfolioDashboard": {
|
||||||
"message": "Portfolio Dashboard"
|
"message": "Portfolio Dashboard"
|
||||||
},
|
},
|
||||||
"portfolioView": {
|
|
||||||
"message": "Portfolio view"
|
|
||||||
},
|
|
||||||
"preferredLedgerConnectionType": {
|
"preferredLedgerConnectionType": {
|
||||||
"message": "Preferred Ledger connection type",
|
"message": "Preferred Ledger connection type",
|
||||||
"description": "A header for a dropdown in Settings > Advanced. Appears above the ledgerConnectionPreferenceDescription message"
|
"description": "A header for a dropdown in Settings > Advanced. Appears above the ledgerConnectionPreferenceDescription message"
|
||||||
|
@ -33,9 +33,6 @@ import {
|
|||||||
MetaMetricsEventCategory,
|
MetaMetricsEventCategory,
|
||||||
MetaMetricsContextProp,
|
MetaMetricsContextProp,
|
||||||
} from '../../../../shared/constants/metametrics';
|
} 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)
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
||||||
import {
|
import {
|
||||||
getMmiPortfolioEnabled,
|
getMmiPortfolioEnabled,
|
||||||
@ -43,7 +40,9 @@ import {
|
|||||||
} from '../../../selectors/institutional/selectors';
|
} from '../../../selectors/institutional/selectors';
|
||||||
///: END:ONLY_INCLUDE_IN
|
///: END:ONLY_INCLUDE_IN
|
||||||
import {
|
import {
|
||||||
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
||||||
getMetaMetricsId,
|
getMetaMetricsId,
|
||||||
|
///: END:ONLY_INCLUDE_IN(build-mmi)
|
||||||
getSelectedAddress,
|
getSelectedAddress,
|
||||||
///: BEGIN:ONLY_INCLUDE_IN(snaps)
|
///: BEGIN:ONLY_INCLUDE_IN(snaps)
|
||||||
getUnreadNotificationsCount,
|
getUnreadNotificationsCount,
|
||||||
@ -69,13 +68,13 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const trackEvent = useContext(MetaMetricsContext);
|
const trackEvent = useContext(MetaMetricsContext);
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const metaMetricsId = useSelector(getMetaMetricsId);
|
|
||||||
const address = useSelector(getSelectedAddress);
|
const address = useSelector(getSelectedAddress);
|
||||||
|
|
||||||
const hasUnapprovedTransactions = useSelector(
|
const hasUnapprovedTransactions = useSelector(
|
||||||
(state) => Object.keys(state.metamask.unapprovedTxs).length > 0,
|
(state) => Object.keys(state.metamask.unapprovedTxs).length > 0,
|
||||||
);
|
);
|
||||||
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
||||||
|
const metaMetricsId = useSelector(getMetaMetricsId);
|
||||||
const mmiPortfolioUrl = useSelector(getMmiPortfolioUrl);
|
const mmiPortfolioUrl = useSelector(getMmiPortfolioUrl);
|
||||||
const mmiPortfolioEnabled = useSelector(getMmiPortfolioEnabled);
|
const mmiPortfolioEnabled = useSelector(getMmiPortfolioEnabled);
|
||||||
///: END:ONLY_INCLUDE_IN
|
///: END:ONLY_INCLUDE_IN
|
||||||
@ -145,40 +144,6 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
|||||||
)
|
)
|
||||||
///: END:ONLY_INCLUDE_IN
|
///: 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 : (
|
{getEnvironmentType() === ENVIRONMENT_TYPE_FULLSCREEN ? null : (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
iconName={IconName.Expand}
|
iconName={IconName.Expand}
|
||||||
|
@ -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 () => {
|
it('opens the support site when item is clicked', async () => {
|
||||||
global.platform = { openTab: jest.fn() };
|
global.platform = { openTab: jest.fn() };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user