Jon Solow
commited on
Commit
·
56a9838
1
Parent(s):
7804478
Set selectboxes to be readonly for mobile experience
Browse files
src/pages/10_Set_Your_Lineup.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from dataclasses import dataclass
|
2 |
import pandas as pd
|
3 |
import streamlit as st
|
|
|
4 |
|
5 |
from config import DEFAULT_ICON
|
6 |
from shared_page import common_page_config
|
@@ -14,6 +15,26 @@ from login import check_password
|
|
14 |
from data_storage import update_selection, get_user_team
|
15 |
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
@dataclass
|
18 |
class PlayerOption:
|
19 |
full_name: str
|
@@ -207,6 +228,8 @@ def get_page():
|
|
207 |
with selection_cols[7]:
|
208 |
position_cell(week, "DEF", 1, player_options, existing_selections)
|
209 |
|
|
|
|
|
210 |
|
211 |
if __name__ == "__main__":
|
212 |
get_page()
|
|
|
1 |
from dataclasses import dataclass
|
2 |
import pandas as pd
|
3 |
import streamlit as st
|
4 |
+
import streamlit.components.v1 as components
|
5 |
|
6 |
from config import DEFAULT_ICON
|
7 |
from shared_page import common_page_config
|
|
|
15 |
from data_storage import update_selection, get_user_team
|
16 |
|
17 |
|
18 |
+
def set_selectbox_readonly():
|
19 |
+
components.html(
|
20 |
+
"""
|
21 |
+
<script>
|
22 |
+
function formatSelectBox() {
|
23 |
+
const matches = window.parent.document.querySelectorAll("input");
|
24 |
+
matches.forEach((input) => {
|
25 |
+
input.setAttribute("readonly", "true");
|
26 |
+
});
|
27 |
+
|
28 |
+
}
|
29 |
+
formatSelectBox();
|
30 |
+
|
31 |
+
</script>
|
32 |
+
""",
|
33 |
+
width=0,
|
34 |
+
height=0,
|
35 |
+
)
|
36 |
+
|
37 |
+
|
38 |
@dataclass
|
39 |
class PlayerOption:
|
40 |
full_name: str
|
|
|
228 |
with selection_cols[7]:
|
229 |
position_cell(week, "DEF", 1, player_options, existing_selections)
|
230 |
|
231 |
+
set_selectbox_readonly()
|
232 |
+
|
233 |
|
234 |
if __name__ == "__main__":
|
235 |
get_page()
|