added centralized timezone config with UI selector in hamburger menu

This commit is contained in:
DiTus
2026-03-02 08:55:16 +01:00
parent 87b7cea567
commit 767c0bef67
6 changed files with 217 additions and 49 deletions

View File

@ -9,12 +9,14 @@ import {
removeIndicatorById
} from './ui/indicators-panel-new.js';
import { IndicatorRegistry } from './indicators/index.js';
import { TimezoneConfig } from './config/timezone.js';
window.dashboard = null;
window.toggleSidebar = toggleSidebar;
window.refreshTA = refreshTA;
window.openAIAnalysis = openAIAnalysis;
window.TimezoneConfig = TimezoneConfig;
window.renderIndicatorList = function() {
// This function is no longer needed for sidebar indicators
};
@ -35,6 +37,39 @@ document.addEventListener('DOMContentLoaded', async () => {
toggleBtn.addEventListener('click', toggleSidebar);
}
// Initialize timezone selector
const timezoneSelect = document.getElementById('timezoneSelect');
const settingsPopup = document.getElementById('settingsPopup');
const settingsBtn = document.getElementById('btnSettings');
if (timezoneSelect) {
timezoneSelect.value = TimezoneConfig.getTimezone();
timezoneSelect.addEventListener('change', (e) => {
TimezoneConfig.setTimezone(e.target.value);
settingsPopup.classList.remove('show');
// Redraw chart and indicators
if (window.dashboard) {
window.drawIndicatorsOnChart?.();
}
});
}
// Toggle settings popup
if (settingsBtn && settingsPopup) {
settingsBtn.addEventListener('click', (e) => {
e.stopPropagation();
settingsPopup.classList.toggle('show');
});
settingsPopup.addEventListener('click', (e) => {
e.stopPropagation();
});
document.addEventListener('click', () => {
settingsPopup.classList.remove('show');
});
}
window.dashboard = new TradingDashboard();
restoreSidebarState();
restoreSidebarTabState();