"use client"; import { useSession } from "next-auth/react"; import { useVoteStore, selectRemaining, DAILY_VOTE_QUOTA } from "@/lib/store"; /** * 导航栏的"今日剩余票数"徽章。 * - 始终显示(位于 AuthMenu 左侧) * - 未登录:数值固定为 0 * - 已登录:实时从 vote store 取剩余票 * - 视觉为中性轻盈胶囊,与 AuthMenu 的紫色实心胶囊明显区分(信息 vs 操作) */ export default function RemainingVotesBadge() { const { status } = useSession(); const storeRemaining = useVoteStore(selectRemaining); const authed = status === "authenticated"; // 未登录:0/0(没有额度);登录后:当日剩余 / 每日总额度 const remaining = authed ? storeRemaining : 0; const quota = authed ? DAILY_VOTE_QUOTA : 0; return (
今日剩余 {remaining} / {quota}
); }