Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: don't always show install button on mobile
  • Loading branch information
Jwhiles committed Jan 7, 2025
commit 1819f9c1addc39559a6f43bb471d6eef5c230be1
13 changes: 9 additions & 4 deletions src/components/Faucet/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,18 @@ export default function Hero({
projects,
walletAuthUrl,
} = useContext(MetamaskProviderContext);

const isMobile = sdk.platformManager.isMobile()
const isExtensionActive = sdk.isExtensionActive();

const showInstallButton = !isExtensionActive && !isMobile;

const [isWalletLinking, setIsWalletLinking] = useState(false);

const handleConnectWallet = () => {
setIsWalletLinking(true);
trackClickForSegment({
eventName: !isExtensionActive ? "Install MetaMask" : "Connect MetaMask",
eventName: showInstallButton ? "Install MetaMask" : "Connect MetaMask",
clickType: "Hero",
userExperience: "B",
responseStatus: null,
Expand Down Expand Up @@ -95,7 +100,7 @@ export default function Hero({
className,
)}
>
{!(isExtensionActive && metaMaskAccount) && <EthIcon />}
{!(!showInstallButton && metaMaskAccount) && <EthIcon />}
<Text as="h1">
<span>
{network === "linea" && "Linea Sepolia"}
Expand All @@ -104,7 +109,7 @@ export default function Hero({
</span>
</Text>
<Text as="p">
{!isExtensionActive
{showInstallButton
? "Install MetaMask for your browser to get started and request ETH."
: !Object.keys(projects).length
? walletLinked === undefined
Expand Down Expand Up @@ -139,7 +144,7 @@ export default function Hero({
!!Object.keys(projects).length && styles.alignedButtons,
)}
>
{!isExtensionActive ? (
{showInstallButton ? (
<Button
testId="hero-cta-install-metamask"
className={styles.button}
Expand Down
Loading