- Introduced a new modular structure for the dashboard, enhancing maintainability and scalability. - Created main application entry point in `app_new.py`, integrating all components and callbacks. - Developed layout modules for market data, bot management, performance analytics, and system health in the `layouts` directory. - Implemented callback modules for navigation, charts, indicators, and system health in the `callbacks` directory. - Established reusable UI components in the `components` directory, including chart controls and indicator modals. - Enhanced documentation to reflect the new modular structure and provide clear usage guidelines. - Ensured all components are under 300-400 lines for better readability and maintainability.
32 lines
939 B
Python
32 lines
939 B
Python
"""
|
|
Navigation callbacks for tab switching.
|
|
"""
|
|
|
|
from dash import html, Output, Input
|
|
from dashboard.layouts import (
|
|
get_market_data_layout,
|
|
get_bot_management_layout,
|
|
get_performance_layout,
|
|
get_system_health_layout
|
|
)
|
|
|
|
|
|
def register_navigation_callbacks(app):
|
|
"""Register navigation-related callbacks."""
|
|
|
|
@app.callback(
|
|
Output('tab-content', 'children'),
|
|
Input('main-tabs', 'value')
|
|
)
|
|
def render_tab_content(active_tab):
|
|
"""Render content based on selected tab."""
|
|
if active_tab == 'market-data':
|
|
return get_market_data_layout()
|
|
elif active_tab == 'bot-management':
|
|
return get_bot_management_layout()
|
|
elif active_tab == 'performance':
|
|
return get_performance_layout()
|
|
elif active_tab == 'system-health':
|
|
return get_system_health_layout()
|
|
else:
|
|
return html.Div("Tab not found") |