Skip to content

Commit

Permalink
Merge branch 'master' into @esteban/custom-chain-notification
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobar79 authored Dec 20, 2023
2 parents be42b46 + d42ab14 commit b4772b8
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/entries/popup/pages/settings/rpcs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ export function SettingsNetworksRPCs() {

const handleRemoveRPC = useCallback(
(chain: Chain) => {
const allChainsCount = [...mainnetChains, ...testnetChains].length;
removeCustomRPC({
rpcUrl: chain.rpcUrls.default.http[0],
});
// If there's no default chain & only had one chain, go back
const allChainsCount = [...mainnetChains, ...testnetChains].length;
if (!supportedChain && allChainsCount === 1) {
navigate(-1);
}
Expand All @@ -207,8 +207,9 @@ export function SettingsNetworksRPCs() {
removeRainbowChainAssets({ chainId });
});
}
navigate(-1);
},
[rainbowChains, removeCustomRPC, removeRainbowChainAssets],
[navigate, rainbowChains, removeCustomRPC, removeRainbowChainAssets],
);

return (
Expand All @@ -231,7 +232,7 @@ export function SettingsNetworksRPCs() {
onToggle={() => handleToggleChain(!userChains[chainId])}
/>
</Menu>
{supportedChain || mainnetChains.length ? (
{supportedChain || mainnetChains?.length ? (
<Menu>
<MenuItem.Description
text={i18n.t('settings.networks.rpc_endpoints')}
Expand Down Expand Up @@ -359,7 +360,7 @@ export function SettingsNetworksRPCs() {
/>
</Menu>
)}
{developerToolsEnabled && testnetChains.length ? (
{developerToolsEnabled && testnetChains?.length ? (
<Menu>
<MenuItem.Description text={i18n.t('settings.networks.testnets')} />
<Box paddingHorizontal="1px" paddingVertical="1px">
Expand Down Expand Up @@ -408,14 +409,14 @@ export function SettingsNetworksRPCs() {
</Menu>
) : null}

{featureFlags.custom_rpc && customNetworkAssetsForChain.length ? (
<Menu>
<Box padding="20px">
<Stack space="14px">
<Text align="left" color="label" size="14pt" weight="medium">
{i18n.t('settings.networks.custom_rpc.tokens')}
</Text>

{featureFlags.custom_rpc &&
Object.values(customNetworkAssetsForChain || {}).length ? (
<Menu>
<Box padding="20px">
<Stack space="14px">
<Text align="left" color="label" size="14pt" weight="medium">
{i18n.t('settings.networks.custom_rpc.tokens')}
</Text>
<Box width="full">
{customNetworkAssetsForChain?.map((asset, i) => (
<ContextMenu key={i}>
Expand Down

0 comments on commit b4772b8

Please sign in to comment.