"use client"; import React, { useState } from "react"; import Link from "next/link"; import ProfileModal from "./ProfileModal"; import useUserStore from "@/stores/useUserStore"; interface TopStatsBarProps { backHref?: string; pageTitle?: string; } export default function TopStatsBar({ backHref, pageTitle }: TopStatsBarProps = {}) { const [profileOpen, setProfileOpen] = useState(false); const { streak, gems, level } = useUserStore(); /* Compute rank label from level */ const rankLabel = level >= 15 ? "Diamond Rank" : level >= 10 ? "Platinum Rank" : level >= 7 ? "Gold Rank" : level >= 4 ? "Silver Rank" : "Bronze Rank"; return ( <> {/* Left: back arrow or avatar + logo */} {backHref ? ( /* Back arrow mode (e.g. store, map) */ <> {pageTitle} > ) : ( /* Default avatar + logo mode */ <> setProfileOpen(true)} className="relative h-11 w-11 rounded-full overflow-hidden border-2 border-brand-teal shadow-md hover:shadow-lg transition" > Learn8 > )} {/* Right: stats */} {/* Streak */} 🔥 {streak} Days {/* Gems */} 💎 {gems.toLocaleString()} {/* Rank badge */} {level} {rankLabel} {/* Profile modal */} {profileOpen && ( setProfileOpen(false)} /> )} > ); } /* ── Small mascot avatar ── */ function MascotAvatar() { return ( ); } /* ── Small owl logo icon ── */ function OwlLogoSmall() { return ( ); }