mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 10:30:04 +01:00
43c278d813
* Privacy - Allow users to set a custom RPC from the onboarding process (#16767) * Privacy - Allow adding custom IPFS from onboarding (#16782) * Privacy - Show default selected network after a custom network has been added during onboarding * WIP: Show dropdown list of networks * Add network switcher to the onboarding advanced privacy screen * Fix duplicate imports * Provide default for networks * Update ui/helpers/utils/ipfs.js Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> * Fix lint * Remove unwanted changes * Fix lint Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { useSelector } from 'react-redux';
|
|
import { useHistory } from 'react-router-dom';
|
|
import NetworksForm from '../networks-form';
|
|
import NetworksList from '../networks-list';
|
|
import { getProvider } from '../../../../selectors';
|
|
|
|
import {
|
|
DEFAULT_ROUTE,
|
|
NETWORKS_ROUTE,
|
|
} from '../../../../helpers/constants/routes';
|
|
|
|
const NetworksTabContent = ({
|
|
networkDefaultedToProvider,
|
|
networkIsSelected,
|
|
networksToRender,
|
|
selectedNetwork,
|
|
shouldRenderNetworkForm,
|
|
}) => {
|
|
const provider = useSelector(getProvider);
|
|
const history = useHistory();
|
|
|
|
return (
|
|
<>
|
|
<NetworksList
|
|
networkDefaultedToProvider={networkDefaultedToProvider}
|
|
networkIsSelected={networkIsSelected}
|
|
networksToRender={networksToRender}
|
|
selectedRpcUrl={selectedNetwork.rpcUrl}
|
|
/>
|
|
{shouldRenderNetworkForm ? (
|
|
<NetworksForm
|
|
isCurrentRpcTarget={provider.rpcUrl === selectedNetwork.rpcUrl}
|
|
networksToRender={networksToRender}
|
|
selectedNetwork={selectedNetwork}
|
|
submitCallback={() => history.push(DEFAULT_ROUTE)}
|
|
cancelCallback={() => history.push(NETWORKS_ROUTE)}
|
|
/>
|
|
) : null}
|
|
</>
|
|
);
|
|
};
|
|
NetworksTabContent.propTypes = {
|
|
networkDefaultedToProvider: PropTypes.bool,
|
|
networkIsSelected: PropTypes.bool,
|
|
networksToRender: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
selectedNetwork: PropTypes.object,
|
|
shouldRenderNetworkForm: PropTypes.bool.isRequired,
|
|
};
|
|
|
|
export default NetworksTabContent;
|