Fix dashboard loading and maximize chart area
- Fixed TA panel loading state - now waits for initial data before loading technical analysis - Changed initial loading message from 'Loading technical analysis...' to 'Waiting for candle data...' - Made strategy simulation sidebar collapsed by default to maximize chart area - Added refresh timestamp to TA panel when manually refreshed - Improved error messages for when data isn't available in database
This commit is contained in:
@ -1344,13 +1344,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="ta-content" id="taContent">
|
||||
<div class="ta-loading">Loading technical analysis...</div>
|
||||
<div class="ta-loading">Waiting for candle data...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right Sidebar - Strategy Simulation -->
|
||||
<div class="right-sidebar" id="rightSidebar">
|
||||
<div class="right-sidebar collapsed" id="rightSidebar">
|
||||
<div class="sidebar-header">
|
||||
<div class="sidebar-title">
|
||||
<span>🎯</span>
|
||||
|
||||
@ -290,6 +290,7 @@ export class TradingDashboard {
|
||||
this.loadStats()
|
||||
]);
|
||||
this.hasInitialLoad = true;
|
||||
this.loadTA();
|
||||
}
|
||||
|
||||
async loadData(limit = 1000, fitToContent = false) {
|
||||
@ -465,13 +466,26 @@ export class TradingDashboard {
|
||||
}
|
||||
|
||||
async loadTA() {
|
||||
if (!this.hasInitialLoad) {
|
||||
const time = new Date().toLocaleTimeString();
|
||||
document.getElementById('taContent').innerHTML = `<div class="ta-loading">Loading technical analysis... ${time}</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/v1/ta?symbol=BTC&interval=${this.currentInterval}`);
|
||||
this.taData = await response.json();
|
||||
const data = await response.json();
|
||||
|
||||
if (data.error) {
|
||||
document.getElementById('taContent').innerHTML = `<div class="ta-error">${data.error}</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
this.taData = data;
|
||||
this.renderTA();
|
||||
} catch (error) {
|
||||
console.error('Error loading TA:', error);
|
||||
document.getElementById('taContent').innerHTML = '<div class="ta-error">Failed to load technical analysis</div>';
|
||||
document.getElementById('taContent').innerHTML = '<div class="ta-error">Failed to load technical analysis. Please check if the database has candle data.</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -590,6 +604,8 @@ export class TradingDashboard {
|
||||
|
||||
export function refreshTA() {
|
||||
if (window.dashboard) {
|
||||
const time = new Date().toLocaleTimeString();
|
||||
document.getElementById('taContent').innerHTML = `<div class="ta-loading">Refreshing... ${time}</div>`;
|
||||
window.dashboard.loadTA();
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,8 +16,9 @@ export function toggleSidebar() {
|
||||
}
|
||||
|
||||
export function restoreSidebarState() {
|
||||
const collapsed = localStorage.getItem('sidebar_collapsed') === 'true';
|
||||
if (collapsed) {
|
||||
document.getElementById('rightSidebar').classList.add('collapsed');
|
||||
const collapsed = localStorage.getItem('sidebar_collapsed') !== 'false'; // Default to collapsed
|
||||
const sidebar = document.getElementById('rightSidebar');
|
||||
if (collapsed && sidebar) {
|
||||
sidebar.classList.add('collapsed');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user