diff --git a/packages/nextjs/components/scaffold-stark/CustomConnectButton/AddressInfoDropdown.tsx b/packages/nextjs/components/scaffold-stark/CustomConnectButton/AddressInfoDropdown.tsx index 2b614d60..7f3ab65a 100644 --- a/packages/nextjs/components/scaffold-stark/CustomConnectButton/AddressInfoDropdown.tsx +++ b/packages/nextjs/components/scaffold-stark/CustomConnectButton/AddressInfoDropdown.tsx @@ -15,6 +15,7 @@ import { useOutsideClick } from "~~/hooks/scaffold-stark"; import { getTargetNetworks } from "~~/utils/scaffold-stark"; import { Address } from "@starknet-react/chains"; import { useDisconnect } from "@starknet-react/core"; +import { usePathname } from "next/navigation"; const allowedNetworks = getTargetNetworks(); @@ -32,17 +33,25 @@ export const AddressInfoDropdown = ({ blockExplorerAddressLink, }: AddressInfoDropdownProps) => { const { disconnect } = useDisconnect(); + const location = usePathname(); const [addressCopied, setAddressCopied] = useState(false); - const [selectingNetwork, setSelectingNetwork] = useState(false); const dropdownRef = useRef(null); + const closeDropdown = () => { setSelectingNetwork(false); dropdownRef.current?.removeAttribute("open"); }; + useOutsideClick(dropdownRef, closeDropdown); + const handleDisconnect = () => { + if (location === "/myNFTs") { + disconnect(); + } + }; + return ( <>
@@ -135,7 +144,7 @@ export const AddressInfoDropdown = ({