James McCool
commited on
Commit
·
82d70c9
1
Parent(s):
044bb1e
Enhance UI by adding custom styles for segmented controls and select elements in app.py, improving user experience and visual consistency.
Browse files
app.py
CHANGED
@@ -34,6 +34,43 @@ all_column_stack_sports = ['LOL', 'NCAAF', 'WNBA', 'NBA', 'CS2']
|
|
34 |
player_wrong_names_mlb = ['Enrique Hernandez', 'Joseph Cantillo', 'Mike Soroka', 'Jakob Bauers', 'Temi Fágbénlé']
|
35 |
player_right_names_mlb = ['Kike Hernandez', 'Joey Cantillo', 'Michael Soroka', 'Jake Bauers', 'Temi Fagbenle']
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
def create_position_export_dict(column_name, csv_file, site_var, type_var, sport_var):
|
38 |
try:
|
39 |
# Remove any numbers from the column name to get the position
|
@@ -143,8 +180,17 @@ with st.container():
|
|
143 |
elif type_var == 'Showdown':
|
144 |
salary_max = 60000
|
145 |
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
if st.button('Clear data', key='reset1'):
|
149 |
st.session_state.clear()
|
150 |
# Add file uploaders to your app
|
@@ -1007,7 +1053,7 @@ with tab1:
|
|
1007 |
# use_container_width=True
|
1008 |
# )
|
1009 |
|
1010 |
-
|
1011 |
if 'origin_portfolio' in st.session_state and 'projections_df' in st.session_state:
|
1012 |
with st.container():
|
1013 |
col1, col2 = st.columns(2)
|
|
|
34 |
player_wrong_names_mlb = ['Enrique Hernandez', 'Joseph Cantillo', 'Mike Soroka', 'Jakob Bauers', 'Temi Fágbénlé']
|
35 |
player_right_names_mlb = ['Kike Hernandez', 'Joey Cantillo', 'Michael Soroka', 'Jake Bauers', 'Temi Fagbenle']
|
36 |
|
37 |
+
st.markdown("""
|
38 |
+
<style>
|
39 |
+
/* Tab styling */
|
40 |
+
.stElementContainer [data-baseweb="button-group"] {
|
41 |
+
gap: 2.000rem;
|
42 |
+
padding: 4px;
|
43 |
+
}
|
44 |
+
.stElementContainer [kind="segmented_control"] {
|
45 |
+
height: 2.000rem;
|
46 |
+
white-space: pre-wrap;
|
47 |
+
background-color: #DAA520;
|
48 |
+
color: white;
|
49 |
+
border-radius: 20px;
|
50 |
+
gap: 1px;
|
51 |
+
padding: 10px 20px;
|
52 |
+
font-weight: bold;
|
53 |
+
transition: all 0.3s ease;
|
54 |
+
}
|
55 |
+
.stElementContainer [kind="segmented_controlActive"] {
|
56 |
+
height: 3.000rem;
|
57 |
+
background-color: #DAA520;
|
58 |
+
border: 3px solid #FFD700;
|
59 |
+
border-radius: 10px;
|
60 |
+
color: black;
|
61 |
+
}
|
62 |
+
.stElementContainer [kind="segmented_control"]:hover {
|
63 |
+
background-color: #FFD700;
|
64 |
+
cursor: pointer;
|
65 |
+
}
|
66 |
+
|
67 |
+
div[data-baseweb="select"] > div {
|
68 |
+
background-color: #DAA520;
|
69 |
+
color: white;
|
70 |
+
}
|
71 |
+
|
72 |
+
</style>""", unsafe_allow_html=True)
|
73 |
+
|
74 |
def create_position_export_dict(column_name, csv_file, site_var, type_var, sport_var):
|
75 |
try:
|
76 |
# Remove any numbers from the column name to get the position
|
|
|
180 |
elif type_var == 'Showdown':
|
181 |
salary_max = 60000
|
182 |
|
183 |
+
selected_tab = st.segmented_control(
|
184 |
+
"Select Tab",
|
185 |
+
options=["Data Load", "Manage Portfolio"],
|
186 |
+
selection_mode='single',
|
187 |
+
default='Data Load',
|
188 |
+
width='content',
|
189 |
+
label_visibility='collapsed',
|
190 |
+
key='tab_selector'
|
191 |
+
)
|
192 |
+
|
193 |
+
if selected_tab == 'Data Load':
|
194 |
if st.button('Clear data', key='reset1'):
|
195 |
st.session_state.clear()
|
196 |
# Add file uploaders to your app
|
|
|
1053 |
# use_container_width=True
|
1054 |
# )
|
1055 |
|
1056 |
+
if selected_tab == 'Manage Portfolio':
|
1057 |
if 'origin_portfolio' in st.session_state and 'projections_df' in st.session_state:
|
1058 |
with st.container():
|
1059 |
col1, col2 = st.columns(2)
|