From c4bed0891dc039c674e0d0af48196540f45b5d4d Mon Sep 17 00:00:00 2001 From: Corantin Date: Mon, 23 Sep 2024 13:22:25 -0400 Subject: [PATCH] Add picture only connect button !ai --- apps/web/app/(app)/gardens/page.tsx | 2 +- apps/web/components/ConnectWalletButton.tsx | 58 +++++----- apps/web/components/Modal.tsx | 2 +- apps/web/components/NavBar.tsx | 117 +++++++------------- 4 files changed, 69 insertions(+), 110 deletions(-) diff --git a/apps/web/app/(app)/gardens/page.tsx b/apps/web/app/(app)/gardens/page.tsx index ccea2d846..5eec7e0f5 100644 --- a/apps/web/app/(app)/gardens/page.tsx +++ b/apps/web/app/(app)/gardens/page.tsx @@ -80,7 +80,7 @@ export default function Page() { return ( <> -
+
diff --git a/apps/web/components/ConnectWalletButton.tsx b/apps/web/components/ConnectWalletButton.tsx index 8ed387c52..cbf22a5e2 100644 --- a/apps/web/components/ConnectWalletButton.tsx +++ b/apps/web/components/ConnectWalletButton.tsx @@ -2,6 +2,7 @@ import React, { Fragment } from "react"; import { Menu, Transition } from "@headlessui/react"; +import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; import { ChevronUpIcon, PowerIcon } from "@heroicons/react/24/solid"; import { ConnectButton } from "@rainbow-me/rainbowkit"; import cn from "classnames"; @@ -42,14 +43,12 @@ export function ConnectWallet() { return ( - {({ - account: accountAddress, - chain, - openConnectModal, - mounted, - }) => { + {({ account: accountAddress, chain, openConnectModal, mounted }) => { const ready = mounted; const connected = ready && accountAddress && chain; + const isWrongNetwork = + chain?.id != urlChainId && urlChainId && !isNaN(urlChainId); + return ( <> {(() => { @@ -64,7 +63,7 @@ export function ConnectWallet() { width={20} loading="lazy" /> - Connect wallet + Connect wallet ); } @@ -89,19 +88,22 @@ export function ConnectWallet() { <>
- {"Chain -
+ {isWrongNetwork ? + + : {"Chain + } +
{formatAddress(accountAddress.address)}
@@ -160,18 +162,16 @@ export function ConnectWallet() { {/* Switch network and Disconnect buttons */} - {chain.id !== urlChainId && - urlChainId && - !isNaN(urlChainId) && ( - - )} + {isWrongNetwork && ( + + )}