SportsByNumbers/CourtIQ
0
1# src/core/session_state.py2import streamlit as st3import datetime4 5def initialize_session_state():6 """Initializes all necessary session state variables for the application."""7 8 if 'teams' not in st.session_state:9 st.session_state.teams = [10 {'id': 101, 'name': 'Lakers (Example)', 'country': 'Australia', 'state': 'VIC', 'league': 'NBL', 'age_group': 'Open', 'logo': 'https://placehold.co/40x40/FFC72C/552583?text=LAL'},11 {'id': 102, 'name': 'Warriors (Example)', 'country': 'Australia', 'state': 'NSW', 'league': 'NBL1 East', 'age_group': 'Open', 'logo': 'https://placehold.co/40x40/006BB6/FDB927?text=GSW'},12 ]13 if 'players' not in st.session_state:14 st.session_state.players = [15 {'id': 201, 'name': 'LeBron James', 'profile_photo': 'https://placehold.co/40x40/cccccc/000000?text=LJ'},16 {'id': 202, 'name': 'Anthony Davis', 'profile_photo': 'https://placehold.co/40x40/cccccc/000000?text=AD'},17 ]18 if 'player_team_associations' not in st.session_state:19 st.session_state.player_team_associations = [20 {'id': 1, 'player_id': 201, 'team_id': 101, 'jersey': '23', 'position': 'SF'},21 {'id': 2, 'player_id': 202, 'team_id': 101, 'jersey': '3', 'position': 'PF'},22 {'id': 3, 'player_id': 201, 'team_id': 102, 'jersey': '6', 'position': 'PF'},23 ]24 if 'games' not in st.session_state:25 st.session_state.games = []26 if 'selected_game_id' not in st.session_state:27 st.session_state.selected_game_id = None28 if 'video_file' not in st.session_state:29 st.session_state.video_file = None30 if 'youtube_link' not in st.session_state:31 st.session_state.youtube_link = ''32 if 'analysis_results' not in st.session_state:33 st.session_state.analysis_results = None34 if 'is_loading' not in st.session_state:35 st.session_state.is_loading = False36 if 'manual_entries' not in st.session_state:37 st.session_state.manual_entries = []38 if 'modal_config' not in st.session_state:39 st.session_state.modal_config = {'is_open': False, 'title': '', 'message': '', 'type': 'info', 'show_cancel': False, 'on_confirm': None}40 if 'active_section' not in st.session_state:41 st.session_state.active_section = 'dashboard'42 43 # State for editing forms44 if 'editing_game_id' not in st.session_state:45 st.session_state.editing_game_id = None46 if 'editing_team_id' not in st.session_state:47 st.session_state.editing_team_id = None48 if 'editing_player_id' not in st.session_state:49 st.session_state.editing_player_id = None50 if 'editing_assoc_id' not in st.session_state:51 st.session_state.editing_assoc_id = None52 