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

@ -854,22 +854,22 @@ export function drawIndicatorsOnChart() {
const candles = window.dashboard?.allData?.get(currentInterval);
if (!candles || candles.length === 0) {
console.log('[Indicators] No candles available');
//console.log('[Indicators] No candles available');
return;
}
console.log(`[Indicators] ========== drawIndicatorsOnChart START ==========`);
console.log(`[Indicators] Candles from allData: ${candles.length}`);
console.log(`[Indicators] First candle time: ${candles[0]?.time} (${new Date(candles[0]?.time * 1000).toLocaleDateString()})`);
console.log(`[Indicators] Last candle time: ${candles[candles.length - 1]?.time} (${new Date(candles[candles.length - 1]?.time * 1000).toLocaleDateString()})`);
// console.log(`[Indicators] ========== drawIndicatorsOnChart START ==========`);
// console.log(`[Indicators] Candles from allData: ${candles.length}`);
// console.log(`[Indicators] First candle time: ${candles[0]?.time} (${new Date(candles[0]?.time * 1000).toLocaleDateString()})`);
// console.log(`[Indicators] Last candle time: ${candles[candles.length - 1]?.time} (${new Date(candles[candles.length - 1]?.time * 1000).toLocaleDateString()})`);
const oldestTime = candles[0]?.time;
const newestTime = candles[candles.length - 1]?.time;
const oldestDate = oldestTime ? new Date(oldestTime * 1000).toLocaleDateString() : 'N/A';
const newestDate = newestTime ? new Date(newestTime * 1000).toLocaleDateString() : 'N/A';
console.log(`[Indicators] ========== Redrawing ==========`);
console.log(`[Indicators] Candles: ${candles.length} | Time range: ${oldestDate} (${oldestTime}) to ${newestDate} (${newestTime})`);
//console.log(`[Indicators] ========== Redrawing ==========`);
// console.log(`[Indicators] Candles: ${candles.length} | Time range: ${oldestDate} (${oldestTime}) to ${newestDate} (${newestTime})`);
const activeIndicators = getActiveIndicators();
@ -929,14 +929,14 @@ export function drawIndicatorsOnChart() {
window.dashboard.chart.panes()[0]?.setHeight(mainPaneHeight);
console.log(`[Indicators] ========== Rendering Indicators ==========`);
console.log(`[Indicators] Input candles: ${candles.length} | Panel count: ${totalPanes}`);
//console.log(`[Indicators] ========== Rendering Indicators ==========`);
//console.log(`[Indicators] Input candles: ${candles.length} | Panel count: ${totalPanes}`);
overlayIndicators.forEach(({ indicator, meta, instance }) => {
console.log(`[Indicators] Processing overlay: ${indicator.name}`);
console.log(`[Indicators] Before renderIndicatorOnPane: indicator.cachedResults length = ${indicator.cachedResults?.length || 0}`);
//console.log(`[Indicators] Processing overlay: ${indicator.name}`);
//console.log(`[Indicators] Before renderIndicatorOnPane: indicator.cachedResults length = ${indicator.cachedResults?.length || 0}`);
renderIndicatorOnPane(indicator, meta, instance, candles, 0, lineStyleMap);
console.log(`[Indicators] After renderIndicatorOnPane: indicator.cachedResults length = ${indicator.cachedResults?.length || 0}`);
//console.log(`[Indicators] After renderIndicatorOnPane: indicator.cachedResults length = ${indicator.cachedResults?.length || 0}`);
});
paneIndicators.forEach(({ indicator, meta, instance }, idx) => {
@ -947,10 +947,10 @@ export function drawIndicatorsOnChart() {
indicatorPanes.set(indicator.id, paneIndex);
}
console.log(`[Indicators] Processing pane: ${indicator.name} (pane ${paneIndex})`);
console.log(`[Indicators] Before renderIndicatorOnPane: indicator.cachedResults length = ${indicator.cachedResults?.length || 0}`);
//console.log(`[Indicators] Processing pane: ${indicator.name} (pane ${paneIndex})`);
//console.log(`[Indicators] Before renderIndicatorOnPane: indicator.cachedResults length = ${indicator.cachedResults?.length || 0}`);
renderIndicatorOnPane(indicator, meta, instance, candles, paneIndex, lineStyleMap);
console.log(`[Indicators] After renderIndicatorOnPane: indicator.cachedResults length = ${indicator.cachedResults?.length || 0}`);
//console.log(`[Indicators] After renderIndicatorOnPane: indicator.cachedResults length = ${indicator.cachedResults?.length || 0}`);
const pane = window.dashboard.chart.panes()[paneIndex];
if (pane) {
@ -959,27 +959,10 @@ export function drawIndicatorsOnChart() {
parseInt(localStorage.getItem(`pane_height_${indicator.type}`)) ||
120;
pane.setHeight(storedHeight);
// Subscribe to pane height changes to save to localStorage
const originalHeight = storedHeight;
const paneElement = pane.getHTMLElement && pane.getHTMLElement();
if (paneElement) {
const resizeObserver = new ResizeObserver((entries) => {
for (const entry of entries) {
const newHeight = Math.round(entry.contentRect.height);
if (newHeight !== originalHeight && newHeight > 50) {
indicator.paneHeight = newHeight;
localStorage.setItem(`pane_height_${indicator.type}`, newHeight);
console.log(`[Indicators] Saved pane height for ${indicator.type}: ${newHeight}px`);
}
}
});
resizeObserver.observe(paneElement);
}
}
});
console.log(`[Indicators] ========== drawIndicatorsOnChart END ==========`);
//console.log(`[Indicators] ========== drawIndicatorsOnChart END ==========`);
} catch (error) {
console.error('[Indicators] Error drawing indicators:', error);
}