feat: Introduce Pro subscription unlock overlay, paywall, and related account and help pages.

This commit is contained in:
2569718930@qq.com
2026-03-13 20:38:10 +08:00
parent 3d9d4dcd64
commit f27970f157
4 changed files with 139 additions and 8 deletions
+113
View File
@@ -0,0 +1,113 @@
import type { Metadata } from "next";
import Link from "next/link";
import {
ArrowLeft,
CheckCircle2,
Coins,
CreditCard,
MessageSquare,
ShieldCheck,
} from "lucide-react";
export const metadata: Metadata = {
title: "PolyWeather | 订阅说明",
description: "PolyWeather Pro 订阅、积分抵扣与支付方式说明。",
};
const TELEGRAM_GROUP_URL = String(
process.env.NEXT_PUBLIC_TELEGRAM_GROUP_URL ||
"https://t.me/+nMG7SjziUKYyZmM1",
).trim();
const FAQ_ITEMS = [
{
q: "Pro 包含哪些功能?",
a: "开通后可解锁:今日日内深度分析(含高温时段)、历史对账 + 未来日期分析、全平台智能气象推送。",
},
{
q: "当前订阅价格是多少?",
a: "目前仅提供月付:5 USDC / 30 天。",
},
{
q: "积分如何抵扣?",
a: "满 500 积分起兑,每 500 积分抵 1U,单次最多抵 3U。",
},
{
q: "支持哪些钱包和支付方式?",
a: "支持 EVM 浏览器钱包(MetaMask / OKX / Rabby / Bitget 等)及 WalletConnect 扫码钱包(Trust Wallet / Binance Web3 Wallet / TokenPocket 等)。",
},
];
export default function SubscriptionHelpPage() {
return (
<main className="min-h-screen bg-[#070d1d] px-4 py-10 text-slate-100">
<div className="mx-auto w-full max-w-4xl">
<Link
href="/account"
className="mb-5 inline-flex items-center gap-2 rounded-xl border border-white/10 bg-white/5 px-3 py-2 text-sm text-slate-300 transition hover:bg-white/10"
>
<ArrowLeft size={15} />
</Link>
<section className="rounded-3xl border border-blue-400/20 bg-gradient-to-b from-[#162541] to-[#0e1730] p-6 md:p-8">
<div className="mb-5 flex items-center gap-3">
<ShieldCheck className="text-cyan-300" size={22} />
<h1 className="text-2xl font-bold md:text-3xl">PolyWeather Pro </h1>
</div>
<p className="text-sm text-slate-300 md:text-base">
Pro
</p>
<div className="mt-6 grid gap-3 md:grid-cols-3">
<div className="rounded-2xl border border-white/10 bg-white/5 p-4">
<div className="mb-2 flex items-center gap-2 text-cyan-300">
<CreditCard size={16} />
<span className="text-sm font-semibold"></span>
</div>
<p className="text-xl font-bold">5 USDC / 30 </p>
</div>
<div className="rounded-2xl border border-white/10 bg-white/5 p-4">
<div className="mb-2 flex items-center gap-2 text-emerald-300">
<Coins size={16} />
<span className="text-sm font-semibold"></span>
</div>
<p className="text-xl font-bold"> 3U</p>
</div>
<div className="rounded-2xl border border-white/10 bg-white/5 p-4">
<div className="mb-2 flex items-center gap-2 text-violet-300">
<MessageSquare size={16} />
<span className="text-sm font-semibold"></span>
</div>
<Link
href={TELEGRAM_GROUP_URL}
target="_blank"
className="text-sm font-semibold text-blue-300 underline decoration-blue-500/50 underline-offset-4"
>
</Link>
</div>
</div>
</section>
<section className="mt-6 rounded-3xl border border-white/10 bg-[#0f162a]/80 p-6 md:p-8">
<h2 className="mb-4 text-lg font-bold"></h2>
<div className="space-y-4">
{FAQ_ITEMS.map((item) => (
<article
key={item.q}
className="rounded-2xl border border-white/10 bg-white/[0.03] p-4"
>
<h3 className="mb-2 flex items-center gap-2 text-sm font-semibold text-blue-300">
<CheckCircle2 size={14} />
{item.q}
</h3>
<p className="text-sm leading-6 text-slate-300">{item.a}</p>
</article>
))}
</div>
</section>
</div>
</main>
);
}
@@ -158,6 +158,11 @@ const WALLETCONNECT_POLYGON_RPC_URL = String(
process.env.NEXT_PUBLIC_WALLETCONNECT_POLYGON_RPC_URL ||
"https://polygon-bor-rpc.publicnode.com",
).trim();
const TELEGRAM_GROUP_URL = String(
process.env.NEXT_PUBLIC_TELEGRAM_GROUP_URL ||
"https://t.me/+nMG7SjziUKYyZmM1",
).trim();
const SUBSCRIPTION_HELP_HREF = "/subscription-help";
let walletConnectProviderCache: EvmProvider | null = null;
let walletConnectProviderChainId: number | null = null;
@@ -1578,7 +1583,8 @@ export function AccountCenter() {
txHash={lastTxHash || undefined}
chainId={paymentConfig?.chain_id || 137}
paymentTokenLabel={selectedTokenLabel}
faqHref="/account"
faqHref={SUBSCRIPTION_HELP_HREF}
telegramGroupUrl={TELEGRAM_GROUP_URL}
/>
</div>
)}
@@ -6,6 +6,12 @@ import { useI18n } from "@/hooks/useI18n";
import { useDashboardStore } from "@/hooks/useDashboardStore";
import { UnlockProOverlay } from "@/components/subscription/UnlockProOverlay";
const TELEGRAM_GROUP_URL = String(
process.env.NEXT_PUBLIC_TELEGRAM_GROUP_URL ||
"https://t.me/+nMG7SjziUKYyZmM1",
).trim();
const SUBSCRIPTION_HELP_HREF = "/subscription-help";
type ProFeaturePaywallProps = {
feature: "today" | "history" | "future";
onClose?: () => void;
@@ -75,8 +81,8 @@ export function ProFeaturePaywall({
router.push("/account");
}}
payLabel={payLabel}
faqHref="/account"
telegramGroupUrl="https://t.me/+nMG7SjziUKYyZmM1"
faqHref={SUBSCRIPTION_HELP_HREF}
telegramGroupUrl={TELEGRAM_GROUP_URL}
/>
</div>
);
@@ -21,6 +21,9 @@ import {
} from "lucide-react";
import s from "./UnlockProOverlay.module.css";
const DEFAULT_FAQ_HREF = "/subscription-help";
const DEFAULT_TELEGRAM_GROUP_URL = "https://t.me/+nMG7SjziUKYyZmM1";
export type UnlockProBilling = {
pointsEnabled: boolean;
isEligible: boolean;
@@ -77,8 +80,8 @@ export function UnlockProOverlay({
locale = "zh-CN",
errorText,
infoText,
faqHref = "/account",
telegramGroupUrl,
faqHref = DEFAULT_FAQ_HREF,
telegramGroupUrl = DEFAULT_TELEGRAM_GROUP_URL,
txHash,
chainId = 137,
paymentTokenLabel,
@@ -100,6 +103,7 @@ export function UnlockProOverlay({
const progressPct = billing.pointsEnabled
? Math.min(100, Math.round((points / maxPointsForFullDiscount) * 100))
: 0;
const resolvedTelegramGroupUrl = String(telegramGroupUrl || "").trim();
const txHref =
txHash && txHash.startsWith("0x")
? `${chainId === 137 ? "https://polygonscan.com" : "https://etherscan.io"}/tx/${txHash}`
@@ -292,14 +296,16 @@ export function UnlockProOverlay({
)}
<div style={{ marginTop: "auto", paddingTop: 16 }}>
{telegramGroupUrl ? (
{resolvedTelegramGroupUrl ? (
<Link
href={telegramGroupUrl}
href={resolvedTelegramGroupUrl}
target="_blank"
className={s.unavailCta}
>
<MessageSquare size={12} />
{isEn ? "Join Telegram to earn" : "加入电报群赚取积分"}
{isEn
? "Join community to earn points"
: "加入社群即可赚取积分"}
<ArrowRight size={11} />
</Link>
) : (