Skip to content

Commit

Permalink
UI improvements to wallet dropdown and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
luloxi committed Oct 16, 2024
1 parent 40a3c5d commit b995b39
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRef, useState } from "react";
import Link from "next/link";
import { NetworkOptions } from "./NetworkOptions";
import { FundButton } from "@coinbase/onchainkit/fund";
import { FundButton, getOnrampBuyUrl } from "@coinbase/onchainkit/fund";
import { Avatar, Badge, Identity, Name } from "@coinbase/onchainkit/identity";
import CopyToClipboard from "react-copy-to-clipboard";
import { getAddress } from "viem";
Expand Down Expand Up @@ -37,7 +37,18 @@ export const AddressInfoDropdown = ({ address, blockExplorerAddressLink }: Addre
const [addressCopied, setAddressCopied] = useState(false);

const [selectingNetwork, setSelectingNetwork] = useState(false);

const dropdownRef = useRef<HTMLDetailsElement>(null);

const projectId = process.env.NEXT_PUBLIC_CDP_PROJECT_ID || "";

const onrampBuyUrl = getOnrampBuyUrl({
projectId,
addresses: { connectedAddress: ["base"] },
assets: ["USDC", "ETH"],
presetFiatAmount: 20,
fiatCurrency: "USD",
});
const closeDropdown = () => {
setSelectingNetwork(false);
dropdownRef.current?.removeAttribute("open");
Expand Down Expand Up @@ -84,7 +95,11 @@ export const AddressInfoDropdown = ({ address, blockExplorerAddressLink }: Addre
</Link>
</div>
</li>
<FundButton text="Add funds" className="py-1 px-3.5 gap-1 text-md rounded-xl justify-start font-normal" />
<FundButton
text="Add funds"
fundingUrl={onrampBuyUrl}
className="py-1 px-3.5 gap-1 text-md rounded-xl justify-start font-normal"
/>
<li className={selectingNetwork ? "hidden" : ""}>
<button
className="menu-item btn-sm !rounded-xl bg-[#4f46e5] hover:bg-[#4338CA] active:bg-[#4338CA] flex gap-3 py-3"
Expand Down

0 comments on commit b995b39

Please sign in to comment.