增强页头概率页入口并优化概率标签

This commit is contained in:
2569718930@qq.com
2026-04-22 02:59:12 +08:00
parent 00eed52545
commit 1765f383e4
7 changed files with 491 additions and 10 deletions
@@ -3373,6 +3373,12 @@
transform: translateY(-1px);
}
.root :global(.info-btn.active) {
background: rgba(34, 211, 238, 0.14);
border-color: rgba(34, 211, 238, 0.42);
color: #e0fbff;
}
/* ── Guide Modal Customizations ── */
.root :global(.modal-content.large) {
max-width: 900px;
+36 -7
View File
@@ -3,7 +3,14 @@
import Link from "next/link";
import { usePathname } from "next/navigation";
import clsx from "clsx";
import { LogIn, UserRound, RotateCw, BookOpen, Sparkles } from "lucide-react";
import {
LogIn,
UserRound,
RotateCw,
BookOpen,
Sparkles,
BarChart3,
} from "lucide-react";
import { useDashboardStore } from "@/hooks/useDashboardStore";
import { useI18n } from "@/hooks/useI18n";
@@ -21,17 +28,32 @@ function parseExpiryInfo(raw?: string | null) {
};
}
export function HeaderBar() {
export function HeaderBar({
refreshAction,
refreshSpinning,
}: {
refreshAction?: () => void | Promise<void>;
refreshSpinning?: boolean;
}) {
const store = useDashboardStore();
const { locale, setLocale, t } = useI18n();
const pathname = usePathname();
const isAuthenticated = store.proAccess.authenticated;
const docsHref = "/docs/intro";
const docsActive = pathname?.startsWith("/docs");
const probabilityHubHref = "/probabilities";
const probabilityHubActive = pathname?.startsWith("/probabilities");
const trialPromoLabel =
locale === "en-US"
? "New users get 3-day Pro trial"
: "新用户可免费体验 3 天 Pro";
const isRefreshing = refreshSpinning ?? store.loadingState.refresh;
const handleRefresh = () => {
if (refreshAction) {
return void refreshAction();
}
return void store.refreshAll();
};
const accountHref = isAuthenticated
? "/account"
@@ -119,6 +141,16 @@ export function HeaderBar() {
{t("header.docs")}
</Link>
<Link
href={probabilityHubHref}
className={clsx("info-btn", probabilityHubActive && "active")}
title={t("header.probabilityHubAria")}
aria-label={t("header.probabilityHubAria")}
>
<BarChart3 size={14} strokeWidth={2} />
{t("header.probabilityHub")}
</Link>
<Link
href="/account"
className="trial-promo-badge"
@@ -160,13 +192,10 @@ export function HeaderBar() {
<button
type="button"
className={clsx(
"refresh-btn",
store.loadingState.refresh && "spinning",
)}
className={clsx("refresh-btn", isRefreshing && "spinning")}
title={t("header.refreshAria")}
aria-label={t("header.refreshAria")}
onClick={() => void store.refreshAll()}
onClick={handleRefresh}
>
<RotateCw size={16} strokeWidth={2} />
</button>
@@ -1164,12 +1164,12 @@ export function ProbabilityDistribution({
const probability = Math.round(Number(row.probability || 0) * 100);
const rowMarketBucket = row.marketBucket;
const rowMarketPrice =
rowMarketBucket?.market_price ?? rowMarketBucket?.yes_buy ?? null;
rowMarketBucket?.yes_buy ?? rowMarketBucket?.market_price ?? null;
const yesPriceText = toPriceCents(rowMarketPrice);
const marketTagFinal = rowMarketBucket
? locale === "en-US"
? `Market ref: ${yesPriceText || "--"}`
: `市场参考: ${yesPriceText || "--"}`
? `YES ask: ${yesPriceText || "--"}`
: `YES 买价: ${yesPriceText || "--"}`
: null;
return (