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..50fac566 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,36 @@ 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.length > 10 ? profile.username.slice(0, 10) + "…" : 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 +121,13 @@ export function ConnectWallet({ onNavigate }: { onNavigate?: () => void } = {}) ); @@ -103,3 +135,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 */} +
+ +