Fix options review light theme dark card/filter styles.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -115,17 +115,17 @@
|
||||
);
|
||||
}
|
||||
|
||||
function pnlStyle(v) {
|
||||
function pnlClass(v) {
|
||||
var n = Number(v);
|
||||
if (n > 0) return "color:#3dd68c";
|
||||
if (n < 0) return "color:#f07178";
|
||||
if (n > 0) return "pos-pnl-profit";
|
||||
if (n < 0) return "pos-pnl-loss";
|
||||
return "";
|
||||
}
|
||||
|
||||
function resultStyle(tag) {
|
||||
function resultClass(tag) {
|
||||
var t = String(tag || "").trim();
|
||||
if (t === "盈利") return "color:#3dd68c;font-weight:600";
|
||||
if (t === "亏损") return "color:#f07178;font-weight:600";
|
||||
if (t === "盈利") return "pos-pnl-profit";
|
||||
if (t === "亏损") return "pos-pnl-loss";
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -395,8 +395,8 @@
|
||||
"<td>" +
|
||||
escapeHtml(tradeTitle(t)) +
|
||||
"</td>" +
|
||||
'<td style="' +
|
||||
pnlStyle(t.realized_pnl_total) +
|
||||
'<td class="' +
|
||||
pnlClass(t.realized_pnl_total) +
|
||||
'">' +
|
||||
fmtPnl(t.realized_pnl_total) +
|
||||
"</td>" +
|
||||
@@ -496,8 +496,8 @@
|
||||
"<td>" +
|
||||
escapeHtml(direction || "—") +
|
||||
"</td>" +
|
||||
'<td style="' +
|
||||
pnlStyle(t.realized_pnl_total) +
|
||||
'<td class="' +
|
||||
pnlClass(t.realized_pnl_total) +
|
||||
'">' +
|
||||
fmtPnl(t.realized_pnl_total) +
|
||||
"</td>" +
|
||||
@@ -516,8 +516,8 @@
|
||||
"<td>" +
|
||||
escapeHtml(entryLogic || "—") +
|
||||
"</td>" +
|
||||
'<td style="' +
|
||||
resultStyle(t.result_tag) +
|
||||
'<td class="' +
|
||||
resultClass(t.result_tag) +
|
||||
'">' +
|
||||
escapeHtml(t.result_tag || "—") +
|
||||
"</td>" +
|
||||
@@ -713,10 +713,20 @@
|
||||
}
|
||||
meta.innerHTML = cells
|
||||
.map(function (pair) {
|
||||
var cls = "";
|
||||
if (pair[0] === "盈亏" || pair[0] === "永续盈亏" || pair[0] === "期权盈亏") {
|
||||
cls = pnlClass(t.realized_pnl_total);
|
||||
if (pair[0] === "永续盈亏") cls = pnlClass(t.realized_pnl_perp);
|
||||
if (pair[0] === "期权盈亏") cls = pnlClass(t.realized_pnl_options);
|
||||
} else if (pair[0] === "结果") {
|
||||
cls = resultClass(e.result_tag);
|
||||
}
|
||||
return (
|
||||
"<div><div class=\"muted\" style=\"font-size:11px\">" +
|
||||
escapeHtml(pair[0]) +
|
||||
"</div><div>" +
|
||||
'</div><div class="' +
|
||||
cls +
|
||||
'">' +
|
||||
escapeHtml(pair[1]) +
|
||||
"</div></div>"
|
||||
);
|
||||
@@ -739,7 +749,9 @@
|
||||
escapeHtml(legRoleLabel(leg.leg_role)) +
|
||||
"</td><td>" +
|
||||
escapeHtml(leg.inst_id || leg.symbol || "") +
|
||||
"</td><td>" +
|
||||
"</td><td class=\"" +
|
||||
pnlClass(leg.realized_pnl) +
|
||||
"\">" +
|
||||
fmtPnl(leg.realized_pnl) +
|
||||
"</td><td>" +
|
||||
escapeHtml(closeReasonLabel(leg.close_reason)) +
|
||||
@@ -811,14 +823,14 @@
|
||||
["平均持有", fmtHold(k.avg_hold_sec)],
|
||||
]
|
||||
.map(function (pair) {
|
||||
var style = "";
|
||||
if (pair[0] === "累计盈亏") style = pnlStyle(k.pnl_sum);
|
||||
if (pair[0] === "平均盈亏") style = pnlStyle(k.avg_pnl);
|
||||
var cls = "";
|
||||
if (pair[0] === "累计盈亏") cls = pnlClass(k.pnl_sum);
|
||||
if (pair[0] === "平均盈亏") cls = pnlClass(k.avg_pnl);
|
||||
return (
|
||||
'<div class="or-kpi-tile"><div class="or-kpi-label">' +
|
||||
pair[0] +
|
||||
'</div><div class="or-kpi-value" style="' +
|
||||
style +
|
||||
'</div><div class="or-kpi-value' +
|
||||
(cls ? " " + cls : "") +
|
||||
'">' +
|
||||
pair[1] +
|
||||
"</div></div>"
|
||||
|
||||
Reference in New Issue
Block a user