Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import time
|
3 |
+
|
4 |
+
# App Title and Description
|
5 |
+
st.title("⏳ Productivity Timer App")
|
6 |
+
st.write("""
|
7 |
+
Enhance your focus and manage your time effectively with this Productivity Timer App.
|
8 |
+
Features include the Pomodoro Technique, task prioritization, and progress tracking.
|
9 |
+
Perfect for students, professionals, and anyone looking to boost productivity!
|
10 |
+
""")
|
11 |
+
|
12 |
+
# Sidebar Instructions
|
13 |
+
st.sidebar.title("Instructions")
|
14 |
+
st.sidebar.write("""
|
15 |
+
1. Add tasks to your task list.
|
16 |
+
2. Select your timer settings: work session, short break, and long break durations.
|
17 |
+
3. Start the timer and focus on your task until the timer ends.
|
18 |
+
4. Take breaks as recommended to stay refreshed.
|
19 |
+
5. Track your progress with completed sessions.
|
20 |
+
""")
|
21 |
+
|
22 |
+
# Task List
|
23 |
+
st.subheader("Task List")
|
24 |
+
tasks = st.text_area("Enter your tasks (one per line):", height=100)
|
25 |
+
task_list = tasks.split("\n") if tasks else []
|
26 |
+
if task_list:
|
27 |
+
st.write("Your Tasks:")
|
28 |
+
for i, task in enumerate(task_list, start=1):
|
29 |
+
st.write(f"{i}. {task}")
|
30 |
+
else:
|
31 |
+
st.info("No tasks added yet. Add tasks above to start.")
|
32 |
+
|
33 |
+
# Timer Settings
|
34 |
+
st.subheader("Timer Settings")
|
35 |
+
work_duration = st.number_input("Work Session Duration (minutes):", min_value=1, max_value=60, value=25, step=1)
|
36 |
+
short_break = st.number_input("Short Break Duration (minutes):", min_value=1, max_value=15, value=5, step=1)
|
37 |
+
long_break = st.number_input("Long Break Duration (minutes):", min_value=10, max_value=30, value=15, step=1)
|
38 |
+
|
39 |
+
# Progress Tracking
|
40 |
+
st.subheader("Progress Tracking")
|
41 |
+
completed_sessions = st.session_state.get("completed_sessions", 0)
|
42 |
+
st.write(f"✅ Completed Work Sessions: {completed_sessions}")
|
43 |
+
|
44 |
+
# Timer Logic
|
45 |
+
if st.button("Start Timer"):
|
46 |
+
st.subheader("Timer")
|
47 |
+
with st.empty():
|
48 |
+
for remaining in range(work_duration * 60, 0, -1):
|
49 |
+
mins, secs = divmod(remaining, 60)
|
50 |
+
st.write(f"Work Time: {mins:02}:{secs:02}")
|
51 |
+
time.sleep(1)
|
52 |
+
st.success("Work session complete! Take a short break.")
|
53 |
+
|
54 |
+
for remaining in range(short_break * 60, 0, -1):
|
55 |
+
mins, secs = divmod(remaining, 60)
|
56 |
+
st.write(f"Short Break: {mins:02}:{secs:02}")
|
57 |
+
time.sleep(1)
|
58 |
+
st.success("Break time complete! Ready for the next session.")
|
59 |
+
|
60 |
+
# Update Progress
|
61 |
+
st.session_state["completed_sessions"] = completed_sessions + 1
|
62 |
+
|
63 |
+
# Footer
|
64 |
+
st.write("---")
|
65 |
+
st.markdown("💡 **Developed by Abdullah**")
|