diff --git a/client/src/ui/components/AccountDetails.tsx b/client/src/ui/components/AccountDetails.tsx index 9e5a287..78a885c 100644 --- a/client/src/ui/components/AccountDetails.tsx +++ b/client/src/ui/components/AccountDetails.tsx @@ -6,6 +6,8 @@ import DisconnectButton from "./DisconnectButton"; import useAccountCustom from "@/hooks/useAccountCustom"; import { useControllerUsername } from "@/hooks/useControllerUsername"; import { FaucetButton } from "./FaucetButton"; +import { Copy } from "lucide-react"; +import { useState } from "react"; const { VITE_PUBLIC_GAME_TOKEN_ADDRESS, VITE_PUBLIC_GAME_TOKEN_SYMBOL } = import.meta.env; @@ -19,17 +21,33 @@ const AccountDetails = () => { const { account } = useAccountCustom(); const { username } = useControllerUsername(); const isMdOrLarger = useMediaQuery({ query: "(min-width: 768px)" }); + const [copied, setCopied] = useState(false); + + const handleCopy = async () => { + if (account?.address) { + await navigator.clipboard.writeText(account.address); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } + }; if (status === "connected" && account?.address) { return (
{shortAddress(account.address, isMdOrLarger ? 5 : 6)}