Maryam Ilka commited on
Commit
3b3f9b8
·
verified ·
1 Parent(s): 473e25d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -29
app.py CHANGED
@@ -107,7 +107,7 @@ st.markdown("""
107
  border-right: 3px solid #6a0dad;
108
  }
109
 
110
- .rahyar-button {
111
  background-color: #6a0dad !important;
112
  color: white !important;
113
  border: none !important;
@@ -117,29 +117,18 @@ st.markdown("""
117
  font-size: 16px !important;
118
  cursor: pointer;
119
  transition: all 0.3s ease;
120
- display: flex;
121
- justify-content: center;
122
- align-items: center;
123
  margin: 10px auto;
124
- width: 80%;
125
- max-width: 300px;
126
- height: 50px;
127
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
128
- text-align: center;
129
  }
130
 
131
- .rahyar-button:hover {
132
  background-color: #7b1fa2 !important;
133
  transform: translateY(-2px);
134
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
135
  }
136
 
137
- .rahyar-button:active {
138
- transform: scale(0.98) translateY(0);
139
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
140
- }
141
-
142
- .reject-button {
143
  background-color: white !important;
144
  color: #6a0dad !important;
145
  border: 2px solid #6a0dad !important;
@@ -149,28 +138,17 @@ st.markdown("""
149
  font-size: 16px !important;
150
  cursor: pointer;
151
  transition: all 0.3s ease;
152
- display: flex;
153
- justify-content: center;
154
- align-items: center;
155
  margin: 10px auto;
156
- width: 80%;
157
- max-width: 300px;
158
- height: 50px;
159
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
160
- text-align: center;
161
  }
162
 
163
- .reject-button:hover {
164
  background-color: #f8f0ff !important;
165
  transform: translateY(-2px);
166
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
167
  }
168
 
169
- .reject-button:active {
170
- transform: scale(0.98) translateY(0);
171
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
172
- }
173
-
174
  /* تنظیمات مخصوص دسکتاپ */
175
  @media only screen and (min-width: 769px) {
176
  .folium-map {
@@ -236,6 +214,36 @@ def show_explanation(exp_type):
236
  for item in explanations.get(exp_type, []):
237
  st.markdown(f"<p class='explanation-item'>• {item}</p>", unsafe_allow_html=True)
238
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  # ========== توابع مدیریت داده‌ها ==========
240
  def get_credentials():
241
  """دریافت اعتبارنامه از Secrets"""
@@ -419,7 +427,7 @@ def map_view():
419
 
420
  show_explanation(st.session_state.scenario_type)
421
 
422
- # دکمه‌های جدید با استفاده از st.button
423
  col1, col2 = st.columns(2)
424
  with col1:
425
  if st.button("درخواست راهیار", key="accept_btn",
 
107
  border-right: 3px solid #6a0dad;
108
  }
109
 
110
+ .accept-btn {
111
  background-color: #6a0dad !important;
112
  color: white !important;
113
  border: none !important;
 
117
  font-size: 16px !important;
118
  cursor: pointer;
119
  transition: all 0.3s ease;
 
 
 
120
  margin: 10px auto;
121
+ width: 100%;
 
 
122
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
 
123
  }
124
 
125
+ .accept-btn:hover {
126
  background-color: #7b1fa2 !important;
127
  transform: translateY(-2px);
128
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
129
  }
130
 
131
+ .reject-btn {
 
 
 
 
 
132
  background-color: white !important;
133
  color: #6a0dad !important;
134
  border: 2px solid #6a0dad !important;
 
138
  font-size: 16px !important;
139
  cursor: pointer;
140
  transition: all 0.3s ease;
 
 
 
141
  margin: 10px auto;
142
+ width: 100%;
 
 
143
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
 
144
  }
145
 
146
+ .reject-btn:hover {
147
  background-color: #f8f0ff !important;
148
  transform: translateY(-2px);
149
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
150
  }
151
 
 
 
 
 
 
152
  /* تنظیمات مخصوص دسکتاپ */
153
  @media only screen and (min-width: 769px) {
154
  .folium-map {
 
214
  for item in explanations.get(exp_type, []):
215
  st.markdown(f"<p class='explanation-item'>• {item}</p>", unsafe_allow_html=True)
216
 
217
+ def create_likert_question(question, key):
218
+ """سوال لیکرت با دکمه‌ها"""
219
+ st.markdown(f"<p style='margin-bottom: 10px;'>{question}</p>", unsafe_allow_html=True)
220
+
221
+ cols = st.columns(5)
222
+ options = {
223
+ 1: "کاملاً مخالفم",
224
+ 2: "مخالفم",
225
+ 3: "نظری ندارم",
226
+ 4: "موافقم",
227
+ 5: "کاملاً موافقم"
228
+ }
229
+
230
+ selected = st.session_state.get(key, None)
231
+
232
+ for value, label in options.items():
233
+ with cols[value-1]:
234
+ if st.button(
235
+ label,
236
+ key=f"{key}_{value}",
237
+ on_click=lambda v=value: st.session_state.update({key: v}),
238
+ type="primary" if selected == value else "secondary"
239
+ ):
240
+ pass
241
+
242
+ if selected:
243
+ st.markdown(f"<p style='color: #6a0dad;'>پاسخ شما: {options[selected]}</p>", unsafe_allow_html=True)
244
+
245
+ return selected
246
+
247
  # ========== توابع مدیریت داده‌ها ==========
248
  def get_credentials():
249
  """دریافت اعتبارنامه از Secrets"""
 
427
 
428
  show_explanation(st.session_state.scenario_type)
429
 
430
+ # دکمه‌های جدید با استایل‌های سفارشی
431
  col1, col2 = st.columns(2)
432
  with col1:
433
  if st.button("درخواست راهیار", key="accept_btn",