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
@@ -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>
) : (