James McCool commited on
Commit
1666aa7
·
1 Parent(s): a692d2e

Refactor UI layout and streamline contest loading logic in app.py

Browse files

- Adjusted column proportions in the Data Load tab for improved layout consistency.
- Moved contest selection logic to ensure it is always visible, enhancing user experience.
- Cleaned up session state handling for contest file loading, maintaining existing functionality while improving clarity.

Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -48,7 +48,7 @@ player_exposure_format = {'Exposure Overall': '{:.2%}', 'Exposure Top 1%': '{:.2
48
 
49
  tab1, tab2 = st.tabs(["Data Load", "Contest Analysis"])
50
  with tab1:
51
- col1, col2 = st.columns([2, 8])
52
 
53
  with col1:
54
  if st.button('Clear data', key='reset1'):
@@ -70,20 +70,18 @@ with tab1:
70
  with game_options:
71
  type_var = st.selectbox("Select Game Type", ['Classic', 'Showdown'], key='type_var')
72
 
 
73
  if parse_type == 'DB Search':
74
  if 'Contest_file_helper' in st.session_state:
75
  del st.session_state['Contest_file_helper']
76
  if 'Contest_file' in st.session_state:
77
  del st.session_state['Contest_file']
78
- contest_name_var = st.selectbox("Select Contest to load", name_parse)
79
  if 'Contest_file' not in st.session_state:
80
  if st.button('Load Contest Data', key='load_contest_data'):
81
  st.session_state['Contest_file'] = grab_contest_data(sport_select, contest_name_var, contest_id_map, date_select)
82
  else:
83
  pass
84
  with col2:
85
- st.subheader("Contest File")
86
-
87
  if parse_type == 'Manual':
88
  if 'Contest_file_helper' in st.session_state:
89
  del st.session_state['Contest_file_helper']
 
48
 
49
  tab1, tab2 = st.tabs(["Data Load", "Contest Analysis"])
50
  with tab1:
51
+ col1, col2 = st.columns(2)
52
 
53
  with col1:
54
  if st.button('Clear data', key='reset1'):
 
70
  with game_options:
71
  type_var = st.selectbox("Select Game Type", ['Classic', 'Showdown'], key='type_var')
72
 
73
+ contest_name_var = st.selectbox("Select Contest to load", name_parse)
74
  if parse_type == 'DB Search':
75
  if 'Contest_file_helper' in st.session_state:
76
  del st.session_state['Contest_file_helper']
77
  if 'Contest_file' in st.session_state:
78
  del st.session_state['Contest_file']
 
79
  if 'Contest_file' not in st.session_state:
80
  if st.button('Load Contest Data', key='load_contest_data'):
81
  st.session_state['Contest_file'] = grab_contest_data(sport_select, contest_name_var, contest_id_map, date_select)
82
  else:
83
  pass
84
  with col2:
 
 
85
  if parse_type == 'Manual':
86
  if 'Contest_file_helper' in st.session_state:
87
  del st.session_state['Contest_file_helper']