feat: collapse fund overview help and bind start day to env

Fold the stats description by default and render history_start_day and keep_days from the API so HUB_FUND_HISTORY_START_DAY in .env drives the UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-10 17:23:54 +08:00
parent 4f5a982b63
commit 5faedfbfb7
4 changed files with 63 additions and 8 deletions
+29
View File
@@ -4501,9 +4501,38 @@ html[data-theme="light"] .funds-stage {
border-color: rgba(0, 212, 255, 0.45);
box-shadow: 0 0 18px rgba(0, 212, 255, 0.2);
}
.funds-desc-fold {
margin: 4px 0 0;
max-width: 100%;
}
.funds-desc-toggle {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 0.72rem;
color: var(--accent);
cursor: pointer;
list-style: none;
user-select: none;
letter-spacing: 0.04em;
}
.funds-desc-toggle::-webkit-details-marker {
display: none;
}
.funds-desc-toggle::before {
content: "▸";
font-size: 0.68rem;
transition: transform 0.15s ease;
}
.funds-desc-fold[open] .funds-desc-toggle::before {
transform: rotate(90deg);
}
.funds-desc {
margin: 8px 0 0;
color: color-mix(in srgb, var(--muted) 88%, var(--accent));
letter-spacing: 0.02em;
line-height: 1.45;
font-size: 0.78rem;
}
.funds-live-pill {
flex-shrink: 0;
+24 -2
View File
@@ -11,6 +11,8 @@
const elDdPct = document.getElementById("funds-total-dd-pct");
const elDelta = document.getElementById("funds-total-delta");
const elMeta = document.getElementById("funds-meta");
const elDescBody = document.getElementById("funds-desc-body");
const elChartSub = document.getElementById("funds-chart-sub");
const elChartHost = document.getElementById("funds-chart-total");
const elAccounts = document.getElementById("funds-accounts");
const elBtnRefresh = document.getElementById("funds-btn-refresh");
@@ -266,7 +268,7 @@
const parts = [
"资金户 + 交易户(不含浮盈)",
"交易日 " + (meta.trading_day || "—"),
"自 " + (meta.history_start_day || "2026-06-09") + " 起",
"自 " + (meta.history_start_day || "") + " 起",
];
elFsSub.textContent = parts.join(" · ");
}
@@ -319,8 +321,28 @@
}
}
function renderDesc(data) {
const start = (data && data.history_start_day) || "—";
const keep = (data && data.keep_days) || 180;
const hour = data && data.reset_hour != null ? data.reset_hour : 8;
if (elDescBody) {
elDescBody.textContent =
"总资金 = 各监控户(资金账户 + 交易账户);自 " +
start +
" 起按北京时间 " +
hour +
":00 交易日切日快照,最多保留 " +
keep +
" 天。起算日由环境变量 HUB_FUND_HISTORY_START_DAY 配置。";
}
if (elChartSub) {
elChartSub.textContent = keep + " TRADING DAYS";
}
}
function renderOverview(data) {
lastOverview = data;
renderDesc(data);
const totals = data.totals || {};
const dd = totals.drawdown || {};
if (elTotal) {
@@ -339,7 +361,7 @@
const parts = [
"交易日 " + (data.trading_day || "—"),
"切日 " + (data.reset_hour != null ? data.reset_hour : 8) + ":00 北京",
"自 " + (data.history_start_day || "2026-06-09") + " 起",
"自 " + (data.history_start_day || "") + " 起",
"最多 " + (data.keep_days || 180) + " 交易日",
];
if (data.updated_at) parts.push("刷新 " + data.updated_at);
+7 -4
View File
@@ -15,7 +15,7 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" media="print" onload="this.media='all'" />
<noscript><link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" /></noscript>
<link rel="stylesheet" href="/assets/app.css?v=20260609-hub-funds-read" />
<link rel="stylesheet" href="/assets/app.css?v=20260609-hub-funds-fold" />
</head>
<body>
<div class="app-bg" aria-hidden="true"></div>
@@ -339,7 +339,10 @@
<div class="page-head funds-head">
<div class="funds-head-main">
<h1><span class="head-tag funds-tag">CAP</span> 资金概况</h1>
<p class="page-desc funds-desc">总资金 = 各监控户(资金账户 + 交易账户);自 2026-06-09 起按北京时间交易日切日快照,最多保留 180 天</p>
<details class="funds-desc-fold">
<summary class="funds-desc-toggle">统计说明</summary>
<p id="funds-desc-body" class="page-desc funds-desc">加载配置中…</p>
</details>
</div>
<div class="funds-live-pill" aria-hidden="true">
<span class="funds-live-dot"></span>
@@ -368,7 +371,7 @@
<div class="funds-chart-panel">
<div class="funds-chart-head">
<span class="funds-chart-tag">EQUITY CURVE</span>
<span class="funds-chart-sub">180 TRADING DAYS</span>
<span id="funds-chart-sub" class="funds-chart-sub"> TRADING DAYS</span>
</div>
<div id="funds-chart-total" class="funds-chart-host"></div>
</div>
@@ -498,7 +501,7 @@
<script src="/assets/chart_draw.js?v=20260609-market-day-split"></script>
<script src="/assets/chart.js?v=20260609-market-day-split"></script>
<script src="/assets/archive.js?v=20260608-hub-archive-history"></script>
<script src="/assets/funds.js?v=20260609-hub-funds-ai"></script>
<script src="/assets/funds.js?v=20260609-hub-funds-fold"></script>
<script src="/assets/ai_review_render.js?v=2"></script>
<script src="/assets/app.js?v=20260609-hub-funds-ai"></script>
</body>