From: [oceane] <[e21497@eps-marche.be]> Date: Fri, 27 Feb 2026 19:21:55 +0000 (+0100) Subject: mise à jour du script.js X-Git-Url: https://git.digitality.be/?a=commitdiff_plain;h=a429de0c5eb5b9318f2f3c457019d5ff17b8e978;p=pdw25-26 mise à jour du script.js --- 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 = ` +