diff --git a/src/app/profile/[address]/page.tsx b/src/app/profile/[address]/page.tsx index c3ec1daf..4e41f4ad 100644 --- a/src/app/profile/[address]/page.tsx +++ b/src/app/profile/[address]/page.tsx @@ -1150,8 +1150,8 @@ function PortfolioTab({ address, isOwnProfile }: { address: string; isOwnProfile queryFn: async (): Promise => { if (!supabase) return []; - // Scan all storylines with tokens (matches ReaderPortfolio pattern) - // to catch holdings acquired via direct transfers, not just indexed trades + // Scan all storylines with tokens to catch holdings acquired via + // direct transfers, not just indexed trades const { data: storylines } = await supabase .from("storylines") .select("*") diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index ed2879ae..fb1dd290 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -3,20 +3,32 @@ import { useState } from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; +import { useAccount } from "wagmi"; import Image from "next/image"; import { ConnectWallet } from "./ConnectWallet"; -const NAV_LINKS = [ - { href: "/create", label: "Create" }, - { href: "/dashboard/writer", label: "Writer" }, - { href: "/dashboard/reader", label: "Reader" }, - { href: "/agents", label: "Agents" }, - { href: "/token", label: "$PLOT" }, -] as const; - export function NavBar() { const pathname = usePathname(); const [mobileOpen, setMobileOpen] = useState(false); + const { address, isConnected } = useAccount(); + + const dashboardHref = isConnected && address + ? `/profile/${address}` + : "/dashboard/writer"; + + const navLinks = [ + { href: "/create", label: "Create" }, + { href: dashboardHref, label: "Dashboard" }, + { href: "/agents", label: "Agents" }, + { href: "/token", label: "$PLOT" }, + ]; + + const isActive = (href: string, label: string) => { + if (label === "Dashboard") { + return pathname.startsWith("/profile/") || pathname.startsWith("/dashboard/"); + } + return pathname === href || pathname.startsWith(href + "/"); + }; return (