Update pages/dashboard.py
Browse files- pages/dashboard.py +21 -2
pages/dashboard.py
CHANGED
@@ -6,9 +6,8 @@ Fixed version with proper imports and error handling
|
|
6 |
import streamlit as st
|
7 |
import pandas as pd
|
8 |
import plotly.express as px
|
9 |
-
import plotly.graph_objects as go
|
10 |
from datetime import datetime
|
11 |
-
from typing import Dict, List,
|
12 |
|
13 |
from utils.storage import load_data, save_data, get_cached_data, set_cached_data
|
14 |
from utils.error_handling import handle_data_exceptions, ValidationError, DataError
|
@@ -93,3 +92,23 @@ def create_activity_chart(activity_data: List[Dict]) -> None:
|
|
93 |
)
|
94 |
|
95 |
st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
import streamlit as st
|
7 |
import pandas as pd
|
8 |
import plotly.express as px
|
|
|
9 |
from datetime import datetime
|
10 |
+
from typing import Dict, List, Any
|
11 |
|
12 |
from utils.storage import load_data, save_data, get_cached_data, set_cached_data
|
13 |
from utils.error_handling import handle_data_exceptions, ValidationError, DataError
|
|
|
92 |
)
|
93 |
|
94 |
st.plotly_chart(fig, use_container_width=True)
|
95 |
+
|
96 |
+
@handle_data_exceptions
|
97 |
+
def render_dashboard():
|
98 |
+
"""Main function to render the dashboard page."""
|
99 |
+
st.title("📊 MONA Dashboard")
|
100 |
+
|
101 |
+
# Load all data
|
102 |
+
data = load_dashboard_data()
|
103 |
+
|
104 |
+
# Metrics cards
|
105 |
+
create_metrics_cards(data.get("metrics", {}))
|
106 |
+
st.markdown("---")
|
107 |
+
|
108 |
+
# Activity chart
|
109 |
+
st.subheader("User Activity")
|
110 |
+
create_activity_chart(data.get("user_activity", []))
|
111 |
+
|
112 |
+
# Run page
|
113 |
+
if __name__ == "__main__" or __name__.endswith(".dashboard"):
|
114 |
+
render_dashboard()
|