diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 8ce7b5f..d656d55 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -354,29 +354,20 @@ export default function Dashboard() {
{withPnl.length} pricés
-
-
-
Ouvert
-
{openTrades.length}
-
-
-
Fermé
-
{closedTrades.length}
-
- {totalCapital > 0 && ( -
-
Capital
-
{totalCapital.toFixed(0)}€
+
+
+
Investi
+
+ {totalCapital > 0 ? `${totalCapital.toFixed(0)}€` : '—'}
- )} - {totalCapital > 0 && ( -
-
Profit
-
= 0 ? 'text-emerald-400' : 'text-red-400')}> - {totalProfit >= 0 ? '+' : ''}{totalProfit.toFixed(0)}€ -
+
+
+
P&L €
+
= 0 ? 'text-emerald-400' : 'text-red-400')}> + {totalCapital > 0 ? `${totalProfit >= 0 ? '+' : ''}${totalProfit.toFixed(0)}€` : '—'}
- )} +
) : ( @@ -489,22 +480,22 @@ export default function Dashboard() {
{elapsedStr}
{last ? ( <> -
-
-
+{patternsAdded}
-
patterns
+
+
+
+{patternsAdded}
+
patterns ajoutés
-
-
{patternsScored}
-
scorés
+
+
{tradesLogged}
+
trades loggés
-
-
{tradesLogged}
-
loggés
+
+
{patternsScored}
+
scorés
-
-
{tradesClosed}
-
fermés
+
+
{tradesClosed}
+
fermés
{commentary?.commentary && ( @@ -600,39 +591,66 @@ export default function Dashboard() { {/* Trades du dernier cycle — détaillé */} {(() => { - const patternsAdded: number = lastCycle?.patterns_added ?? 0 + const tradeCount = cycleTrades.length + // Build a map: pattern_id → trade for quick lookup + const tradeByPattern: Record = {} + for (const t of cycleTrades) { + if (t.pattern_id) tradeByPattern[t.pattern_id] = t + } + // Show cyclePatterns with their trade status (loggé or not) + const rows = cyclePatterns.length > 0 + ? cyclePatterns + : cycleTrades.map((t: any) => ({ id: t.pattern_id, name: t.pattern_name })) return (
📥 Trades du cycle
-
+{patternsAdded} patterns
- {cycleTrades.length > 0 ? ( -
- {cycleTrades.slice(0, 3).map((t: any, i) => { - const pnl: number | null = t.pnl_pct ?? null - const ev: number | null = t.ev_net ?? t.ev_at_entry ?? null - const isBear = t.strategy?.toLowerCase().includes('put') || t.strategy?.toLowerCase().includes('bear') +
+ {tradeCount > 0 ? `+${tradeCount} Trade${tradeCount > 1 ? 's' : ''}` : lastCycle ? '+0 Trades' : '—'} +
+ {rows.length > 0 ? ( +
+ {rows.slice(0, 3).map((p: any, i: number) => { + const t = tradeByPattern[p.id] + const logged = !!t + const ev: number | null = t?.ev_net ?? t?.ev_at_entry ?? null + const score: number | null = t?.score_at_entry ?? scoreMap[p.id]?.score ?? null + const pnl: number | null = t?.pnl_pct ?? null + const isBear = t?.strategy?.toLowerCase().includes('put') || t?.strategy?.toLowerCase().includes('bear') return ( -
- {isBear ? '🐻' : '🐂'} - {t.underlying ?? '—'} - {t.strategy ?? ''} - {ev !== null && ( - = 0.5 ? 'text-emerald-400' : ev >= 0 ? 'text-yellow-400' : 'text-red-400')}> - EV{ev >= 0 ? '+' : ''}{ev.toFixed(2)} +
+ {/* Pattern name (origin) */} +
+ + {logged ? '✓' : '○'} + {p.name} + {score !== null && ( + {score} + )} +
+ {/* Trade details if logged */} + {logged && ( +
+ {isBear ? '🐻' : '🐂'} + {t.underlying ?? '—'} + {t.strategy ?? ''} + {ev !== null && ( + = 0.5 ? 'text-emerald-400' : ev >= 0 ? 'text-yellow-400' : 'text-red-400')}> + EV{ev >= 0 ? '+' : ''}{ev.toFixed(2)} + + )} + {pnl !== null && ( + = 0 ? 'text-emerald-400' : 'text-red-400')}> + {pnl >= 0 ? '+' : ''}{pnl.toFixed(1)}% + + )} +
)} - {t.score_at_entry != null && ( - - {t.score_at_entry} - - )} - {pnl !== null && ( - = 0 ? 'text-emerald-400' : 'text-red-400')}> - {pnl >= 0 ? '+' : ''}{pnl.toFixed(1)}% - + {!logged && ( +
score insuffisant — non loggé
)}
) @@ -640,7 +658,7 @@ export default function Dashboard() {
) : (
- {scoringRunId ? 'Aucun trade loggé ce cycle' : 'En attente du prochain cycle'} + {lastCycle ? 'Aucun pattern ajouté ce cycle' : 'En attente du prochain cycle'}
)}