Spaces:
Running

schedulemaster / index.html
EJSong's picture
Add 3 files
9a024bf verified
Raw History Blame Contribute Delete
37.8 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ScheduleMaster | Your Personal Schedule Manager</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
/* Animation for task completion */
@keyframes fadeOut {
from { opacity: 1; }
to { opacity: 0; transform: translateX(20px); }
}
.completed-task {
animation: fadeOut 0.5s forwards;
}
/* Custom checkbox */
.custom-checkbox {
appearance: none;
-webkit-appearance: none;
width: 20px;
height: 20px;
border: 2px solid #3b82f6;
border-radius: 4px;
cursor: pointer;
position: relative;
}
.custom-checkbox:checked {
background-color: #3b82f6;
}
.custom-checkbox:checked::after {
content: '\f00c';
font-family: 'Font Awesome 6 Free';
font-weight: 900;
color: white;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-size: 12px;
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<div class="min-h-screen flex flex-col">
<!-- Header -->
<header class="bg-indigo-600 text-white shadow-lg">
<div class="container mx-auto px-4 py-4 flex justify-between items-center">
<div class="flex items-center space-x-2">
<i class="fas fa-calendar-alt text-2xl"></i>
<h1 class="text-2xl font-bold">ScheduleMaster</h1>
</div>
<div class="flex items-center space-x-4">
<button id="theme-toggle" class="p-2 rounded-full hover:bg-indigo-500 transition">
<i class="fas fa-moon"></i>
</button>
<div class="relative">
<img src="https://ui-avatars.com/api/?name=User&background=random" alt="User" class="w-10 h-10 rounded-full cursor-pointer">
<div class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 hidden" id="user-dropdown">
<a href="#" class="block px-4 py-2 text-gray-800 hover:bg-indigo-100">Profile</a>
<a href="#" class="block px-4 py-2 text-gray-800 hover:bg-indigo-100">Settings</a>
<a href="#" class="block px-4 py-2 text-gray-800 hover:bg-indigo-100">Sign out</a>
</div>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<main class="flex-grow container mx-auto px-4 py-6 flex flex-col md:flex-row gap-6">
<!-- Sidebar -->
<aside class="w-full md:w-64 bg-white rounded-lg shadow-md p-4 h-fit">
<div class="mb-6">
<h2 class="text-xl font-semibold text-gray-800 mb-4">Navigation</h2>
<nav>
<ul class="space-y-2">
<li>
<a href="#" class="flex items-center space-x-2 p-2 rounded-lg bg-indigo-100 text-indigo-700">
<i class="fas fa-calendar-day w-5"></i>
<span>Today</span>
</a>
</li>
<li>
<a href="#" class="flex items-center space-x-2 p-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i class="fas fa-calendar-week w-5"></i>
<span>This Week</span>
</a>
</li>
<li>
<a href="#" class="flex items-center space-x-2 p-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i class="fas fa-calendar w-5"></i>
<span>All Tasks</span>
</a>
</li>
<li>
<a href="#" class="flex items-center space-x-2 p-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i class="fas fa-star w-5"></i>
<span>Important</span>
</a>
</li>
<li>
<a href="#" class="flex items-center space-x-2 p-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i class="fas fa-check-circle w-5"></i>
<span>Completed</span>
</a>
</li>
</ul>
</nav>
</div>
<div>
<h2 class="text-xl font-semibold text-gray-800 mb-4">Categories</h2>
<div class="space-y-2">
<div class="flex items-center space-x-2">
<span class="w-3 h-3 rounded-full bg-red-500"></span>
<span>Work</span>
</div>
<div class="flex items-center space-x-2">
<span class="w-3 h-3 rounded-full bg-blue-500"></span>
<span>Personal</span>
</div>
<div class="flex items-center space-x-2">
<span class="w-3 h-3 rounded-full bg-green-500"></span>
<span>Health</span>
</div>
<div class="flex items-center space-x-2">
<span class="w-3 h-3 rounded-full bg-yellow-500"></span>
<span>Study</span>
</div>
<button class="mt-3 text-indigo-600 hover:text-indigo-800 flex items-center space-x-1">
<i class="fas fa-plus"></i>
<span>Add Category</span>
</button>
</div>
</div>
</aside>
<!-- Main Content Area -->
<div class="flex-grow">
<!-- Date and Add Task -->
<div class="bg-white rounded-lg shadow-md p-4 mb-6">
<div class="flex justify-between items-center">
<div>
<h2 class="text-2xl font-bold text-gray-800">Today's Schedule</h2>
<p class="text-gray-600" id="current-date">Loading date...</p>
</div>
<button id="add-task-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg flex items-center space-x-2 transition">
<i class="fas fa-plus"></i>
<span>Add Task</span>
</button>
</div>
</div>
<!-- Task List -->
<div class="bg-white rounded-lg shadow-md p-4">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold text-gray-800">Tasks</h3>
<div class="flex space-x-2">
<button class="p-2 text-gray-600 hover:text-indigo-600">
<i class="fas fa-filter"></i>
</button>
<button class="p-2 text-gray-600 hover:text-indigo-600">
<i class="fas fa-sort"></i>
</button>
</div>
</div>
<!-- Task Filters -->
<div class="flex space-x-2 mb-4 overflow-x-auto pb-2">
<button class="px-3 py-1 bg-indigo-100 text-indigo-700 rounded-full text-sm">All</button>
<button class="px-3 py-1 bg-gray-100 text-gray-700 rounded-full text-sm">Work</button>
<button class="px-3 py-1 bg-gray-100 text-gray-700 rounded-full text-sm">Personal</button>
<button class="px-3 py-1 bg-gray-100 text-gray-700 rounded-full text-sm">Health</button>
<button class="px-3 py-1 bg-gray-100 text-gray-700 rounded-full text-sm">Study</button>
</div>
<!-- Tasks -->
<div class="space-y-3" id="task-list">
<!-- Task items will be added here dynamically -->
</div>
<!-- Completed Tasks Toggle -->
<div class="mt-6">
<button id="toggle-completed" class="text-indigo-600 hover:text-indigo-800 flex items-center space-x-1">
<i class="fas fa-chevron-down"></i>
<span>Show Completed (3)</span>
</button>
<div id="completed-tasks" class="mt-2 space-y-3 hidden">
<!-- Completed tasks will be shown here -->
</div>
</div>
</div>
</div>
<!-- Calendar Section -->
<div class="w-full md:w-80 bg-white rounded-lg shadow-md p-4 h-fit">
<div class="flex justify-between items-center mb-4">
<h2 class="text-xl font-semibold text-gray-800">Calendar</h2>
<div class="flex space-x-2">
<button class="p-2 text-gray-600 hover:text-indigo-600">
<i class="fas fa-chevron-left"></i>
</button>
<button class="p-2 text-gray-600 hover:text-indigo-600">
<i class="fas fa-chevron-right"></i>
</button>
</div>
</div>
<div class="grid grid-cols-7 gap-1 mb-2">
<div class="text-center text-xs font-medium text-gray-500">Sun</div>
<div class="text-center text-xs font-medium text-gray-500">Mon</div>
<div class="text-center text-xs font-medium text-gray-500">Tue</div>
<div class="text-center text-xs font-medium text-gray-500">Wed</div>
<div class="text-center text-xs font-medium text-gray-500">Thu</div>
<div class="text-center text-xs font-medium text-gray-500">Fri</div>
<div class="text-center text-xs font-medium text-gray-500">Sat</div>
</div>
<div class="grid grid-cols-7 gap-1" id="calendar-days">
<!-- Calendar days will be generated here -->
</div>
<div class="mt-6">
<h3 class="text-lg font-semibold text-gray-800 mb-2">Upcoming Events</h3>
<div class="space-y-2">
<div class="flex items-start space-x-2 p-2 hover:bg-gray-50 rounded-lg">
<div class="w-2 h-2 mt-2 rounded-full bg-red-500"></div>
<div>
<p class="text-sm font-medium">Team Meeting</p>
<p class="text-xs text-gray-500">Tomorrow, 10:00 AM</p>
</div>
</div>
<div class="flex items-start space-x-2 p-2 hover:bg-gray-50 rounded-lg">
<div class="w-2 h-2 mt-2 rounded-full bg-blue-500"></div>
<div>
<p class="text-sm font-medium">Dentist Appointment</p>
<p class="text-xs text-gray-500">Wed, 2:30 PM</p>
</div>
</div>
<div class="flex items-start space-x-2 p-2 hover:bg-gray-50 rounded-lg">
<div class="w-2 h-2 mt-2 rounded-full bg-green-500"></div>
<div>
<p class="text-sm font-medium">Gym Session</p>
<p class="text-xs text-gray-500">Fri, 6:00 PM</p>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- Add Task Modal -->
<div id="add-task-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
<div class="bg-white rounded-lg shadow-xl w-full max-w-md">
<div class="flex justify-between items-center border-b px-6 py-4">
<h3 class="text-lg font-semibold">Add New Task</h3>
<button id="close-modal" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6">
<form id="task-form">
<div class="mb-4">
<label for="task-title" class="block text-sm font-medium text-gray-700 mb-1">Task Title</label>
<input type="text" id="task-title" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="What needs to be done?" required>
</div>
<div class="mb-4">
<label for="task-description" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
<textarea id="task-description" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="Add details..."></textarea>
</div>
<div class="grid grid-cols-2 gap-4 mb-4">
<div>
<label for="task-date" class="block text-sm font-medium text-gray-700 mb-1">Date</label>
<input type="date" id="task-date" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
<div>
<label for="task-time" class="block text-sm font-medium text-gray-700 mb-1">Time</label>
<input type="time" id="task-time" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
</div>
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-1">Category</label>
<div class="flex space-x-2">
<button type="button" class="category-btn px-3 py-1 bg-red-100 text-red-700 rounded-full text-sm" data-category="work">Work</button>
<button type="button" class="category-btn px-3 py-1 bg-blue-100 text-blue-700 rounded-full text-sm" data-category="personal">Personal</button>
<button type="button" class="category-btn px-3 py-1 bg-green-100 text-green-700 rounded-full text-sm" data-category="health">Health</button>
<button type="button" class="category-btn px-3 py-1 bg-yellow-100 text-yellow-700 rounded-full text-sm" data-category="study">Study</button>
</div>
<input type="hidden" id="task-category" value="">
</div>
<div class="flex items-center mb-6">
<input type="checkbox" id="task-important" class="custom-checkbox mr-2">
<label for="task-important" class="text-sm font-medium text-gray-700">Mark as important</label>
</div>
<div class="flex justify-end space-x-3">
<button type="button" id="cancel-task" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50">Cancel</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">Add Task</button>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Set current date
const now = new Date();
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
document.getElementById('current-date').textContent = now.toLocaleDateString('en-US', options);
// Generate calendar days
generateCalendarDays();
// Sample tasks data
const tasks = [
{ id: 1, title: 'Complete project proposal', description: 'Finish the proposal document and send to manager', date: '2023-07-20', time: '14:00', category: 'work', important: true, completed: false },
{ id: 2, title: 'Grocery shopping', description: 'Buy fruits, vegetables, and milk', date: '2023-07-20', time: '18:00', category: 'personal', important: false, completed: false },
{ id: 3, title: 'Morning workout', description: '30 minutes cardio and strength training', date: '2023-07-21', time: '07:00', category: 'health', important: true, completed: false },
{ id: 4, title: 'Study React hooks', description: 'Complete tutorial on useEffect and useState', date: '2023-07-21', time: '20:00', category: 'study', important: false, completed: true },
{ id: 5, title: 'Team meeting', description: 'Weekly sync with development team', date: '2023-07-22', time: '10:00', category: 'work', important: true, completed: false },
{ id: 6, title: 'Dentist appointment', description: 'Regular dental checkup', date: '2023-07-22', time: '15:30', category: 'health', important: false, completed: false }
];
// Render tasks
renderTasks(tasks);
// Modal functionality
const addTaskBtn = document.getElementById('add-task-btn');
const addTaskModal = document.getElementById('add-task-modal');
const closeModal = document.getElementById('close-modal');
const cancelTask = document.getElementById('cancel-task');
addTaskBtn.addEventListener('click', () => {
addTaskModal.classList.remove('hidden');
document.getElementById('task-date').valueAsDate = new Date();
});
closeModal.addEventListener('click', () => {
addTaskModal.classList.add('hidden');
});
cancelTask.addEventListener('click', () => {
addTaskModal.classList.add('hidden');
});
// Category selection
const categoryBtns = document.querySelectorAll('.category-btn');
const taskCategory = document.getElementById('task-category');
categoryBtns.forEach(btn => {
btn.addEventListener('click', () => {
// Remove active class from all buttons
categoryBtns.forEach(b => {
b.classList.remove('bg-indigo-100', 'text-indigo-700');
b.classList.add(b.dataset.category === 'work' ? 'bg-red-100' :
b.dataset.category === 'personal' ? 'bg-blue-100' :
b.dataset.category === 'health' ? 'bg-green-100' : 'bg-yellow-100');
b.classList.add(b.dataset.category === 'work' ? 'text-red-700' :
b.dataset.category === 'personal' ? 'text-blue-700' :
b.dataset.category === 'health' ? 'text-green-700' : 'text-yellow-700');
});
// Add active class to clicked button
btn.classList.remove(btn.dataset.category === 'work' ? 'bg-red-100' :
btn.dataset.category === 'personal' ? 'bg-blue-100' :
btn.dataset.category === 'health' ? 'bg-green-100' : 'bg-yellow-100');
btn.classList.remove(btn.dataset.category === 'work' ? 'text-red-700' :
btn.dataset.category === 'personal' ? 'text-blue-700' :
btn.dataset.category === 'health' ? 'text-green-700' : 'text-yellow-700');
btn.classList.add('bg-indigo-100', 'text-indigo-700');
// Set the category value
taskCategory.value = btn.dataset.category;
});
});
// Form submission
const taskForm = document.getElementById('task-form');
taskForm.addEventListener('submit', function(e) {
e.preventDefault();
const title = document.getElementById('task-title').value;
const description = document.getElementById('task-description').value;
const date = document.getElementById('task-date').value;
const time = document.getElementById('task-time').value;
const category = document.getElementById('task-category').value || 'personal';
const important = document.getElementById('task-important').checked;
// In a real app, you would save this to a database
const newTask = {
id: tasks.length + 1,
title,
description,
date,
time,
category,
important,
completed: false
};
tasks.unshift(newTask);
renderTasks(tasks);
// Reset form and close modal
taskForm.reset();
addTaskModal.classList.add('hidden');
});
// Toggle completed tasks
const toggleCompleted = document.getElementById('toggle-completed');
const completedTasks = document.getElementById('completed-tasks');
toggleCompleted.addEventListener('click', () => {
if (completedTasks.classList.contains('hidden')) {
completedTasks.classList.remove('hidden');
toggleCompleted.querySelector('i').classList.replace('fa-chevron-down', 'fa-chevron-up');
} else {
completedTasks.classList.add('hidden');
toggleCompleted.querySelector('i').classList.replace('fa-chevron-up', 'fa-chevron-down');
}
});
// Theme toggle
const themeToggle = document.getElementById('theme-toggle');
themeToggle.addEventListener('click', () => {
document.body.classList.toggle('bg-gray-900');
document.body.classList.toggle('bg-gray-100');
if (document.body.classList.contains('bg-gray-900')) {
// Dark mode
themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
// Update other elements for dark mode
document.querySelectorAll('.bg-white').forEach(el => {
el.classList.add('bg-gray-800');
el.classList.remove('bg-white');
});
document.querySelectorAll('.text-gray-800').forEach(el => {
el.classList.add('text-gray-100');
el.classList.remove('text-gray-800');
});
document.querySelectorAll('.text-gray-700').forEach(el => {
el.classList.add('text-gray-300');
el.classList.remove('text-gray-700');
});
document.querySelectorAll('.text-gray-600').forEach(el => {
el.classList.add('text-gray-400');
el.classList.remove('text-gray-600');
});
document.querySelectorAll('.bg-gray-100').forEach(el => {
el.classList.add('bg-gray-700');
el.classList.remove('bg-gray-100');
});
document.querySelectorAll('.hover:bg-gray-100').forEach(el => {
el.classList.add('hover:bg-gray-700');
el.classList.remove('hover:bg-gray-100');
});
document.querySelectorAll('.border-gray-300').forEach(el => {
el.classList.add('border-gray-600');
el.classList.remove('border-gray-300');
});
} else {
// Light mode
themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
// Revert to light mode
document.querySelectorAll('.bg-gray-800').forEach(el => {
el.classList.add('bg-white');
el.classList.remove('bg-gray-800');
});
document.querySelectorAll('.text-gray-100').forEach(el => {
el.classList.add('text-gray-800');
el.classList.remove('text-gray-100');
});
document.querySelectorAll('.text-gray-300').forEach(el => {
el.classList.add('text-gray-700');
el.classList.remove('text-gray-300');
});
document.querySelectorAll('.text-gray-400').forEach(el => {
el.classList.add('text-gray-600');
el.classList.remove('text-gray-400');
});
document.querySelectorAll('.bg-gray-700').forEach(el => {
el.classList.add('bg-gray-100');
el.classList.remove('bg-gray-700');
});
document.querySelectorAll('.hover:bg-gray-700').forEach(el => {
el.classList.add('hover:bg-gray-100');
el.classList.remove('hover:bg-gray-700');
});
document.querySelectorAll('.border-gray-600').forEach(el => {
el.classList.add('border-gray-300');
el.classList.remove('border-gray-600');
});
}
});
// User dropdown
const userAvatar = document.querySelector('img[alt="User"]');
const userDropdown = document.getElementById('user-dropdown');
userAvatar.addEventListener('click', () => {
userDropdown.classList.toggle('hidden');
});
// Close dropdown when clicking outside
document.addEventListener('click', (e) => {
if (!userAvatar.contains(e.target) && !userDropdown.contains(e.target)) {
userDropdown.classList.add('hidden');
}
});
});
function generateCalendarDays() {
const calendarDays = document.getElementById('calendar-days');
calendarDays.innerHTML = '';
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth();
const firstDay = new Date(year, month, 1).getDay();
const daysInMonth = new Date(year, month + 1, 0).getDate();
// Add empty cells for days before the first day of the month
for (let i = 0; i < firstDay; i++) {
const emptyCell = document.createElement('div');
emptyCell.className = 'h-8';
calendarDays.appendChild(emptyCell);
}
// Add cells for each day of the month
for (let day = 1; day <= daysInMonth; day++) {
const dayCell = document.createElement('div');
dayCell.className = 'h-8 flex items-center justify-center text-sm rounded-full cursor-pointer hover:bg-gray-100';
if (day === now.getDate()) {
dayCell.classList.add('bg-indigo-600', 'text-white', 'font-medium');
}
dayCell.textContent = day;
calendarDays.appendChild(dayCell);
}
}
function renderTasks(tasks) {
const taskList = document.getElementById('task-list');
const completedTasks = document.getElementById('completed-tasks');
// Clear existing tasks
taskList.innerHTML = '';
completedTasks.innerHTML = '';
// Count completed tasks for the toggle button
let completedCount = 0;
tasks.forEach(task => {
if (task.completed) {
completedCount++;
renderTask(task, completedTasks, true);
} else {
renderTask(task, taskList, false);
}
});
// Update completed tasks count
document.querySelector('#toggle-completed span').textContent = `Show Completed (${completedCount})`;
}
function renderTask(task, container, isCompleted) {
const taskElement = document.createElement('div');
taskElement.className = `bg-white p-4 rounded-lg border border-gray-200 shadow-sm ${isCompleted ? 'opacity-70' : ''}`;
taskElement.dataset.id = task.id;
// Determine category color
let categoryColor = 'gray';
let categoryText = 'Personal';
if (task.category === 'work') {
categoryColor = 'red';
categoryText = 'Work';
} else if (task.category === 'health') {
categoryColor = 'green';
categoryText = 'Health';
} else if (task.category === 'study') {
categoryColor = 'yellow';
categoryText = 'Study';
}
// Format date and time
const taskDate = task.date ? new Date(task.date) : null;
const formattedDate = taskDate ? taskDate.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }) : '';
const formattedTime = task.time ? formatTime(task.time) : '';
taskElement.innerHTML = `
<div class="flex justify-between items-start">
<div class="flex items-start space-x-3">
<input type="checkbox" class="custom-checkbox mt-1" ${isCompleted ? 'checked' : ''}>
<div>
<h4 class="font-medium ${isCompleted ? 'line-through text-gray-500' : 'text-gray-800'}">${task.title}</h4>
${task.description ? `<p class="text-sm text-gray-600 mt-1">${task.description}</p>` : ''}
<div class="flex items-center space-x-3 mt-2">
${formattedDate ? `<span class="flex items-center text-xs text-gray-500">
<i class="fas fa-calendar-day mr-1"></i> ${formattedDate}
</span>` : ''}
${formattedTime ? `<span class="flex items-center text-xs text-gray-500">
<i class="fas fa-clock mr-1"></i> ${formattedTime}
</span>` : ''}
<span class="flex items-center text-xs px-2 py-1 bg-${categoryColor}-100 text-${categoryColor}-700 rounded-full">
${categoryText}
</span>
</div>
</div>
</div>
<div class="flex space-x-2">
${task.important ? `<span class="text-yellow-500"><i class="fas fa-star"></i></span>` : ''}
<button class="text-gray-400 hover:text-gray-600 edit-task">
<i class="fas fa-edit"></i>
</button>
<button class="text-gray-400 hover:text-gray-600 delete-task">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
`;
container.appendChild(taskElement);
// Add event listeners to the new task
const checkbox = taskElement.querySelector('input[type="checkbox"]');
const deleteBtn = taskElement.querySelector('.delete-task');
const editBtn = taskElement.querySelector('.edit-task');
checkbox.addEventListener('change', function() {
task.completed = this.checked;
if (task.completed) {
taskElement.classList.add('completed-task');
setTimeout(() => {
container.removeChild(taskElement);
renderTask(task, document.getElementById('completed-tasks'), true);
updateCompletedCount();
}, 500);
}
});
deleteBtn.addEventListener('click', function() {
if (confirm('Are you sure you want to delete this task?')) {
// In a real app, you would remove from database
const index = tasks.findIndex(t => t.id === task.id);
if (index !== -1) {
tasks.splice(index, 1);
container.removeChild(taskElement);
updateCompletedCount();
}
}
});
editBtn.addEventListener('click', function() {
// In a real app, you would implement edit functionality
alert('Edit functionality would be implemented here');
});
}
function formatTime(timeString) {
const [hours, minutes] = timeString.split(':');
const hour = parseInt(hours);
const ampm = hour >= 12 ? 'PM' : 'AM';
const hour12 = hour % 12 || 12;
return `${hour12}:${minutes} ${ampm}`;
}
function updateCompletedCount() {
const completedTasks = document.querySelectorAll('#completed-tasks > div').length;
document.querySelector('#toggle-completed span').textContent = `Show Completed (${completedTasks})`;
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=EJSong/schedulemaster" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>