diff --git a/app/global.css b/app/global.css index 138bb6a8..56f3339a 100644 --- a/app/global.css +++ b/app/global.css @@ -57,7 +57,6 @@ html { height: 100%; scroll-behavior: smooth; /* Reserve space for scrollbar to prevent layout shifts */ - scrollbar-gutter: stable; } body { diff --git a/src/components/layout/header/AccountDropdown.tsx b/src/components/layout/header/AccountDropdown.tsx index 1663471c..3750007c 100644 --- a/src/components/layout/header/AccountDropdown.tsx +++ b/src/components/layout/header/AccountDropdown.tsx @@ -1,81 +1,98 @@ 'use client'; -import { useCallback, useState } from 'react'; -import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; -import { ExitIcon, ExternalLinkIcon } from '@radix-ui/react-icons'; +import { useCallback } from 'react'; +import { Dropdown, DropdownTrigger, DropdownMenu, DropdownItem } from '@nextui-org/react'; +import { ExitIcon, ExternalLinkIcon, CopyIcon } from '@radix-ui/react-icons'; import { clsx } from 'clsx'; -import Link from 'next/link'; +import { toast } from 'react-toastify'; import { useAccount, useDisconnect } from 'wagmi'; import { Avatar } from '@/components/Avatar/Avatar'; import { Name } from '@/components/common/Name'; import { getSlicedAddress } from '@/utils/address'; import { getExplorerURL } from '@/utils/external'; -const DropdownMenuContentStyle = { - marginTop: '-22px', -}; - export function AccountDropdown() { const { address, chainId } = useAccount(); const { disconnect } = useDisconnect(); - const [isOpen, setIsOpen] = useState(false); const handleDisconnectWallet = useCallback(() => { disconnect(); }, [disconnect]); + const handleCopyAddress = useCallback(() => { + if (address) { + void navigator.clipboard.writeText(address).then(() => { + toast.success('Address copied to clipboard!', { toastId: 'address-copied' }); + }); + } + }, [address]); + if (!address) return null; return ( - - -
- -
-
- - - + +
-
- -
-
- + +
+ + + +
+
+ +
+
+ +
+ + {getSlicedAddress(address)} +
- - {getSlicedAddress(address)} -
- - -
+
-
- - - - + } + > + Copy Address + + + } + onClick={() => window.open(getExplorerURL(address, chainId ?? 1), '_blank')} + > + View on Explorer + + + } + className="text-red-500 data-[hover=true]:text-red-500" + > + Log out + +
+ ); } diff --git a/src/components/layout/header/Navbar.tsx b/src/components/layout/header/Navbar.tsx index b872f74a..797d170e 100644 --- a/src/components/layout/header/Navbar.tsx +++ b/src/components/layout/header/Navbar.tsx @@ -1,50 +1,49 @@ 'use client'; import { useEffect, useState } from 'react'; +import { Dropdown, DropdownTrigger, DropdownMenu, DropdownItem } from '@nextui-org/react'; +import { ChevronDownIcon } from '@radix-ui/react-icons'; import { clsx } from 'clsx'; import Image from 'next/image'; -import NextLink from 'next/link'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { useTheme } from 'next-themes'; import { FaRegMoon } from 'react-icons/fa'; import { FiSettings } from 'react-icons/fi'; import { LuSunMedium } from 'react-icons/lu'; - +import { RiBookLine, RiDiscordFill, RiGithubFill } from 'react-icons/ri'; import { useAccount } from 'wagmi'; +import { EXTERNAL_LINKS } from '@/utils/external'; import logo from '../../imgs/logo.png'; import AccountConnect from './AccountConnect'; export function NavbarLink({ - href, children, - target, - ariaLabel, + href, matchKey, + target, }: { - href: string; children: React.ReactNode; - target?: string; - ariaLabel?: string; + href: string; matchKey?: string; + target?: string; }) { const pathname = usePathname(); - const isActive = matchKey === '/' ? pathname === matchKey : pathname.includes(matchKey ?? href); + const isActive = matchKey ? pathname.includes(matchKey) : pathname === href; return ( - {children} - + ); } @@ -52,14 +51,14 @@ export function NavbarTitle() { return (
logo - Monarch - +
); } @@ -68,6 +67,7 @@ export function Navbar() { const { theme, setTheme } = useTheme(); const { address } = useAccount(); const [mounted, setMounted] = useState(false); + const [isMoreOpen, setIsMoreOpen] = useState(false); useEffect(() => { setMounted(true); @@ -78,7 +78,7 @@ export function Navbar() { }; return ( -
diff --git a/src/utils/external.ts b/src/utils/external.ts index 2d74addd..60d10a03 100644 --- a/src/utils/external.ts +++ b/src/utils/external.ts @@ -31,3 +31,9 @@ export const getExplorerTxURL = (hash: string, chain: SupportedNetworks): string return `https://etherscan.io/tx/${hash}`; } }; + +export const EXTERNAL_LINKS = { + docs: 'https://monarch-lend.gitbook.io/monarch-lend/', + discord: 'https://discord.gg/Ur4dwN3aPS', + github: 'https://github.com/monarch-xyz', +} as const;