feat: add Trends sidebar nav item + 3-view switching (Task E.2)

This commit is contained in:
Andrew Charlwood
2026-02-07 22:12:13 +00:00
parent 956ad8ca7b
commit 190aefdf56
5 changed files with 40 additions and 17 deletions
+13 -8
View File
@@ -1,4 +1,4 @@
"""Callbacks for view switching between Patient Pathways and Trust Comparison."""
"""Callbacks for view switching between Patient Pathways, Trust Comparison, and Trends."""
from dash import Input, Output
@@ -8,22 +8,27 @@ def register_navigation_callbacks(app):
@app.callback(
Output("patient-pathways-view", "style"),
Output("trust-comparison-view", "style"),
Output("trends-view", "style"),
Output("nav-patient-pathways", "className"),
Output("nav-trust-comparison", "className"),
Output("nav-trends", "className"),
Input("app-state", "data"),
)
def switch_view(app_state):
"""Show/hide views and update sidebar active state based on active_view."""
if not app_state:
return {}, {"display": "none"}, "sidebar__item sidebar__item--active", "sidebar__item"
view = app_state.get("active_view", "patient-pathways")
show = {}
hide = {"display": "none"}
active_cls = "sidebar__item sidebar__item--active"
inactive_cls = "sidebar__item"
if not app_state:
return show, hide, hide, active_cls, inactive_cls, inactive_cls
view = app_state.get("active_view", "patient-pathways")
if view == "patient-pathways":
return show, hide, active_cls, inactive_cls
else:
return hide, show, inactive_cls, active_cls
return show, hide, hide, active_cls, inactive_cls, inactive_cls
elif view == "trust-comparison":
return hide, show, hide, inactive_cls, active_cls, inactive_cls
else: # trends
return hide, hide, show, inactive_cls, inactive_cls, active_cls