Add status column with blinking dots, widen shell, risk/open format.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-02 12:07:42 +08:00
parent 46a861d311
commit ec3156021a
2 changed files with 80 additions and 28 deletions
+18 -9
View File
@@ -106,7 +106,7 @@ type RiskLines = {
lossPct: string | null;
exit: string;
openRatio: string | null;
/** 表格「风险/开仓」列:以损显示风险%;手动显示名义比 */
/** 表格「风险/开仓」列:如 5%/1:2;手动为 —/名义比 */
riskOrOpen: string;
leverage: string;
};
@@ -144,7 +144,7 @@ function riskLines(strat: Record<string, unknown>): RiskLines {
const openRatio = riskBased
? `${unitLabel(strat.risk_perp_unit)}:${unitLabel(strat.risk_option_unit)}`
: `${unitLabel(strat.perp_qty_eth)}:${unitLabel(strat.option_qty_eth)}`;
const riskOrOpen = riskBased ? lossPct || "—" : openRatio;
const riskOrOpen = `${lossPct || "—"}/${openRatio}`;
return {
riskBased,
sizing: riskBased ? "以损定仓" : "手动仓位",
@@ -516,6 +516,7 @@ export default function MonitorPage() {
<th className="col-check">
<span className="sr-only"></span>
</th>
<th className="col-status"></th>
<th></th>
<th></th>
<th></th>
@@ -550,30 +551,38 @@ export default function MonitorPage() {
aria-label={`选择 ${n.name}`}
/>
</td>
<td>
<div className="machine-cell">
<td className="col-status">
<div
className="status-dots"
title={`在线:${n.online ? "是" : "否"} · ${tokenDotTitle(n)} · ${running ? "运行中" : "已停"}`}
>
<span
className={`dot ${n.online ? "ok" : "bad"}`}
className={`dot pulse d1 ${n.online ? "ok" : "bad"}`}
title={n.online ? "在线" : "离线"}
/>
<span
className={tokenDotClass(n)}
className={`dot pulse d2 ${tokenDotClass(n).replace("dot ", "")}`}
title={tokenDotTitle(n)}
/>
<span
className={`run-dot ${running ? "ok" : "bad"}`}
className={`dot pulse d3 ${running ? "ok" : "bad"}`}
title={running ? "运行中" : "已停"}
/>
<strong className="machine-name">{n.name}</strong>
</div>
</td>
<td>
<strong className="machine-name">{n.name}</strong>
</td>
<td className="mono">{modeLabel(s.mode, s.strat)}</td>
<td className="mono">{s.exchange}</td>
<td className={inPos ? "pnl-pos" : "pnl-neg"}>
{inPos ? "持仓中" : "无持仓"}
</td>
<td className="mono">{s.rounds ?? "—"}</td>
<td className="mono" title={risk.riskBased ? "风险比例" : "开仓比例"}>
<td
className="mono"
title="风险比例 / 开仓比例"
>
{risk.riskOrOpen}
</td>
<td className="mono">{risk.exit}</td>