|
1 | | -import { ColorModeToggle } from "@/components/color-mode-toggle"; |
2 | | -import { Spinner } from "@/components/ui/Spinner/Spinner"; |
| 1 | +import { NavLink } from "@/components/ui/NavLink"; |
| 2 | +import { Button } from "@/components/ui/button"; |
3 | 3 | import { CustomConnectWallet } from "@3rdweb-sdk/react/components/connect-wallet"; |
4 | | -import { ClientOnly } from "components/ClientOnly/ClientOnly"; |
| 4 | +import { CmdKSearch } from "components/cmd-k-search"; |
| 5 | +import { ColorModeToggle } from "components/color-mode/color-mode-toggle"; |
| 6 | +import { Logo } from "components/logo"; |
| 7 | +import { CreditsButton } from "components/settings/Account/Billing/CreditsButton"; |
| 8 | +import { UpgradeButton } from "components/settings/Account/Billing/UpgradeButton"; |
| 9 | +import { CircleHelpIcon } from "lucide-react"; |
5 | 10 | import Link from "next/link"; |
6 | | -import { ThirdwebMiniLogo } from "../ThirdwebMiniLogo"; |
7 | | -import { NavLink } from "../nav-link.client"; |
8 | | -import { MobileBurgerMenu } from "./MobileBurgerMenu"; |
9 | | -import { headerLinks } from "./headerLinks"; |
| 11 | +import { Suspense } from "react"; |
| 12 | +import { DashboardHeaderTabs } from "./DashboardHeaderTabs"; |
10 | 13 |
|
11 | | -export function DashboardHeader() { |
| 14 | +export const DashboardHeader: React.FC = () => { |
12 | 15 | return ( |
13 | | - // the "h-24" avoids layout shift when connecting wallet (connected wallet button is taller than disconnected...) |
14 | | - <header className="flex h-20 flex-shrink-0 flex-row items-center justify-between border-border border-b bg-muted/50 px-4 py-4 md:h-20 lg:px-6"> |
15 | | - {/* Left */} |
16 | | - <div className="flex items-center gap-6"> |
17 | | - <div className="flex items-center gap-2"> |
18 | | - <MobileBurgerMenu /> |
| 16 | + <div className="bg-muted/50"> |
| 17 | + <header className="flex items-center justify-between px-4 py-3 lg:px-6"> |
| 18 | + {/* left */} |
| 19 | + <div className="flex items-center gap-4"> |
19 | 20 | <Link href="/dashboard"> |
20 | | - <ThirdwebMiniLogo className="h-6" /> |
| 21 | + <Logo hideWordmark /> |
21 | 22 | </Link> |
| 23 | + <CmdKSearch /> |
22 | 24 | </div> |
23 | 25 |
|
24 | | - <div className="hidden items-center gap-2 md:flex"> |
25 | | - {headerLinks.left.map((link) => ( |
26 | | - <NavLink |
27 | | - key={link.href} |
28 | | - href={link.href} |
29 | | - target={link.href.startsWith("https") ? "_blank" : undefined} |
30 | | - className="px-[10px] py-2 font-normal text-muted-foreground text-sm hover:text-foreground" |
31 | | - activeClassName="font-medium text-foreground" |
32 | | - > |
33 | | - {link.name} |
34 | | - </NavLink> |
35 | | - ))} |
36 | | - </div> |
37 | | - </div> |
38 | | - {/* Right */} |
39 | | - <div className="flex items-center gap-4"> |
40 | | - <div className="items-center gap-2 lg:flex"> |
41 | | - <div className="hidden items-center gap-2 lg:flex"> |
42 | | - {headerLinks.right.map((link) => ( |
43 | | - <Link |
44 | | - key={link.href} |
45 | | - href={link.href} |
46 | | - target={link.href.startsWith("https") ? "_blank" : undefined} |
47 | | - className="px-[10px] py-2 font-normal text-muted-foreground text-sm hover:text-foreground" |
| 26 | + {/* Right */} |
| 27 | + <div className="flex items-center gap-2"> |
| 28 | + <div className="hidden gap-2 md:flex"> |
| 29 | + <Suspense fallback={null}> |
| 30 | + <CreditsButton /> |
| 31 | + </Suspense> |
| 32 | + <UpgradeButton /> |
| 33 | + </div> |
| 34 | + |
| 35 | + <HeaderNavLink |
| 36 | + trackingLabel="chainlist" |
| 37 | + href="/chainlist" |
| 38 | + label="Chainlist" |
| 39 | + /> |
| 40 | + |
| 41 | + <HeaderNavLink |
| 42 | + trackingLabel="docs" |
| 43 | + href="https://portal.thirdweb.com" |
| 44 | + label="Docs" |
| 45 | + /> |
| 46 | + |
| 47 | + <HeaderNavLink |
| 48 | + trackingLabel="support" |
| 49 | + href="/support" |
| 50 | + label="Support" |
| 51 | + /> |
| 52 | + |
| 53 | + <div className="md:hidden"> |
| 54 | + <Button asChild variant="ghost"> |
| 55 | + <NavLink |
| 56 | + className="fade-in-0 !h-auto !w-auto p-2" |
| 57 | + href="/support" |
| 58 | + tracking={{ |
| 59 | + category: "header", |
| 60 | + action: "click", |
| 61 | + label: "support", |
| 62 | + }} |
48 | 63 | > |
49 | | - {link.name} |
50 | | - </Link> |
51 | | - ))} |
| 64 | + <CircleHelpIcon className="size-5" /> |
| 65 | + </NavLink> |
| 66 | + </Button> |
52 | 67 | </div> |
| 68 | + |
53 | 69 | <ColorModeToggle /> |
| 70 | + |
| 71 | + <div className="md:ml-2"> |
| 72 | + <CustomConnectWallet /> |
| 73 | + </div> |
54 | 74 | </div> |
| 75 | + </header> |
55 | 76 |
|
56 | | - <ClientOnly |
57 | | - ssr={ |
58 | | - <div className="flex h-[48px] w-[144px] items-center justify-center rounded-lg border bg-muted/50"> |
59 | | - <Spinner className="size-4" /> |
60 | | - </div> |
61 | | - } |
62 | | - > |
63 | | - <CustomConnectWallet /> |
64 | | - </ClientOnly> |
65 | | - </div> |
66 | | - </header> |
| 77 | + <DashboardHeaderTabs /> |
| 78 | + </div> |
| 79 | + ); |
| 80 | +}; |
| 81 | + |
| 82 | +function HeaderNavLink(props: { |
| 83 | + label: string; |
| 84 | + trackingLabel: string; |
| 85 | + href: string; |
| 86 | +}) { |
| 87 | + return ( |
| 88 | + <NavLink |
| 89 | + href={props.href} |
| 90 | + tracking={{ |
| 91 | + category: "header", |
| 92 | + action: "click", |
| 93 | + label: props.trackingLabel, |
| 94 | + }} |
| 95 | + className="hidden px-2.5 text-muted-foreground text-sm hover:text-foreground md:block" |
| 96 | + activeClassName="text-foreground" |
| 97 | + > |
| 98 | + {props.label} |
| 99 | + </NavLink> |
67 | 100 | ); |
68 | 101 | } |
0 commit comments