Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -145,7 +145,7 @@ if is_mobile():
|
|
| 145 |
# Interface mobile
|
| 146 |
st.markdown('<div class="header-container">', unsafe_allow_html=True)
|
| 147 |
if logo:
|
| 148 |
-
st.image(logo, width=
|
| 149 |
st.title("FSC: Culture de Sécurité Alimentaire")
|
| 150 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 151 |
else:
|
|
@@ -225,7 +225,19 @@ if st.session_state.selected_list is not None:
|
|
| 225 |
|
| 226 |
st.markdown('<div class="question-card">', unsafe_allow_html=True)
|
| 227 |
st.subheader(f"Question {question_num}")
|
| 228 |
-
st.markdown(f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
# Mélanger les réponses aléatoirement
|
| 231 |
reponses = [
|
|
@@ -235,11 +247,35 @@ if st.session_state.selected_list is not None:
|
|
| 235 |
]
|
| 236 |
shuffle(reponses)
|
| 237 |
|
| 238 |
-
# Utiliser des boutons radio pour les réponses
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
choix = st.radio(
|
| 240 |
-
"
|
| 241 |
[rep[0] for rep in reponses],
|
| 242 |
-
key=f"radio_{st.session_state.current_question}"
|
|
|
|
| 243 |
)
|
| 244 |
|
| 245 |
# Bouton pour confirmer la réponse
|
|
|
|
| 145 |
# Interface mobile
|
| 146 |
st.markdown('<div class="header-container">', unsafe_allow_html=True)
|
| 147 |
if logo:
|
| 148 |
+
st.image(logo, width=120, use_container_width=False)
|
| 149 |
st.title("FSC: Culture de Sécurité Alimentaire")
|
| 150 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 151 |
else:
|
|
|
|
| 225 |
|
| 226 |
st.markdown('<div class="question-card">', unsafe_allow_html=True)
|
| 227 |
st.subheader(f"Question {question_num}")
|
| 228 |
+
st.markdown(f"""
|
| 229 |
+
<div style='
|
| 230 |
+
background-color: #f8f9fa;
|
| 231 |
+
padding: 15px;
|
| 232 |
+
border-radius: 10px;
|
| 233 |
+
margin-bottom: 15px;
|
| 234 |
+
border-left: 5px solid #2398B2;
|
| 235 |
+
font-size: {'18px' if is_mobile() else '20px'};
|
| 236 |
+
font-weight: 500;
|
| 237 |
+
'>
|
| 238 |
+
{question['Question']}
|
| 239 |
+
</div>
|
| 240 |
+
""", unsafe_allow_html=True)
|
| 241 |
|
| 242 |
# Mélanger les réponses aléatoirement
|
| 243 |
reponses = [
|
|
|
|
| 247 |
]
|
| 248 |
shuffle(reponses)
|
| 249 |
|
| 250 |
+
# Utiliser des boutons radio pour les réponses avec style amélioré
|
| 251 |
+
st.markdown("<label style='font-weight: 500; margin-bottom: 10px;'>Sélectionnez votre réponse :</label>", unsafe_allow_html=True)
|
| 252 |
+
|
| 253 |
+
# Ajout de style CSS pour les boutons radio
|
| 254 |
+
st.markdown("""
|
| 255 |
+
<style>
|
| 256 |
+
div.row-widget.stRadio > div {
|
| 257 |
+
flex-direction: column;
|
| 258 |
+
gap: 10px;
|
| 259 |
+
}
|
| 260 |
+
div.row-widget.stRadio > div[role="radiogroup"] > label {
|
| 261 |
+
background-color: #f0f8ff;
|
| 262 |
+
padding: 10px 15px;
|
| 263 |
+
border-radius: 10px;
|
| 264 |
+
border: 1px solid #e0e0e0;
|
| 265 |
+
transition: all 0.3s;
|
| 266 |
+
}
|
| 267 |
+
div.row-widget.stRadio > div[role="radiogroup"] > label:hover {
|
| 268 |
+
background-color: #e0f0ff;
|
| 269 |
+
border-color: #2398B2;
|
| 270 |
+
}
|
| 271 |
+
</style>
|
| 272 |
+
""", unsafe_allow_html=True)
|
| 273 |
+
|
| 274 |
choix = st.radio(
|
| 275 |
+
"", # Label vide car déjà ajouté au-dessus
|
| 276 |
[rep[0] for rep in reponses],
|
| 277 |
+
key=f"radio_{st.session_state.current_question}",
|
| 278 |
+
label_visibility="collapsed" # Masquer le label par défaut
|
| 279 |
)
|
| 280 |
|
| 281 |
# Bouton pour confirmer la réponse
|