Spaces:
Sleeping
Sleeping
Create 4_Healing_Tracker.py
Browse files- pages/4_Healing_Tracker.py +53 -0
pages/4_Healing_Tracker.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import datetime
|
| 3 |
+
|
| 4 |
+
st.title("🌿 Shaafee - Soul Healing Tracker")
|
| 5 |
+
|
| 6 |
+
st.write(
|
| 7 |
+
"Track your daily spiritual goals to heal and grow closer to Allah 🤲"
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
# Step 1: Pick an emotion or challenge
|
| 11 |
+
emotion = st.selectbox(
|
| 12 |
+
"What are you working on?",
|
| 13 |
+
["Anxiety", "Sadness", "Anger", "Hopelessness", "Loneliness"]
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
# Step 2: Set a spiritual goal
|
| 17 |
+
goal = st.text_input(
|
| 18 |
+
"Set your goal (e.g., Recite Surah Duha daily for 7 days):"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Step 3: Select duration
|
| 22 |
+
days = st.slider("For how many days?", min_value=1, max_value=30, value=7)
|
| 23 |
+
|
| 24 |
+
# Step 4: Track daily check-in
|
| 25 |
+
if "progress" not in st.session_state:
|
| 26 |
+
st.session_state.progress = [False] * days
|
| 27 |
+
|
| 28 |
+
st.subheader("✅ Daily Check-In")
|
| 29 |
+
|
| 30 |
+
today = datetime.date.today()
|
| 31 |
+
|
| 32 |
+
for i in range(days):
|
| 33 |
+
done = st.checkbox(
|
| 34 |
+
f"Day {i+1} done?",
|
| 35 |
+
value=st.session_state.progress[i],
|
| 36 |
+
key=f"day{i}"
|
| 37 |
+
)
|
| 38 |
+
st.session_state.progress[i] = done
|
| 39 |
+
|
| 40 |
+
# Step 5: Show progress
|
| 41 |
+
completed = sum(st.session_state.progress)
|
| 42 |
+
percent = int((completed / days) * 100)
|
| 43 |
+
|
| 44 |
+
st.progress(percent)
|
| 45 |
+
st.write(f"🌙 Progress: {completed} out of {days} days ({percent}%)")
|
| 46 |
+
|
| 47 |
+
# Step 6: Motivational message
|
| 48 |
+
if percent == 100:
|
| 49 |
+
st.success("🌟 MashaAllah! You’ve achieved your goal. May Allah accept it!")
|
| 50 |
+
elif percent >= 50:
|
| 51 |
+
st.info("💚 Great work! More than halfway there.")
|
| 52 |
+
elif percent > 0:
|
| 53 |
+
st.info("✨ Good start! Stay consistent.")
|