commit ece083085ccc7f3fde053e6cc6907ec53305f19a
parent 06dfb60bdd9c13e2d0c9843151e3c8ecc380e365
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Wed, 7 Oct 2026 17:16:09 +0530
parent 06dfb60bdd9c13e2d0c9843151e3c8ecc380e365
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Wed, 7 Oct 2026 17:16:09 +0530
Fix TVA chart init and simplify dark mode
2 files changed, 132 insertions(+), 178 deletions(-)
diff --git a/logs.css b/logs.css @@ -567,182 +567,6 @@ td { } } -@media (prefers-color-scheme: dark) { - :root { - color-scheme: dark; - } - - body { - background: #000 !important; - color: #d8e1e7 !important; - } - - .content { - background: #000; - color: #d8e1e7; - } - - h1, - .logs-message, - .dispatch-card, - .device-popover-container, - .range-filter-label, - .date-p p, - .date-p small { - color: #d8e1e7 !important; - } - - a, - .insignificant { - color: #8ec7ff !important; - } - - .log-filter-bar { - background: rgba(18, 25, 31, 0.94); - border-color: rgba(255, 255, 255, 0.06); - box-shadow: none; - } - - .filter-select, - .mobile-panel-switch button { - background: #151d23 !important; - border-color: #344653 !important; - color: #d8e1e7 !important; - } - - .filter-select::placeholder { - color: #748693; - } - - .msg-list-item { - background: transparent !important; - border-bottom-color: #24313a !important; - } - - .msg-list-item:hover { - background: transparent !important; - } - - .msg-item-header, - .msg-item-header small, - .device-name-button { - color: #93a7b4 !important; - } - - .msg-item-header span { - color: #e4edf2; - } - - .date-divider { - background: #000; - } - - .date-p hr { - border-color: #d8e1e7 !important; - } - - .copyable-code { - background: #1c2932 !important; - border-color: #3a4d5b !important; - color: #e8f2f7 !important; - } - - .copyable-code:hover { - background: #263847 !important; - } - - .sim-badge, - .route-line .time, - .route-line .cust-ref, - .invoice-number span, - .cargo-item .kg-badge { - background: #1c2a34 !important; - color: #b8d9ee !important; - border-color: #334b5b !important; - } - - .leakage-alert { - color: #ff7b86 !important; - } - - .msg-list-item[style*="fff5f5"] { - background: #2a1418 !important; - border-left-color: #ff5c6c !important; - } - - .dispatch-card, - .device-popover-container { - background: #121a21 !important; - border-color: #26333d !important; - } - - .card-header, - .card-footer, - .cargo-grid, - table thead th, - tr { - border-color: #26333d !important; - } - - table thead th { - background: #17212a !important; - } - - .lorry-id, - .route-line .from, - .route-line .to, - .cargo-item strong, - .invoice-number, - .value, - table, - th, - td { - color: #d8e1e7 !important; - } - - .lorry-id i, - .route-line i, - .cargo-item i, - .invoice-number i, - .card-footer i { - color: #8db7d0 !important; - } - - .lorry-plate, - .badge-status, - .value { - background: #172530 !important; - border-color: #335066 !important; - color: #c9e3f2 !important; - } - - .cargo-item .qty { - background: rgba(255, 152, 0, 0.14) !important; - border-color: rgba(255, 183, 77, 0.58) !important; - color: #ffd18a !important; - } - - .value .amount { - color: #7ee0a3 !important; - } - - .card-footer, - .range-filter-label { - color: #8fa2ae !important; - } - - .mobile-panel-switch { - background: #111920 !important; - box-shadow: none !important; - } - - .mobile-panel-switch button.active { - background: #e4edf2 !important; - border-color: #e4edf2 !important; - color: #111920 !important; - } -} - .settings-button { margin-left: 10px; @@ -850,6 +674,129 @@ body.logs-dark .copyable-code { color: #e8f2f7 !important; } + +body.logs-dark a, +body.logs-dark .insignificant { + color: #8ec7ff !important; +} + +body.logs-dark .filter-select::placeholder { + color: #748693; +} + +body.logs-dark .msg-list-item:hover { + background: transparent !important; +} + +body.logs-dark .msg-item-header, +body.logs-dark .msg-item-header small, +body.logs-dark .device-name-button { + color: #93a7b4 !important; +} + +body.logs-dark .msg-item-header span { + color: #e4edf2; +} + +body.logs-dark .date-p hr { + border-color: #d8e1e7 !important; +} + +body.logs-dark .copyable-code:hover { + background: #263847 !important; +} + +body.logs-dark .sim-badge, +body.logs-dark .route-line .time, +body.logs-dark .route-line .cust-ref, +body.logs-dark .invoice-number span, +body.logs-dark .cargo-item .kg-badge { + background: #1c2a34 !important; + color: #b8d9ee !important; + border-color: #334b5b !important; +} + +body.logs-dark .leakage-alert { + color: #ff7b86 !important; +} + +body.logs-dark .msg-list-item[style*="fff5f5"] { + background: #2a1418 !important; + border-left-color: #ff5c6c !important; +} + +body.logs-dark .dispatch-card, +body.logs-dark .device-popover-container { + background: #121a21 !important; + border-color: #26333d !important; +} + +body.logs-dark .card-header, +body.logs-dark .card-footer, +body.logs-dark .cargo-grid, +body.logs-dark table thead th, +body.logs-dark tr { + border-color: #26333d !important; +} + +body.logs-dark table thead th { + background: #17212a !important; +} + +body.logs-dark .lorry-id, +body.logs-dark .route-line .from, +body.logs-dark .route-line .to, +body.logs-dark .cargo-item strong, +body.logs-dark .invoice-number, +body.logs-dark .value, +body.logs-dark table, +body.logs-dark th, +body.logs-dark td { + color: #d8e1e7 !important; +} + +body.logs-dark .lorry-id i, +body.logs-dark .route-line i, +body.logs-dark .cargo-item i, +body.logs-dark .invoice-number i, +body.logs-dark .card-footer i { + color: #8db7d0 !important; +} + +body.logs-dark .lorry-plate, +body.logs-dark .badge-status, +body.logs-dark .value { + background: #172530 !important; + border-color: #335066 !important; + color: #c9e3f2 !important; +} + +body.logs-dark .cargo-item .qty { + background: rgba(255, 152, 0, 0.14) !important; + border-color: rgba(255, 183, 77, 0.58) !important; + color: #ffd18a !important; +} + +body.logs-dark .value .amount { + color: #7ee0a3 !important; +} + +body.logs-dark .card-footer, +body.logs-dark .range-filter-label { + color: #8fa2ae !important; +} + +body.logs-dark .mobile-panel-switch { + background: #111920 !important; + box-shadow: none !important; +} + +body.logs-dark .mobile-panel-switch button.active { + background: #e4edf2 !important; + border-color: #e4edf2 !important; + color: #111920 !important; +} + body.logs-light { background: #fff !important; color: #333 !important;
diff --git a/logs.js b/logs.js @@ -74,6 +74,9 @@ const tvaControlConfig = { ] }; +let tvaControl = null; +let pendingTvaControlPatch = null; + const tvaMetrics = { complaintsOpen: 0, invoiceActions: 2, @@ -236,8 +239,11 @@ window.getTvaControlData = function() { }; function applyLogsSettingsToDom() { - document.body.classList.toggle('logs-dark', logsSettings.theme === 'dark'); - document.body.classList.toggle('logs-light', logsSettings.theme === 'light'); + const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; + const dark = logsSettings.theme === 'dark' || (logsSettings.theme === 'auto' && prefersDark); + const light = logsSettings.theme === 'light' || (logsSettings.theme === 'auto' && !prefersDark); + document.body.classList.toggle('logs-dark', dark); + document.body.classList.toggle('logs-light', light); document.querySelectorAll('.action-chart-container, .tva-control-container').forEach(container => { if (logsSettings.theme === 'auto') container.removeAttribute('data-tva-theme'); else container.dataset.tvaTheme = logsSettings.theme; @@ -1076,6 +1082,7 @@ fetchUpdates(); // logs.js runs before <ul id="action-list"> exists in the DOM (script tag comes before .content), // so action-required polling starts after the parser has created that panel. document.addEventListener("DOMContentLoaded", () => { + if (window.matchMedia) window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', applyLogsSettingsToDom); initLogsSettingsDialog(); applyLogsSettingsToDom(); initRangeFields();
: asapien/superpulse