From: Chris H Date: Fri, 27 Feb 2026 20:00:46 +0000 (+0100) Subject: Intégration du script.js depuis branche oceane-web X-Git-Url: https://git.digitality.be/?a=commitdiff_plain;h=2b76a53b4d057d869505f82b0353db5b133351af;p=pdw25-26 Intégration du script.js depuis branche oceane-web --- diff --git a/Wallette/web/script.js b/Wallette/web/script.js index 2decdf7..8e7e31e 100644 --- a/Wallette/web/script.js +++ b/Wallette/web/script.js @@ -74,6 +74,63 @@ onAlert(function(alert) { setTimeout(() => pop.remove(), 6000); } + if (typeof alert === 'object') { + + // Date & heure + const d = new Date(alert.timestamp || Date.now()); + const dateStr = d.toLocaleString('fr-FR', { + day: '2-digit', + month: '2-digit', + year: 'numeric', + hour: '2-digit', + minute: '2-digit' + }); + + // Level + const level = alert.alertLevel || alert.level || 'INFO'; + + // Action + const action = alert.action || 'HOLD'; + + // Prix (si présent) + let priceStr = ''; + if (alert.price !== undefined) { + const currency = (alert.pair && alert.pair.includes('USD')) ? 'USD' : 'EUR'; + priceStr = Number(alert.price).toLocaleString('fr-FR', { + style: 'currency', + currency: currency + }); + } + + // Pair + confiance + const pair = alert.pair || ''; + const conf = typeof alert.confidence === 'number' + ? ` • confiance ${Math.round(alert.confidence * 100)}%` + : ''; + + // Badge couleur level + let badgeClass = 'bg-primary'; + const lvl = level.toUpperCase(); + + if (lvl.includes('DANGER') || lvl.includes('CRITICAL')) badgeClass = 'bg-danger'; + else if (lvl.includes('WARNING')) badgeClass = 'bg-warning text-dark'; + else if (lvl.includes('INFO')) badgeClass = 'bg-info text-dark'; + + // Appliquer affichage formaté (remplace le texte brut) + li.innerHTML = ` +
+ ${dateStr} + ${lvl} + ${action} + ${priceStr ? `${priceStr}` : ''} +
+
+ ${pair}${conf} +
+ `; + } + + // Préfixer pour voir les nouvelles alertes en haut list.prepend(li); });