James McCool commited on
Commit
b858a5a
Β·
1 Parent(s): cd4b2ab

Refactor mobile layout in app.py to enhance salary display by adjusting column alignment and improving HTML formatting. This change ensures consistent presentation of per player salary and leftover amounts across different screen sizes.

Browse files
Files changed (1) hide show
  1. app.py +31 -19
app.py CHANGED
@@ -1034,27 +1034,39 @@ with tab4:
1034
  })
1035
  summary_row = summary_row[['Salary', 'Median', 'Own%']].head(10)
1036
 
 
1037
  if screen_width < 700:
1038
- # Mobile: Only two columns
1039
- col1, col3 = st.columns([2, 3])
1040
- col2 = None
 
 
 
 
 
 
 
 
 
 
 
 
1041
  else:
1042
- col1, col2, col3 = st.columns([2, 1, 3])
1043
- with col1:
1044
- if (10 - len(filled_lineup)) > 0:
1045
- st.markdown(f"""
1046
- <div style='text-align: left; vertical-align: top; margin-top: 0; padding-top: 0;''>
1047
- <b>πŸ’° Per Player:</b> ${round((50000 - total_salary) / (10 - len(filled_lineup)), 0)} &nbsp;
1048
- </div>
1049
- """,
1050
- unsafe_allow_html=True)
1051
- else:
1052
- st.markdown(f"""
1053
- <div style='text-align: left; vertical-align: top; margin-top: 0; padding-top: 0;''>
1054
- <b>πŸ’° Leftover:</b> ${round(50000 - total_salary, 0)} &nbsp;
1055
- </div>
1056
- """,
1057
- unsafe_allow_html=True)
1058
 
1059
  with col3:
1060
  if total_salary <= 50000:
 
1034
  })
1035
  summary_row = summary_row[['Salary', 'Median', 'Own%']].head(10)
1036
 
1037
+ col1, col2, col3 = st.columns([2, 1, 3])
1038
  if screen_width < 700:
1039
+ with col1:
1040
+ if (10 - len(filled_lineup)) > 0:
1041
+ st.markdown(f"""
1042
+ <div style='text-align: right; vertical-align: top; margin-top: 0; padding-top: 0;''>
1043
+ <b>πŸ’° Per Player:</b> ${round((50000 - total_salary) / (10 - len(filled_lineup)), 0)} &nbsp;
1044
+ </div>
1045
+ """,
1046
+ unsafe_allow_html=True)
1047
+ else:
1048
+ st.markdown(f"""
1049
+ <div style='text-align: right; vertical-align: top; margin-top: 0; padding-top: 0;''>
1050
+ <b>πŸ’° Leftover:</b> ${round(50000 - total_salary, 0)} &nbsp;
1051
+ </div>
1052
+ """,
1053
+ unsafe_allow_html=True)
1054
  else:
1055
+ with col1:
1056
+ if (10 - len(filled_lineup)) > 0:
1057
+ st.markdown(f"""
1058
+ <div style='text-align: left; vertical-align: top; margin-top: 0; padding-top: 0;''>
1059
+ <b>πŸ’° Per Player:</b> ${round((50000 - total_salary) / (10 - len(filled_lineup)), 0)} &nbsp;
1060
+ </div>
1061
+ """,
1062
+ unsafe_allow_html=True)
1063
+ else:
1064
+ st.markdown(f"""
1065
+ <div style='text-align: left; vertical-align: top; margin-top: 0; padding-top: 0;''>
1066
+ <b>πŸ’° Leftover:</b> ${round(50000 - total_salary, 0)} &nbsp;
1067
+ </div>
1068
+ """,
1069
+ unsafe_allow_html=True)
 
1070
 
1071
  with col3:
1072
  if total_salary <= 50000: