"use client"; import Link from "next/link"; import { ArrowRight, BarChart3, Crown, Lock, ShieldCheck, Sparkles, X, Zap, } from "lucide-react"; import { useI18n } from "@/hooks/useI18n"; import { useDashboardStore } from "@/hooks/useDashboardStore"; import { useState } from "react"; type ProFeaturePaywallProps = { feature: "today" | "history" | "future"; onClose?: () => void; }; export function ProFeaturePaywall({ feature, onClose, }: ProFeaturePaywallProps) { const { locale } = useI18n(); const { proAccess } = useDashboardStore(); const [usePoints, setUsePoints] = useState(true); const isEn = locale === "en-US"; // Redemption logic: 500 points = $1 discount // Max discount $3 (requires 1500 points) const maxRedeemablePoints = 1500; const pointsAvailable = proAccess.points || 0; const effectivePoints = Math.min(pointsAvailable, maxRedeemablePoints); const discountAmount = usePoints ? Math.floor(effectivePoints / 500) : 0; const originalPrice = 5.0; const finalPrice = originalPrice - discountAmount; const pointsToConsume = discountAmount * 500; return (
{onClose && ( )} {/* Crown Badge */}

{isEn ? "Unlock PolyWeather Pro" : "开启 PolyWeather Pro"}

{isEn ? "Unlock 15-day precision trends, real-time radar, and ad-free experience across all platforms." : "解锁 15 天高精度趋势分析、实时雷达与闪电追踪。尊享全平台无广告体验。"}

{/* Pricing Cards */}
{/* Plan Card */}
{isEn ? "Monthly" : "月付套餐"}
PRO PLAN
$5.00 / {isEn ? "mo" : "月"}
{/* Points Card */}
= 500 ? "border-indigo-500/30 bg-indigo-500/5" : "border-white/5 bg-white/5 opacity-60" }`} >
= 500 ? "text-indigo-400" : "text-slate-500" }`} > {isEn ? "Points Credit" : "积分抵扣"}
= 500 ? "text-emerald-400" : "text-slate-500"}`} > -${discountAmount.toFixed(2)} OFF
{pointsAvailable < 500 ? isEn ? "Need 500+ points" : `积分不足 (当前 ${pointsAvailable})` : isEn ? `Auto-consume ${pointsToConsume} points` : `已自动消耗 ${pointsToConsume} 积分`}
{/* Total & Action */}
{isEn ? "Total Due:" : "应付总计:"} ${finalPrice.toFixed(2)}
{isEn ? "Connect Wallet & Pay" : "连接钱包并支付"}
{isEn ? "Secured Payment" : "安全加密支付"} {isEn ? "FAQ" : "常见问题 (FAQ)"}
); }