From c6f3555bd32ec9199df487ec500020be86f55db1 Mon Sep 17 00:00:00 2001 From: fanziqi <403508380@qq.com> Date: Fri, 13 Mar 2026 18:38:31 +0800 Subject: [PATCH] feat(frontend): add position filter to strategy plaza --- frontend/app/strategy-plaza/page.tsx | 29 +++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/frontend/app/strategy-plaza/page.tsx b/frontend/app/strategy-plaza/page.tsx index bf67953..ef502f7 100644 --- a/frontend/app/strategy-plaza/page.tsx +++ b/frontend/app/strategy-plaza/page.tsx @@ -320,11 +320,13 @@ export default function StrategyPlazaPage() { type SymbolFilter = "ALL" | "BTCUSDT" | "ETHUSDT" | "XRPUSDT" | "SOLUSDT"; type StatusFilter = "all" | "running" | "paused" | "error"; type PnlFilter = "all" | "positive" | "negative"; + type PositionFilter = "all" | "with_open" | "no_open"; type SortKey = "recent" | "net_usdt_desc" | "net_usdt_asc" | "pnl24h_desc" | "pnl24h_asc"; const [symbolFilter, setSymbolFilter] = useState("ALL"); const [statusFilter, setStatusFilter] = useState("all"); const [pnlFilter, setPnlFilter] = useState("all"); + const [positionFilter, setPositionFilter] = useState("all"); const [sortKey, setSortKey] = useState("net_usdt_desc"); const fetchData = useCallback(async () => { @@ -366,6 +368,8 @@ export default function StrategyPlazaPage() { if (statusFilter !== "all" && s.status !== statusFilter) return false; if (pnlFilter === "positive" && s.net_usdt <= 0) return false; if (pnlFilter === "negative" && s.net_usdt >= 0) return false; + if (positionFilter === "with_open" && s.open_positions <= 0) return false; + if (positionFilter === "no_open" && s.open_positions > 0) return false; return true; }) .sort((a, b) => { @@ -469,7 +473,7 @@ export default function StrategyPlazaPage() { - {/* 右侧:状态 + 排序 */} + {/* 右侧:状态 + 持仓 + 排序 */}
状态: @@ -495,6 +499,29 @@ export default function StrategyPlazaPage() { ); })}
+
+ 持仓: + {[ + { key: "all" as PositionFilter, label: "全部" }, + { key: "with_open" as PositionFilter, label: "有持仓" }, + { key: "no_open" as PositionFilter, label: "无持仓" }, + ].map((opt) => { + const active = positionFilter === opt.key; + return ( + + ); + })} +
排序: