Spaces:
Sleeping
Sleeping
MansoorSarookh
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# app.py
|
2 |
+
|
3 |
+
import streamlit as st
|
4 |
+
import pandas as pd
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
import datetime
|
7 |
+
import time
|
8 |
+
|
9 |
+
# App Title
|
10 |
+
st.title("Time Management App")
|
11 |
+
st.subheader("Developed by Mansoor Sarookh")
|
12 |
+
|
13 |
+
# Sidebar for navigation
|
14 |
+
st.sidebar.title("Navigation")
|
15 |
+
selection = st.sidebar.radio("Go to", ["Today's Tasks", "Calendar", "Analytics", "Goals"])
|
16 |
+
|
17 |
+
# Placeholder Data for Task List
|
18 |
+
tasks_data = pd.DataFrame({
|
19 |
+
"Task": ["Meeting", "Coding Session", "Review Project"],
|
20 |
+
"Time": ["10:00 AM", "1:00 PM", "3:00 PM"]
|
21 |
+
})
|
22 |
+
|
23 |
+
# Today's Tasks Section
|
24 |
+
if selection == "Today's Tasks":
|
25 |
+
st.header("Today's Tasks")
|
26 |
+
|
27 |
+
# Input form for new tasks
|
28 |
+
with st.form("task_form"):
|
29 |
+
task_name = st.text_input("Task Name")
|
30 |
+
task_time = st.time_input("Time")
|
31 |
+
submit_task = st.form_submit_button("Add Task")
|
32 |
+
|
33 |
+
# Append new tasks
|
34 |
+
if submit_task:
|
35 |
+
new_task = pd.DataFrame({"Task": [task_name], "Time": [task_time.strftime("%I:%M %p")]})
|
36 |
+
tasks_data = pd.concat([tasks_data, new_task], ignore_index=True)
|
37 |
+
st.success(f"Task '{task_name}' added for {task_time.strftime('%I:%M %p')}")
|
38 |
+
|
39 |
+
st.table(tasks_data)
|
40 |
+
|
41 |
+
# Focus Timer Section
|
42 |
+
st.subheader("Focus Timer")
|
43 |
+
focus_duration = st.slider("Set Focus Duration (minutes)", min_value=5, max_value=60, step=5)
|
44 |
+
if st.button("Start Focus Session"):
|
45 |
+
st.write(f"Focus session started for {focus_duration} minutes...")
|
46 |
+
with st.spinner("Focusing..."):
|
47 |
+
time.sleep(focus_duration * 60) # Replace with actual countdown timer functionality
|
48 |
+
st.success("Focus session completed!")
|
49 |
+
|
50 |
+
# Analytics Section
|
51 |
+
elif selection == "Analytics":
|
52 |
+
st.header("Productivity Insights")
|
53 |
+
|
54 |
+
# Sample data for productivity breakdown
|
55 |
+
productivity_data = {"Category": ["Work", "Study", "Exercise", "Leisure"], "Hours": [20, 15, 5, 10]}
|
56 |
+
df_productivity = pd.DataFrame(productivity_data)
|
57 |
+
|
58 |
+
# Bar chart for productivity
|
59 |
+
fig, ax = plt.subplots()
|
60 |
+
ax.bar(df_productivity["Category"], df_productivity["Hours"], color='skyblue')
|
61 |
+
ax.set_title("Weekly Productivity Breakdown")
|
62 |
+
st.pyplot(fig)
|
63 |
+
|
64 |
+
# AI-Based Suggestions (Simplified Example)
|
65 |
+
def get_suggestions():
|
66 |
+
return "Try focusing on high-priority tasks in the morning when you're most productive."
|
67 |
+
|
68 |
+
st.subheader("AI Suggestions")
|
69 |
+
st.write(get_suggestions())
|
70 |
+
|
71 |
+
# Peak Productivity Hours
|
72 |
+
st.subheader("Peak Productivity Hours")
|
73 |
+
peak_hours = [9, 10, 11, 14, 15]
|
74 |
+
st.write(f"Your peak productivity hours: {', '.join([str(hour) + ':00' for hour in peak_hours])}")
|
75 |
+
|
76 |
+
# Goals Section
|
77 |
+
elif selection == "Goals":
|
78 |
+
st.header("Goals")
|
79 |
+
st.write("Set and track your productivity goals here!")
|
80 |
+
|
81 |
+
# Calendar Section
|
82 |
+
elif selection == "Calendar":
|
83 |
+
st.header("Calendar View")
|
84 |
+
st.write("Calendar integration coming soon!")
|