feat: add multi-asset sidebar (BTC, USD, XAU) with asset switching

- Added sidebar navigation with 3 tabs: Bitcoin, Dólar, Ouro
- Added switchAsset() function to switch between assets
- Updated CSS with sidebar layout (fixed 200px sidebar)
- Updated script.js with asset state management
- Sync sidebar clock and status with main header
- BTC remains default active tab
This commit is contained in:
2026-06-15 16:31:17 +00:00
parent e39c5586d7
commit 1e3f2e7199
3 changed files with 153 additions and 7 deletions
+36
View File
@@ -7,13 +7,44 @@
let autoMode = false;
let autoInterval = null;
let pollInterval = null;
let currentAsset = 'btc'; // 'btc', 'usd', 'xau'
const AGENT_EMOJIS = { brief: "📊", decio: "🎯", papert: "⚡", audit: "🔍" };
const AGENT_COLORS = { brief: "#4fc3f7", decio: "#ffd54f", papert: "#69f0ae", audit: "#b388ff" };
// ── Asset Switching ───────────────────────────────────────────────────────────
const ASSET_SYMBOLS = { btc: '₿', usd: '💵', xau: '🪙' };
const ASSET_LABELS = { btc: 'Bitcoin', usd: 'Dólar', xau: 'Ouro' };
const ASSET_PAIRS = { btc: 'BTC/USD', usd: 'USD/BRL', xau: 'XAU/USD' };
function switchAsset(asset, btnEl) {
if (asset === currentAsset) return;
currentAsset = asset;
// Update sidebar buttons
document.querySelectorAll('.sidebar-btn').forEach(b => b.classList.remove('active'));
if (btnEl) btnEl.classList.add('active');
// Update header title dynamically
const titleEl = document.querySelector('.logo-text strong');
if (titleEl) titleEl.textContent = asset.toUpperCase();
// Reload data for new asset
loadConfig();
loadPortfolio();
loadMultiStratChart('live');
addLog('SYS', `Ativo alterado para ${ASSET_LABELS[asset]} (${ASSET_PAIRS[asset]})`);
}
// ── Init ─────────────────────────────────────────────────────────────────────
document.addEventListener('DOMContentLoaded', () => {
updateClock();
setInterval(updateClock, 1000);
// Sidebar clock
setInterval(() => {
const now = new Date();
const el = document.getElementById('sidebarClock');
if (el) el.textContent = now.toLocaleTimeString('pt-BR', { hour: '2-digit', minute: '2-digit' });
}, 1000);
startPolling();
loadAgentRegistry();
loadMetrics();
@@ -75,6 +106,11 @@ function updateStatus(text, type) {
const txt = document.getElementById('statusText');
if (dot) dot.className = `status-dot ${type}`;
if (txt) txt.textContent = text;
// Sync sidebar status
const sidebarDot = document.getElementById('sidebarStatusDot');
const sidebarTxt = document.getElementById('sidebarStatusText');
if (sidebarDot) sidebarDot.className = `status-dot ${type}`;
if (sidebarTxt) sidebarTxt.textContent = text;
}
// ── Pipeline ─────────────────────────────────────────────────────────────────