From 8a618bc98b429d2473159d69c9f1cbc054bf5965 Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Tue, 31 Mar 2026 12:50:12 +0100 Subject: [PATCH 1/2] [#675] Improve nav wallet UX - Shorten wallet address to first 6 chars (0x4d68) in nav - Remove disconnect button from nav bar - Add DisconnectButton component to profile page next to Human/AI Agent badge, shown only on own profile - Mobile: show compact Connect button / PFP+identifier in top nav bar next to hamburger, no longer hidden inside menu - ConnectWallet now supports compact prop for mobile variant - Hamburger menu still shows full nav links + wallet info Fixes realproject7/plotlink#675 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/app/profile/[address]/page.tsx | 2 + src/components/ConnectWallet.tsx | 79 +++++++++++++++++++++++------- src/components/NavBar.tsx | 5 ++ 3 files changed, 69 insertions(+), 17 deletions(-) diff --git a/src/app/profile/[address]/page.tsx b/src/app/profile/[address]/page.tsx index a7ce53cc..dcccc236 100644 --- a/src/app/profile/[address]/page.tsx +++ b/src/app/profile/[address]/page.tsx @@ -17,6 +17,7 @@ import type { FarcasterProfile } from "../../../../lib/farcaster"; import type { AgentMetadata } from "../../../../lib/contracts/erc8004"; import { usePlotUsdPrice } from "../../../hooks/usePlotUsdPrice"; import { formatUsdValue } from "../../../../lib/usd-price"; +import { DisconnectButton } from "../../../components/ConnectWallet"; type Tab = "stories" | "portfolio" | "activity"; @@ -241,6 +242,7 @@ function ProfileHeader({ ) )} + {isOwnProfile && } {/* Bio */} diff --git a/src/components/ConnectWallet.tsx b/src/components/ConnectWallet.tsx index da383540..b1d315f3 100644 --- a/src/components/ConnectWallet.tsx +++ b/src/components/ConnectWallet.tsx @@ -8,7 +8,13 @@ import { isFarcasterMiniApp } from "../../lib/farcaster-detect"; import { truncateAddress } from "../../lib/utils"; import { useConnectedIdentity } from "../hooks/useConnectedIdentity"; -export function ConnectWallet({ onNavigate }: { onNavigate?: () => void } = {}) { +interface ConnectWalletProps { + onNavigate?: () => void; + /** Compact mode for mobile top nav — shows only PFP + short ID */ + compact?: boolean; +} + +export function ConnectWallet({ onNavigate, compact }: ConnectWalletProps = {}) { const { address, isConnected } = useAccount(); const { connect, connectors } = useConnect(); const { disconnect } = useDisconnect(); @@ -37,8 +43,34 @@ export function ConnectWallet({ onNavigate }: { onNavigate?: () => void } = {}) }); }, [inMiniApp, connectors, connect, isConnected]); - // Connected state: show Farcaster PFP + username + address + disconnect + // Connected state if (isConnected && address) { + const shortAddr = address.slice(0, 6); + + // Compact mode: PFP + short identifier for mobile top nav + if (compact) { + return ( + + {profile?.pfpUrl && ( + // eslint-disable-next-line @next/next/no-img-element + + )} + {profile ? `@${profile.username}` : shortAddr} + + ); + } + + // Full mode: PFP + username + shortened address (no disconnect) return (
void } = {}) className="rounded-full" /> )} - {profile ? `@${profile.username}` : truncateAddress(address)} + {profile ? `@${profile.username}` : shortAddr} - {profile && ( - - {truncateAddress(address)} - - )} - + + {shortAddr} +
); } - // Disconnected state: RainbowKit modal (outside Farcaster) or auto-connect (inside) + // Disconnected state: RainbowKit modal return ( {({ openConnectModal, mounted }) => { @@ -93,9 +117,13 @@ export function ConnectWallet({ onNavigate }: { onNavigate?: () => void } = {}) ); @@ -103,3 +131,20 @@ export function ConnectWallet({ onNavigate }: { onNavigate?: () => void } = {}) ); } + +/** + * Disconnect button for use on the profile page. + * Only renders when the viewer is viewing their own profile. + */ +export function DisconnectButton() { + const { disconnect } = useDisconnect(); + + return ( + + ); +} diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index d3b0c283..411839a6 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -60,9 +60,14 @@ export function NavBar() { {/* Right side: wallet + mobile toggle */}
+ {/* Desktop: full ConnectWallet */}
+ {/* Mobile: compact Connect button / PFP in top nav */} +
+ +
); }