diff --git a/src/pages/NIP19Page.tsx b/src/pages/NIP19Page.tsx index e68036d..f12bb99 100644 --- a/src/pages/NIP19Page.tsx +++ b/src/pages/NIP19Page.tsx @@ -60,35 +60,55 @@ function profileEventCreatedAt(createdAt: number | undefined): string | undefine return new Date(createdAt * 1000).toLocaleDateString(undefined, { year: 'numeric', month: 'short' }); } -/** A compact stat pill for the at-a-glance strip. */ +/** A compact stat pill for the at-a-glance strip. Clickable when `onClick` is + * provided (jumps to the matching section); shows disabled/inert when empty. */ function StatPill({ value, label, color, loading, icon, + onClick, }: { value: number; label: string; color: string; loading?: boolean; icon?: ReactNode; + onClick?: () => void; }) { - return ( -
-
- {loading ? ( - - ) : ( -

- {icon} - {value} -

- )} -

{label}

-
+ const interactive = !!onClick && value > 0; + const inner = ( +
+ {loading ? ( + + ) : ( +

+ {icon} + {value} +

+ )} +

+ {label} +

); + + const base = 'flex items-center gap-2.5 rounded-xl border px-3.5 py-2.5 min-w-[84px] transition-all'; + + if (interactive) { + return ( + + ); + } + + return
{inner}
; } function ProfilePage({ pubkey }: { pubkey: string }) { @@ -150,6 +170,12 @@ function ProfilePage({ pubkey }: { pubkey: string }) { setTimeout(() => setCopied(false), 2000); }; + // Smooth-scroll a stat pill to its matching section on the page. + const scrollToSection = (id: string) => { + const el = document.getElementById(id); + if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' }); + }; + // Create a mock event for zapping const profileEvent = author.data?.event; @@ -298,10 +324,10 @@ function ProfilePage({ pubkey }: { pubkey: string }) { {/* ── At-a-glance stats strip ── */}
- - - - + scrollToSection('section-spots')} /> + scrollToSection('section-shops')} /> + scrollToSection('section-crews')} /> + scrollToSection('section-stash')} /> {(riderStats?.zapsReceived ?? 0) > 0 && ( } /> )} @@ -459,7 +485,7 @@ function ProfilePage({ pubkey }: { pubkey: string }) { {/* Spots by this user — hidden entirely for others when empty */} {(spotsLoading || (spots && spots.length > 0) || isOwnProfile) && ( -
+

@@ -502,7 +528,7 @@ function ProfilePage({ pubkey }: { pubkey: string }) { {/* Shops by this user — only render when there's something, or it's you */} {(shopsLoading || (shops && shops.length > 0)) && ( -
+

@@ -547,7 +573,7 @@ function ProfilePage({ pubkey }: { pubkey: string }) { {/* Public Stash — gear this skater chose to show publicly */} {(publicStashLoading || (publicStash && publicStash.length > 0)) && ( -
+

@@ -763,7 +789,7 @@ function ProfilePage({ pubkey }: { pubkey: string }) { {/* Crews Card */} {(crewsLoading || crews.length > 0) && ( - +