"use client"; import { cn } from "@/lib/utils"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Crown, ArrowUpRight } from "lucide-react"; import Link from "next/link"; const PLAN_CONFIG: Record = { free: { label: "免费版", variant: "secondary" }, starter: { label: "入门版", variant: "info" }, pro: { label: "专业版", variant: "default" }, enterprise: { label: "企业版", variant: "primary" }, }; interface SubscriptionStatusProps { plan: string; expiresAt?: string; className?: string; } export function SubscriptionStatus({ plan, expiresAt, className }: SubscriptionStatusProps) { const config = PLAN_CONFIG[plan] || PLAN_CONFIG.free; const showUpgrade = plan === "free" || plan === "starter"; const formatDate = (dateStr: string) => { try { return new Date(dateStr).toLocaleDateString("zh-CN", { year: "numeric", month: "long", day: "numeric", }); } catch { return dateStr; } }; return (
{plan !== "free" && } {config.label}
{expiresAt && ( 到期:{formatDate(expiresAt)} )} {showUpgrade && ( )}
); }