Spaces:
Paused
Paused
Maryam Ilka commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -581,11 +581,12 @@ def map_view():
|
|
| 581 |
st.rerun()
|
| 582 |
|
| 583 |
def attention_check1():
|
| 584 |
-
"""سوال توجه اول
|
|
|
|
| 585 |
st.markdown("""
|
| 586 |
<style>
|
| 587 |
-
/*
|
| 588 |
-
.green-btn {
|
| 589 |
background-color: #28a745 !important;
|
| 590 |
color: white !important;
|
| 591 |
border: none !important;
|
|
@@ -594,13 +595,19 @@ def attention_check1():
|
|
| 594 |
font-weight: bold !important;
|
| 595 |
width: 100% !important;
|
| 596 |
margin-top: 15px !important;
|
|
|
|
| 597 |
}
|
| 598 |
-
.green-btn:hover {
|
| 599 |
background-color: #218838 !important;
|
| 600 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 601 |
</style>
|
| 602 |
""", unsafe_allow_html=True)
|
| 603 |
-
|
| 604 |
st.markdown("### سوال توجه")
|
| 605 |
|
| 606 |
answer = st.radio(
|
|
@@ -610,16 +617,22 @@ def attention_check1():
|
|
| 610 |
key="att1_radio"
|
| 611 |
)
|
| 612 |
|
| 613 |
-
# دکمه سبز ا
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 623 |
if answer:
|
| 624 |
st.session_state.attention_check1 = answer
|
| 625 |
st.session_state.current_page = "random_likert_questions"
|
|
|
|
| 581 |
st.rerun()
|
| 582 |
|
| 583 |
def attention_check1():
|
| 584 |
+
"""سوال توجه اول با دکمه سبز کاملاً عملی"""
|
| 585 |
+
# 1. تزریق استایلهای سفارشی
|
| 586 |
st.markdown("""
|
| 587 |
<style>
|
| 588 |
+
/* دکمه سبز اختصاصی */
|
| 589 |
+
.custom-green-btn {
|
| 590 |
background-color: #28a745 !important;
|
| 591 |
color: white !important;
|
| 592 |
border: none !important;
|
|
|
|
| 595 |
font-weight: bold !important;
|
| 596 |
width: 100% !important;
|
| 597 |
margin-top: 15px !important;
|
| 598 |
+
cursor: pointer !important;
|
| 599 |
}
|
| 600 |
+
.custom-green-btn:hover {
|
| 601 |
background-color: #218838 !important;
|
| 602 |
}
|
| 603 |
+
|
| 604 |
+
/* مخفی کردن دکمه پیشفرض Streamlit */
|
| 605 |
+
div[data-testid="stButton"] > button[kind="primary"] {
|
| 606 |
+
display: none !important;
|
| 607 |
+
}
|
| 608 |
</style>
|
| 609 |
""", unsafe_allow_html=True)
|
| 610 |
+
|
| 611 |
st.markdown("### سوال توجه")
|
| 612 |
|
| 613 |
answer = st.radio(
|
|
|
|
| 617 |
key="att1_radio"
|
| 618 |
)
|
| 619 |
|
| 620 |
+
# 2. ایجاد دکمه سبز با JavaScript
|
| 621 |
+
st.components.v1.html(f"""
|
| 622 |
+
<script>
|
| 623 |
+
function handleClick() {{
|
| 624 |
+
// فعال کردن دکمه مخفی Streamlit
|
| 625 |
+
parent.document.querySelector('div[data-testid="stButton"] > button[kind="primary"]').click();
|
| 626 |
+
}}
|
| 627 |
+
</script>
|
| 628 |
+
|
| 629 |
+
<button onclick="handleClick()" class="custom-green-btn">
|
| 630 |
+
ادامه
|
| 631 |
+
</button>
|
| 632 |
+
""", height=60)
|
| 633 |
+
|
| 634 |
+
# 3. منطق اصلی دکمه (مخفی)
|
| 635 |
+
if st.button("ادامه", key="att1_real_btn", type="primary"):
|
| 636 |
if answer:
|
| 637 |
st.session_state.attention_check1 = answer
|
| 638 |
st.session_state.current_page = "random_likert_questions"
|