Skip to content

Commit 4c8cb35

Browse files
authored
fix: don't show 'install MetaMask' when inside app (#1844)
1 parent e918e75 commit 4c8cb35

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/NavbarWallet/index.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ const NavbarWalletComponent: FC = ({
4949
} = useContext(MetamaskProviderContext);
5050
const [dropdownOpen, setDropdownOpen] = useState(false);
5151
const [copyMessage, setCopyMessage] = useState(COPY_TEXT);
52+
53+
const isMobile = sdk.platformManager?.isMobile ?? false;
5254
const isExtensionActive = sdk.isExtensionActive();
55+
const showInstallButton = !isExtensionActive && !isMobile;
56+
5357
const dialogRef = useRef<HTMLUListElement>(null);
5458
const buttonRef = useRef<HTMLButtonElement>(null);
5559
const [userAccount, setUserAccount] = useState(
@@ -119,7 +123,7 @@ const NavbarWalletComponent: FC = ({
119123

120124
const handleConnectWallet = () => {
121125
trackClickForSegment({
122-
eventName: !isExtensionActive ? "Install MetaMask" : "Connect Wallet",
126+
eventName: showInstallButton ? "Install MetaMask" : "Connect Wallet",
123127
clickType: "Navbar",
124128
userExperience: "B",
125129
responseStatus: null,
@@ -142,15 +146,15 @@ const NavbarWalletComponent: FC = ({
142146
return !userAccount ? (
143147
<Button
144148
testId={
145-
!isExtensionActive
149+
showInstallButton
146150
? "navbar-cta-install-metamask"
147151
: "navbar-cta-connect-wallet"
148152
}
149153
thin
150154
onClick={handleConnectWallet}
151155
className={styles.navbarButton}
152156
>
153-
{!isExtensionActive ? "Install MetaMask" : "Connect MetaMask"}
157+
{showInstallButton ? "Install MetaMask" : "Connect MetaMask"}
154158
</Button>
155159
) : (
156160
<div className={styles.navbarWallet}>

0 commit comments

Comments
 (0)