diff --git a/frontend/components/dashboard/DetailPanel.tsx b/frontend/components/dashboard/DetailPanel.tsx index a015edb7..91f0b979 100644 --- a/frontend/components/dashboard/DetailPanel.tsx +++ b/frontend/components/dashboard/DetailPanel.tsx @@ -14,8 +14,6 @@ import { getRiskBadgeLabel, getTemperatureChartData, } from "@/lib/dashboard-utils"; -import { ChevronRight, Crown } from "lucide-react"; -import { useRouter } from "next/navigation"; function DetailMiniTemperatureChart({ detail }: { detail: CityDetail }) { const { locale, t } = useI18n(); @@ -125,7 +123,6 @@ function DetailMiniTemperatureChart({ detail }: { detail: CityDetail }) { export function DetailPanel() { const store = useDashboardStore(); - const router = useRouter(); const { locale, t } = useI18n(); const detail = store.selectedDetail; const isPro = store.proAccess.subscriptionActive; @@ -294,33 +291,9 @@ export function DetailPanel() { -
+

{t("detail.todayMiniTrend")}

-
- -
- {!isPro && ( -
-
- Pro Feature -
-

- 解锁日内高精趋势图 -

- -
- )} +
diff --git a/frontend/components/dashboard/ProFeaturePaywall.tsx b/frontend/components/dashboard/ProFeaturePaywall.tsx index f6e88a5f..6a448e76 100644 --- a/frontend/components/dashboard/ProFeaturePaywall.tsx +++ b/frontend/components/dashboard/ProFeaturePaywall.tsx @@ -18,6 +18,7 @@ export function ProFeaturePaywall({ feature, onClose }: ProFeaturePaywallProps) const [usePoints, setUsePoints] = useState(true); const isEn = locale === "en-US"; + const isAuthenticated = proAccess.authenticated; const pointsAvailable = Number(proAccess.points || 0); const PRO_PRICE_USD = 5; @@ -45,17 +46,13 @@ export function ProFeaturePaywall({ feature, onClose }: ProFeaturePaywallProps) }; }, [pointsAvailable, usePoints]); - const payLabel = isEn - ? feature === "history" - ? "Unlock History in Account" - : feature === "future" - ? "Unlock Forecast in Account" - : "Unlock Intraday in Account" - : feature === "history" - ? "去账户中心解锁历史功能" - : feature === "future" - ? "去账户中心解锁未来分析" - : "去账户中心解锁今日日内"; + const payLabel = isAuthenticated + ? isEn + ? "Open Pro in Account" + : "去账户中心开通 Pro" + : isEn + ? "Sign In to Unlock Pro" + : "先登录再开通 Pro"; return (
@@ -67,10 +64,16 @@ export function ProFeaturePaywall({ feature, onClose }: ProFeaturePaywallProps) onToggleUsePoints={() => setUsePoints((prev) => !prev)} billing={billing} onClose={onClose} - onPay={() => router.push("/account")} + onPay={() => { + if (!isAuthenticated) { + router.push("/auth/login?next=%2Faccount"); + return; + } + router.push("/account"); + }} payLabel={payLabel} faqHref="/account" />
); -} \ No newline at end of file +} diff --git a/frontend/components/subscription/UnlockProOverlay.tsx b/frontend/components/subscription/UnlockProOverlay.tsx index d14988e4..a18d338a 100644 --- a/frontend/components/subscription/UnlockProOverlay.tsx +++ b/frontend/components/subscription/UnlockProOverlay.tsx @@ -69,210 +69,218 @@ export function UnlockProOverlay({ payLabel || (isEn ? "Subscribe & Activate" : "立即订阅并激活服务"); return ( -
+
+
{onClose && ( )} -
-
- -
-

- {title} -

-

{subtitle}

-
- -
-
-
-
- - STANDARD PRO - -
- - ${planPriceUsd.toFixed(2)} - - - / {isEn ? "mo" : "月"} - -
-
    - {(isEn - ? [ - "15-day high precision trend", - "Realtime radar panel", - "Cross-platform alert push", - ] - : ["15天趋势预报", "实时雷达图", "全平台推送"] - ).map((item, i) => ( -
  • - {item} -
  • - ))} -
+
+
+
+
+

+ {title} +

+

+ {subtitle} +

+
+
+
+
+ + STANDARD PRO + +
+ + ${planPriceUsd.toFixed(2)} + + + / {isEn ? "mo" : "月"} + +
+
    + {(isEn + ? [ + "15-day high precision trend", + "Realtime radar panel", + "Cross-platform alert push", + ] + : ["15天趋势预报", "实时雷达图", "全平台推送"] + ).map((item, i) => ( +
  • + {item} +
  • + ))} +
+
+
- {billing.pointsEnabled && billing.isEligible ? ( -
-
-
+ {billing.pointsEnabled && billing.isEligible ? ( +
+
- + {isEn ? "Points Credit" : "积分抵扣"}
-
+
-${billing.discountAmount.toFixed(2)} - DISCOUNT -
-
-

- {usePoints - ? isEn - ? `Using ${billing.pointsUsed} points` - : `已自动消耗账户内 ${billing.pointsUsed} 积分` - : isEn - ? `Up to $${billing.maxDiscountUsd.toFixed(2)} off` - : `开启后最多可抵扣 $${billing.maxDiscountUsd.toFixed(2)}`} -

-
- ) : ( -
-
-
-
- -
- - {!billing.pointsEnabled - ? isEn - ? "Points Disabled" - : "积分抵扣未开启" - : isEn - ? "Not Enough Points" - : "积分不足"} + + DISCOUNT
-

- {isEn ? "Earn Credits in Community" : "活跃赚取抵扣"} -

-

- {!billing.pointsEnabled +

+ {usePoints ? isEn - ? "Points redemption is currently unavailable for this plan." - : "当前套餐未开启积分抵扣。" + ? `Using ${billing.pointsUsed} points from your account` + : `已自动消耗账户内 ${billing.pointsUsed} 积分` : isEn - ? `Need at least ${billing.pointsPerUsd} points. Current: ${points}` - : `需要至少 ${billing.pointsPerUsd} 积分,当前 ${points}`} + ? `Enable to save up to $${billing.maxDiscountUsd.toFixed(2)}` + : `开启后最多可抵扣 $${billing.maxDiscountUsd.toFixed(2)}`}

-
- {telegramGroupUrl ? ( - - {isEn ? "Open Telegram" : "前往电报群"} - - - ) : ( - <> - {isEn ? "Open Telegram" : "前往电报群"} - - - )} + ) : ( +
+
+
+
+ +
+ + {!billing.pointsEnabled + ? isEn + ? "Points Disabled" + : "积分未开启" + : isEn + ? "Not Enough Points" + : "积分不足"} + +
+

+ {isEn ? "Earn Credits in Community" : "活跃赚取抵扣"} +

+

+ {!billing.pointsEnabled + ? isEn + ? "Points redemption is currently unavailable for this plan." + : "当前套餐未开启积分抵扣。" + : isEn + ? `Need at least ${billing.pointsPerUsd} points. Current: ${points}` + : `需要至少 ${billing.pointsPerUsd} 积分,当前 ${points}`} +

+
+
+ {telegramGroupUrl ? ( + + {isEn ? "Open Telegram" : "前往电报群"} + + + ) : ( + + {isEn ? "Open Telegram" : "前往电报群"} + + + )} +
+
+ )} +
+ +
+
+ + {isEn ? "Total Due" : "应付总计"} + +
+ + ${billing.finalPrice.toFixed(2)} + + + USD +
- )} -
-
-
- - {isEn ? "Total Due:" : "应付总计:"} - -
- - ${billing.finalPrice.toFixed(2)} - - - USD - -
-
- - - -
- - Secure Payment - - - Subscription FAQ - -
+ {payBusy ? ( + + ) : ( + <> + + {finalPayLabel} + + + )} + - {errorText ? ( -
- {errorText} +
+ + Secure Payment + + + Subscription FAQ +
- ) : null} - {infoText ? ( -
- {infoText} -
- ) : null} + + {errorText ? ( +
+ {errorText} +
+ ) : null} + {infoText ? ( +
+ {infoText} +
+ ) : null} +
); -} \ No newline at end of file +}