1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/ui/pages/settings/networks-tab/networks-tab-subheader/networks-tab-subheader.js
ryanml 6c84e9604c
Enable "Add Popular Network" feature by default for all users (#16172)
* Enable "Add Popular Network" feature by default

* Fixing e2e tests

* Attempt to fix e2e tests

* Revert "Attempt to fix e2e tests"

This reverts commit d88e8944b8df8f7c3075753f8d8b3480439f8e30.

* Get e2e tests passing

Co-authored-by: Dan J Miller <danjm.com@gmail.com>
2022-10-27 07:55:30 -02:30

45 lines
1.4 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { useHistory } from 'react-router-dom';
import { useI18nContext } from '../../../../hooks/useI18nContext';
import { ADD_POPULAR_CUSTOM_NETWORK } from '../../../../helpers/constants/routes';
import Button from '../../../../components/ui/button';
const NetworksFormSubheader = ({ addNewNetwork }) => {
const t = useI18nContext();
const history = useHistory();
return addNewNetwork ? (
<div className="networks-tab__subheader">
<span className="networks-tab__sub-header-text">{t('networks')}</span>
<span className="networks-tab__sub-header-text">{' > '}</span>
<div className="networks-tab__sub-header-text">{t('addANetwork')}</div>
<span>{' > '}</span>
<div className="networks-tab__subheader--break">
{t('addANetworkManually')}
</div>
</div>
) : (
<div className="settings-page__sub-header">
<span className="settings-page__sub-header-text">{t('networks')}</span>
<div className="networks-tab__add-network-header-button-wrapper">
<Button
type="primary"
onClick={(event) => {
event.preventDefault();
history.push(ADD_POPULAR_CUSTOM_NETWORK);
}}
>
{t('addANetwork')}
</Button>
</div>
</div>
);
};
NetworksFormSubheader.propTypes = {
addNewNetwork: PropTypes.bool.isRequired,
};
export default NetworksFormSubheader;