Spaces:
Running
Running
James McCool
commited on
Commit
Β·
ffa571c
1
Parent(s):
b858a5a
Refactor salary display logic in app.py by removing JavaScript dependency for screen width and simplifying column layout. This change enhances the user experience by ensuring consistent presentation of salary information across all devices.
Browse files
app.py
CHANGED
@@ -4,15 +4,9 @@ import pandas as pd
|
|
4 |
import gspread
|
5 |
import pymongo
|
6 |
import re
|
7 |
-
from streamlit_javascript import st_javascript
|
8 |
|
9 |
st.set_page_config(layout="wide")
|
10 |
|
11 |
-
screen_width = st_javascript("window.innerWidth")
|
12 |
-
# Default to desktop if JS fails
|
13 |
-
if screen_width is None:
|
14 |
-
screen_width = 1200
|
15 |
-
|
16 |
@st.cache_resource
|
17 |
def init_conn():
|
18 |
uri = st.secrets['mongo_uri']
|
@@ -1034,39 +1028,23 @@ with tab4:
|
|
1034 |
})
|
1035 |
summary_row = summary_row[['Salary', 'Median', 'Own%']].head(10)
|
1036 |
|
1037 |
-
col1,
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
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)}
|
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)}
|
1067 |
-
</div>
|
1068 |
-
""",
|
1069 |
-
unsafe_allow_html=True)
|
1070 |
|
1071 |
with col3:
|
1072 |
if total_salary <= 50000:
|
|
|
4 |
import gspread
|
5 |
import pymongo
|
6 |
import re
|
|
|
7 |
|
8 |
st.set_page_config(layout="wide")
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
@st.cache_resource
|
11 |
def init_conn():
|
12 |
uri = st.secrets['mongo_uri']
|
|
|
1028 |
})
|
1029 |
summary_row = summary_row[['Salary', 'Median', 'Own%']].head(10)
|
1030 |
|
1031 |
+
col1, col3 = st.columns([2, 3])
|
1032 |
+
|
1033 |
+
with col1:
|
1034 |
+
if (10 - len(filled_lineup)) > 0:
|
1035 |
+
st.markdown(f"""
|
1036 |
+
<div style='text-align: left; vertical-align: top; margin-top: 0; padding-top: 0;''>
|
1037 |
+
<b>π° Per Player:</b> ${round((50000 - total_salary) / (10 - len(filled_lineup)), 0)}
|
1038 |
+
</div>
|
1039 |
+
""",
|
1040 |
+
unsafe_allow_html=True)
|
1041 |
+
else:
|
1042 |
+
st.markdown(f"""
|
1043 |
+
<div style='text-align: left; vertical-align: top; margin-top: 0; padding-top: 0;''>
|
1044 |
+
<b>π° Leftover:</b> ${round(50000 - total_salary, 0)}
|
1045 |
+
</div>
|
1046 |
+
""",
|
1047 |
+
unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1048 |
|
1049 |
with col3:
|
1050 |
if total_salary <= 50000:
|