feat: 个人中心展示决策次数徽章「已拯救 X 次选择困难症」

This commit is contained in:
2026-02-26 14:54:46 +08:00
parent 7aa6c7f792
commit 05e42ffe22
2 changed files with 11 additions and 1 deletions
+8 -1
View File
@@ -19,6 +19,7 @@ import {
X,
Eye,
EyeOff,
Zap,
} from "lucide-react";
import { getUserId, getCachedProfile, setCachedProfile, setCachedPreferences, logout } from "@/lib/userId";
import { getAvatarBg, AVATARS } from "@/lib/avatars";
@@ -33,7 +34,7 @@ function firstImage(r: Restaurant): string {
export default function ProfilePage() {
const router = useRouter();
const [userId, setUserId] = useState("");
const [profile, setProfile] = useState<(UserProfile & { email?: string; preferences?: UserPreferences }) | null>(null);
const [profile, setProfile] = useState<(UserProfile & { email?: string; preferences?: UserPreferences; decisionCount?: number }) | null>(null);
const [loading, setLoading] = useState(true);
const [history, setHistory] = useState<DecisionRecord[]>([]);
@@ -333,6 +334,12 @@ export default function ProfilePage() {
</div>
)}
{usernameMsg && <p className="mt-1 text-xs text-rose-400">{usernameMsg}</p>}
{(profile.decisionCount ?? 0) > 0 && (
<p className="mt-1 flex items-center gap-1 text-xs text-muted">
<Zap size={11} className="text-amber-400" />
{profile.decisionCount}
</p>
)}
</div>
</div>