Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -249,7 +249,6 @@ st.markdown("""
|
|
| 249 |
# Tabs
|
| 250 |
tab1, tab2 = st.tabs(["๐ Soulful Moods", "๐ฎ Qurโan Search"])
|
| 251 |
|
| 252 |
-
|
| 253 |
with tab1:
|
| 254 |
st.markdown("""
|
| 255 |
<div class="tab-content">
|
|
@@ -257,41 +256,49 @@ with tab1:
|
|
| 257 |
<em>Choose a mood to unveil verses aligned with your state of being โ and each time you click the same mood again, new Ayahs will be revealed for you.</em>
|
| 258 |
</div>
|
| 259 |
""", unsafe_allow_html=True)
|
|
|
|
| 260 |
mood_emojis = {
|
| 261 |
'Aggressive': 'โก', 'Angry': '๐ฅ', 'Confused': '๐', 'Feeling Depressed / Sad': '๐ง',
|
| 262 |
'Feeling Sick / Ill': '๐ฉบ', 'Guilty': '๐', 'Happy': 'โจ', 'Envy': '๐ฟ',
|
| 263 |
'Hopeless': '๐ซ๏ธ', 'Lonely': '๐', 'Frustrated': '๐ช๏ธ', 'Hopeful': '๐ธ', 'Proud': '๐
'
|
| 264 |
}
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
st.markdown('<div class="mood-content">', unsafe_allow_html=True)
|
| 270 |
st.markdown('<div class="mood-grid">', unsafe_allow_html=True)
|
| 271 |
-
|
| 272 |
-
|
|
|
|
|
|
|
|
|
|
| 273 |
for j, mood in enumerate(row):
|
| 274 |
emoji = mood_emojis.get(mood, '๐ฟ')
|
|
|
|
| 275 |
if cols[j].button(f"{emoji} {mood}", key=f"mood_{mood}", help=f"Discover verses for {mood}"):
|
| 276 |
sel, _ = do_search_mood(mood)
|
| 277 |
if sel:
|
| 278 |
st.session_state['mood_ayah'] = sel
|
| 279 |
-
st.session_state['selected_mood'] = mood
|
| 280 |
-
|
| 281 |
-
# Last row centered
|
| 282 |
-
if last_row:
|
| 283 |
-
col1, col2, col3 = st.columns([1, 2, 1])
|
| 284 |
-
with col2:
|
| 285 |
-
mood = last_row[0]
|
| 286 |
-
emoji = mood_emojis.get(mood, '๐ฟ')
|
| 287 |
-
if st.button(f"{emoji} {mood}", key=f"mood_{mood}", help=f"Discover verses for {mood}"):
|
| 288 |
-
sel, _ = do_search_mood(mood)
|
| 289 |
-
if sel:
|
| 290 |
-
st.session_state['mood_ayah'] = sel
|
| 291 |
-
st.session_state['selected_mood'] = mood # <-- store clicked mood
|
| 292 |
|
| 293 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 294 |
|
|
|
|
| 295 |
st.markdown('<div class="output-section">', unsafe_allow_html=True)
|
| 296 |
if 'mood_ayah' in st.session_state:
|
| 297 |
ayah = st.session_state['mood_ayah']
|
|
@@ -302,6 +309,7 @@ with tab1:
|
|
| 302 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 303 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 304 |
|
|
|
|
| 305 |
with tab2:
|
| 306 |
st.markdown("""
|
| 307 |
<div class="tab-content">
|
|
|
|
| 249 |
# Tabs
|
| 250 |
tab1, tab2 = st.tabs(["๐ Soulful Moods", "๐ฎ Qurโan Search"])
|
| 251 |
|
|
|
|
| 252 |
with tab1:
|
| 253 |
st.markdown("""
|
| 254 |
<div class="tab-content">
|
|
|
|
| 256 |
<em>Choose a mood to unveil verses aligned with your state of being โ and each time you click the same mood again, new Ayahs will be revealed for you.</em>
|
| 257 |
</div>
|
| 258 |
""", unsafe_allow_html=True)
|
| 259 |
+
|
| 260 |
mood_emojis = {
|
| 261 |
'Aggressive': 'โก', 'Angry': '๐ฅ', 'Confused': '๐', 'Feeling Depressed / Sad': '๐ง',
|
| 262 |
'Feeling Sick / Ill': '๐ฉบ', 'Guilty': '๐', 'Happy': 'โจ', 'Envy': '๐ฟ',
|
| 263 |
'Hopeless': '๐ซ๏ธ', 'Lonely': '๐', 'Frustrated': '๐ช๏ธ', 'Hopeful': '๐ธ', 'Proud': '๐
'
|
| 264 |
}
|
| 265 |
+
|
| 266 |
+
# Define background gradient per mood
|
| 267 |
+
mood_colors = {
|
| 268 |
+
'Aggressive': 'linear-gradient(135deg, #f87171, #ef4444)',
|
| 269 |
+
'Angry': 'linear-gradient(135deg, #dc2626, #b91c1c)',
|
| 270 |
+
'Confused': 'linear-gradient(135deg, #facc15, #eab308)',
|
| 271 |
+
'Feeling Depressed / Sad': 'linear-gradient(135deg, #3b82f6, #60a5fa)',
|
| 272 |
+
'Feeling Sick / Ill': 'linear-gradient(135deg, #10b981, #34d399)',
|
| 273 |
+
'Guilty': 'linear-gradient(135deg, #f59e0b, #fbbf24)',
|
| 274 |
+
'Happy': 'linear-gradient(135deg, #8b5cf6, #a78bfa)',
|
| 275 |
+
'Envy': 'linear-gradient(135deg, #22d3ee, #06b6d4)',
|
| 276 |
+
'Hopeless': 'linear-gradient(135deg, #6366f1, #818cf8)',
|
| 277 |
+
'Lonely': 'linear-gradient(135deg, #a78bfa, #c4b5fd)',
|
| 278 |
+
'Frustrated': 'linear-gradient(135deg, #ec4899, #f472b6)',
|
| 279 |
+
'Hopeful': 'linear-gradient(135deg, #4ade80, #22c55e)',
|
| 280 |
+
'Proud': 'linear-gradient(135deg, #6a11cb, #a044ff)'
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
st.markdown('<div class="mood-content">', unsafe_allow_html=True)
|
| 284 |
st.markdown('<div class="mood-grid">', unsafe_allow_html=True)
|
| 285 |
+
|
| 286 |
+
# Arrange buttons in rows of 4
|
| 287 |
+
for i in range(0, len(mood_list), 4):
|
| 288 |
+
row = mood_list[i:i+4]
|
| 289 |
+
cols = st.columns(len(row))
|
| 290 |
for j, mood in enumerate(row):
|
| 291 |
emoji = mood_emojis.get(mood, '๐ฟ')
|
| 292 |
+
style = f"background: {mood_colors.get(mood,'#ccc')}; color: white;"
|
| 293 |
if cols[j].button(f"{emoji} {mood}", key=f"mood_{mood}", help=f"Discover verses for {mood}"):
|
| 294 |
sel, _ = do_search_mood(mood)
|
| 295 |
if sel:
|
| 296 |
st.session_state['mood_ayah'] = sel
|
| 297 |
+
st.session_state['selected_mood'] = mood
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
|
| 299 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 300 |
|
| 301 |
+
# Display the selected verse
|
| 302 |
st.markdown('<div class="output-section">', unsafe_allow_html=True)
|
| 303 |
if 'mood_ayah' in st.session_state:
|
| 304 |
ayah = st.session_state['mood_ayah']
|
|
|
|
| 309 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 310 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 311 |
|
| 312 |
+
|
| 313 |
with tab2:
|
| 314 |
st.markdown("""
|
| 315 |
<div class="tab-content">
|