feat: dark/light mode + trading console BI + Chart.js local + fix themeScript
- Dark/light mode toggle across all pages (login, dashboard, corporate, admin, BI) - BI Executive redesigned as permanent dark trading console (Bloomberg-style) - Floating vertical nav with anchor scroll for mobile navigation - Chart.js bundled locally (eliminates CDN dependency) - Chart.js inlined in HTML for guaranteed loading - Fix: themeScript </script> tag had literal backslash breaking HTML parser - Fix: each chart wrapped in individual try/catch for graceful degradation - No-cache headers on BI page to prevent stale HTML - Robust init that handles DOMContentLoaded already fired Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* Gera HTML do dashboard — parametrizado por agente
|
||||
* Updated: 2026-02-09 - 4 decimal places for spread
|
||||
*/
|
||||
const { buildHeader, buildFooter, buildHead } = require('./ui-template');
|
||||
const { buildHeader, buildFooter, buildHead, getChartJsScript } = require('./ui-template');
|
||||
|
||||
function buildHTML(data, agente, isAgentDashboard = true, diasPeriodo = null, asyncLoad = false, isEmulating = false) {
|
||||
const now = new Date().toLocaleString('pt-BR');
|
||||
@@ -13,7 +13,7 @@ function buildHTML(data, agente, isAgentDashboard = true, diasPeriodo = null, as
|
||||
// Determine the back URL based on emulator's role
|
||||
const backUrl = emulatorRole === 'corporate' ? '/corporate' : '/admin';
|
||||
|
||||
const pageScripts = `<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js"><\/script>`;
|
||||
const pageScripts = getChartJsScript();
|
||||
|
||||
const dashboardCSS = `
|
||||
/* Emulation Banner */
|
||||
@@ -386,6 +386,22 @@ function buildHTML(data, agente, isAgentDashboard = true, diasPeriodo = null, as
|
||||
.portfolio-kpi-grid { grid-template-columns: 1fr; }
|
||||
.netting-kpi-grid { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
/* Dark Mode overrides */
|
||||
[data-theme="dark"] thead th { background: var(--bg); }
|
||||
[data-theme="dark"] tbody td { border-bottom-color: var(--border); }
|
||||
[data-theme="dark"] tbody tr:hover { background: rgba(255,255,255,0.04); }
|
||||
[data-theme="dark"] tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
|
||||
[data-theme="dark"] tbody tr:nth-child(even):hover { background: rgba(255,255,255,0.04); }
|
||||
[data-theme="dark"] .kpi-card .kpi-change.neutral { background: var(--border); }
|
||||
[data-theme="dark"] .kpi-card .kpi-change.down { background: rgba(248,81,73,0.15); color: var(--red); }
|
||||
[data-theme="dark"] .filters { background: var(--card); border-bottom-color: var(--border); }
|
||||
[data-theme="dark"] .filters input,
|
||||
[data-theme="dark"] .filters select { background: var(--bg); color: var(--text); border-color: var(--border); }
|
||||
[data-theme="dark"] .btn-export { background: var(--green); }
|
||||
[data-theme="dark"] .recency-red { background: rgba(248,81,73,0.15) !important; color: var(--red); }
|
||||
[data-theme="dark"] .spread-low { background: rgba(248,81,73,0.15) !important; color: var(--red); }
|
||||
[data-theme="dark"] .spread-negative { background: var(--red) !important; }
|
||||
`;
|
||||
|
||||
return `<!DOCTYPE html>
|
||||
|
||||
Reference in New Issue
Block a user