""" CSH2 Web Analytics Dashboard — DELPHI Main entry point with multi-page navigation """ import streamlit as st import base64 from pathlib import Path st.set_page_config( page_title="CSH2 // DELPHI", page_icon="⚙️", layout="wide", initial_sidebar_state="expanded", ) from ui.styles import inject_custom_css from core.db_connector import get_db_connector from ui.components import system_status_footer # Inject HUD theme CSS inject_custom_css() # Initialize DB connection (cached as singleton) db = get_db_connector() # Store DB connector in session state for access from pages if 'db' not in st.session_state: st.session_state.db = db @st.cache_data def _get_logo_base64(): """Load logo and encode as base64 for inline display""" logo_path = Path(__file__).parent / "assets" / "csh2_logo.jpeg" if not logo_path.exists(): return None with open(logo_path, "rb") as f: return base64.b64encode(f.read()).decode() @st.cache_data(ttl=3600) def _cached_time_range(): """Cache the data time range (quasi-static, 1hr TTL)""" _db = get_db_connector() return _db.get_time_range() # Sidebar branding with st.sidebar: # Logo with CSS filter for dark background logo_b64 = _get_logo_base64() if logo_b64: st.markdown(f"""