feat: add total bet amount card
This commit is contained in:
parent
956469460c
commit
1c011c38b8
@ -30,6 +30,7 @@ const statusVariant: Record<string, "default" | "secondary" | "destructive"> = {
|
|||||||
export default async function TradesPage() {
|
export default async function TradesPage() {
|
||||||
const [rows, stats] = await Promise.all([getTrades(), getStats()]);
|
const [rows, stats] = await Promise.all([getTrades(), getStats()]);
|
||||||
const statsMap = Object.fromEntries(stats.map((s: any[]) => [s[0], s[1]]));
|
const statsMap = Object.fromEntries(stats.map((s: any[]) => [s[0], s[1]]));
|
||||||
|
const totalBetAmount = rows.reduce((sum: number, r: any[]) => sum + (Number(r[4]) || 0), 0);
|
||||||
const totalPnl = rows.reduce((sum: number, r: any[]) => sum + (r[7] || 0), 0);
|
const totalPnl = rows.reduce((sum: number, r: any[]) => sum + (r[7] || 0), 0);
|
||||||
const expectedTotalProfit = rows
|
const expectedTotalProfit = rows
|
||||||
.filter((r: any[]) => r[6] === "open")
|
.filter((r: any[]) => r[6] === "open")
|
||||||
@ -42,7 +43,13 @@ export default async function TradesPage() {
|
|||||||
<p className="text-muted-foreground text-sm mt-1">信号验证 — 模拟下注记录(每注 $1)</p>
|
<p className="text-muted-foreground text-sm mt-1">信号验证 — 模拟下注记录(每注 $1)</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-2 md:grid-cols-5 gap-3">
|
<div className="grid grid-cols-2 md:grid-cols-6 gap-3">
|
||||||
|
<Card>
|
||||||
|
<CardContent className="pt-4 pb-4">
|
||||||
|
<div className="text-xs text-muted-foreground">总下注金额</div>
|
||||||
|
<div className="text-2xl font-bold mt-1">${totalBetAmount.toFixed(2)}</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
<Card>
|
<Card>
|
||||||
<CardContent className="pt-4 pb-4">
|
<CardContent className="pt-4 pb-4">
|
||||||
<div className="text-xs text-muted-foreground">总注单</div>
|
<div className="text-xs text-muted-foreground">总注单</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user