SportsByNumbers/CourtIQ
0
1import streamlit as st2from src.core import session_state, helpers3from src.ui import sidebar, modals4from src.ui.sections import dashboard, game_management, roster, video_analysis, manual_stats, reporting5 6# --- Configuration and Initial Session State ---7st.set_page_config(layout="wide", page_title="CourtIQ App")8session_state.initialize_session_state() # Initialize all session state variables9 10# --- Main App Logic ---11def main():12 sidebar.render_sidebar() # Render the sidebar from the sidebar module13 14 # Always display the modal, if active15 modals.display_modal()16 17 # Render main content based on active_section18 active_section = st.session_state.active_section19 20 # Dynamically set the section header bar color and text21 # This ensures consistency for all main sections22 with st.container():23 st.markdown(24 f"<h1 style='background-color:#F27C00; color:white; padding:15px; border-radius:8px; text-align:center; margin-bottom:20px;'>{active_section.replace('-', ' ').title()}</h1>",25 unsafe_allow_html=True26 )27 28 if active_section == 'dashboard':29 dashboard.render_dashboard_section()30 elif active_section == 'game-management':31 game_management.render_game_management_section()32 elif active_section == 'video-analysis':33 video_analysis.render_video_analysis_section()34 elif active_section == 'rosters':35 roster.render_roster_section()36 elif active_section == 'player-performance':37 reporting.render_player_performance_section()38 elif active_section == 'team-statistics-report':39 reporting.render_team_statistics_report()40 elif active_section == 'game-summary-report':41 reporting.render_game_summary_report()42 elif active_section == 'league_comparison_report':43 reporting.render_league_comparison_report()44 elif active_section == 'manual_stats':45 manual_stats.render_manual_stats_section()46 47if __name__ == '__main__':48 main()49 