From 8498f9c2525b4fde618904adf0225cbb6422b8f5 Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:06:49 -0700 Subject: [PATCH] feat: hide switch text no connected address --- packages/widget/src/components/ui/ChainOption.tsx | 11 ++++++----- .../widget/src/components/ui/ChainPopoverSelect.tsx | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/widget/src/components/ui/ChainOption.tsx b/packages/widget/src/components/ui/ChainOption.tsx index d10d56533c..bb68fc0df6 100644 --- a/packages/widget/src/components/ui/ChainOption.tsx +++ b/packages/widget/src/components/ui/ChainOption.tsx @@ -17,9 +17,10 @@ export const ChainOption = ({ }) => { const web3Context = useContext(Web3Context) - const { - web3Provider: { networkId }, - } = web3Context + const { web3Provider } = web3Context || {} + + const networkId = web3Provider?.networkId + const connectedAddress = web3Provider?.connectedAddress return (
  • - ) : ( + ) : connectedAddress ? ( Switch - ))} + ) : null)}
  • ) } diff --git a/packages/widget/src/components/ui/ChainPopoverSelect.tsx b/packages/widget/src/components/ui/ChainPopoverSelect.tsx index 204e6054ce..c5d8b941f9 100644 --- a/packages/widget/src/components/ui/ChainPopoverSelect.tsx +++ b/packages/widget/src/components/ui/ChainPopoverSelect.tsx @@ -84,7 +84,7 @@ export const ChainPopoverSelect = ({ {`${selected?.name} )}