Add tab system to right sidebar with Indicators and Strategies

- Add two-tab navigation (Indicators, Strategies) in right sidebar
- Move all strategy-related content to Strategies tab
- Implement sidebar collapse/expand functionality
- Add indicator visibility toggle (eye button)
- Fix bug where wrong interval data was deleted on TF switch
- Add localStorage persistence for sidebar state and active tab
- Ensure indicators recalculate when TF changes
This commit is contained in:
DiTus
2026-02-26 14:56:03 +01:00
parent 6e21be6523
commit 5f84215acd
6 changed files with 319 additions and 143 deletions

View File

@ -1,5 +1,5 @@
import { TradingDashboard, refreshTA, openAIAnalysis } from './ui/chart.js';
import { restoreSidebarState, toggleSidebar } from './ui/sidebar.js';
import { restoreSidebarState, toggleSidebar, initSidebarTabs, restoreSidebarTabState } from './ui/sidebar.js';
import { SimulationStorage } from './ui/storage.js';
import { showExportDialog, closeExportDialog, performExport, exportSavedSimulation } from './ui/export.js';
import {
@ -70,7 +70,6 @@ window.renderIndicatorList = function() {
// Export init function for global access
window.initIndicatorPanel = initIndicatorPanel;
window.initIndicatorPanel = initIndicatorPanel;
window.addIndicator = addIndicator;
window.toggleIndicator = addIndicator;
@ -81,6 +80,8 @@ window.IndicatorRegistry = IndicatorRegistry;
document.addEventListener('DOMContentLoaded', async () => {
window.dashboard = new TradingDashboard();
restoreSidebarState();
restoreSidebarTabState();
initSidebarTabs();
setDefaultStartDate();
updateTimeframeDisplay();
renderSavedSimulations();
@ -93,6 +94,24 @@ document.addEventListener('DOMContentLoaded', async () => {
const originalSwitchTimeframe = window.dashboard.switchTimeframe.bind(window.dashboard);
window.dashboard.switchTimeframe = function(interval) {
originalSwitchTimeframe(interval);
setTimeout(() => drawIndicatorsOnChart(), 500);
// Force redraw indicators after TF switch with multiple attempts
setTimeout(() => {
if (window.drawIndicatorsOnChart) {
window.drawIndicatorsOnChart();
}
}, 100);
setTimeout(() => {
if (window.drawIndicatorsOnChart) {
window.drawIndicatorsOnChart();
}
}, 300);
setTimeout(() => {
if (window.drawIndicatorsOnChart) {
window.drawIndicatorsOnChart();
}
}, 500);
};
});