import streamlit as st import json from datetime import datetime import calendar import random # Initialize session state if 'tasks' not in st.session_state: st.session_state.tasks = { day: [] for day in ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] } if 'streak' not in st.session_state: st.session_state.streak = 0 # App title st.title("π Student Study Tracker") days = list(st.session_state.tasks.keys()) # ========== Sidebar Features ========== st.sidebar.header("ποΈ Calendar") current_date = datetime.now() st.sidebar.markdown(f"### {current_date.strftime('%B %Y')}") # Display the correct calendar for the current month and year cal = calendar.monthcalendar(current_date.year, current_date.month) calendar_text = "" for week in cal: week_str = " ".join(f"{day:2}" if day != 0 else " " for day in week) calendar_text += week_str + "\n" st.sidebar.text(calendar_text) # Motivational Quotes quotes = [ "The secret of getting ahead is getting started. β Mark Twain", "You donβt have to be great to start, but you have to start to be great. β Zig Ziglar", "The only way to do great work is to love what you do. β Steve Jobs" ] st.sidebar.markdown("π¬ **Quote of the Day**") st.sidebar.write(random.choice(quotes)) # Streak Counter completed_days = sum( 1 for day in days if any(task['checked'] for task in st.session_state.tasks[day]) ) st.sidebar.markdown(f"π₯ **Streak:** {completed_days}/7 days this week") # ========== Main App ========== # Progress Bar total_tasks = sum(len(tasks) for tasks in st.session_state.tasks.values()) completed_tasks = sum( sum(1 for task in st.session_state.tasks[day] if task['checked']) for day in days ) if total_tasks > 0: st.progress(completed_tasks / total_tasks) # Day Tabs tabs = st.tabs(days) for i, day in enumerate(days): with tabs[i]: # Display tasks for task_idx, task in enumerate(st.session_state.tasks[day]): checked = task['checked'] text = task['text'] tags = task.get('tags', []) priority = task.get('priority', 'Medium') col1, col2 = st.columns([0.8, 0.2]) with col1: if checked: st.markdown( f"