Abdullah-Basar's picture
Create app.py
c1ae404 verified
import streamlit as st
import time
# App Title and Description
st.title("⏳ Productivity Timer App")
st.write("""
Enhance your focus and manage your time effectively with this Productivity Timer App.
Features include the Pomodoro Technique, task prioritization, and progress tracking.
Perfect for students, professionals, and anyone looking to boost productivity!
""")
# Sidebar Instructions
st.sidebar.title("Instructions")
st.sidebar.write("""
1. Add tasks to your task list.
2. Select your timer settings: work session, short break, and long break durations.
3. Start the timer and focus on your task until the timer ends.
4. Take breaks as recommended to stay refreshed.
5. Track your progress with completed sessions.
""")
# Task List
st.subheader("Task List")
tasks = st.text_area("Enter your tasks (one per line):", height=100)
task_list = tasks.split("\n") if tasks else []
if task_list:
st.write("Your Tasks:")
for i, task in enumerate(task_list, start=1):
st.write(f"{i}. {task}")
else:
st.info("No tasks added yet. Add tasks above to start.")
# Timer Settings
st.subheader("Timer Settings")
work_duration = st.number_input("Work Session Duration (minutes):", min_value=1, max_value=60, value=25, step=1)
short_break = st.number_input("Short Break Duration (minutes):", min_value=1, max_value=15, value=5, step=1)
long_break = st.number_input("Long Break Duration (minutes):", min_value=10, max_value=30, value=15, step=1)
# Progress Tracking
st.subheader("Progress Tracking")
completed_sessions = st.session_state.get("completed_sessions", 0)
st.write(f"βœ… Completed Work Sessions: {completed_sessions}")
# Timer Logic
if st.button("Start Timer"):
st.subheader("Timer")
with st.empty():
for remaining in range(work_duration * 60, 0, -1):
mins, secs = divmod(remaining, 60)
st.write(f"Work Time: {mins:02}:{secs:02}")
time.sleep(1)
st.success("Work session complete! Take a short break.")
for remaining in range(short_break * 60, 0, -1):
mins, secs = divmod(remaining, 60)
st.write(f"Short Break: {mins:02}:{secs:02}")
time.sleep(1)
st.success("Break time complete! Ready for the next session.")
# Update Progress
st.session_state["completed_sessions"] = completed_sessions + 1
# Footer
st.write("---")
st.markdown("πŸ’‘ **Developed by Abdullah**")