Spaces:
Running
Running
page calendar active it
Browse files- README.md +8 -5
- calendar.html +54 -0
- components/footer.js +74 -0
- components/navbar.js +93 -0
- index.html +135 -19
- script.js +245 -0
- style.css +60 -18
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: TaskMaster Pro 🚀✨
|
| 3 |
+
colorFrom: pink
|
| 4 |
+
colorTo: purple
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://huggingface.co/deepsite).
|
calendar.html
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Calendar | TaskMaster Pro</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<link href="https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.css" rel="stylesheet">
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
</head>
|
| 11 |
+
<body class="bg-gray-50 min-h-screen flex flex-col">
|
| 12 |
+
<custom-navbar></custom-navbar>
|
| 13 |
+
|
| 14 |
+
<main class="flex-1 container mx-auto px-4 py-8">
|
| 15 |
+
<div class="max-w-6xl mx-auto">
|
| 16 |
+
<h1 class="text-3xl font-bold text-gray-800 mb-8">Task Calendar</h1>
|
| 17 |
+
<div id="calendar" class="bg-white rounded-xl shadow-sm border border-gray-100 p-4"></div>
|
| 18 |
+
</div>
|
| 19 |
+
</main>
|
| 20 |
+
|
| 21 |
+
<custom-footer></custom-footer>
|
| 22 |
+
|
| 23 |
+
<script src="components/navbar.js"></script>
|
| 24 |
+
<script src="components/footer.js"></script>
|
| 25 |
+
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.js"></script>
|
| 26 |
+
<script>
|
| 27 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 28 |
+
const calendarEl = document.getElementById('calendar');
|
| 29 |
+
const calendar = new FullCalendar.Calendar(calendarEl, {
|
| 30 |
+
initialView: 'dayGridMonth',
|
| 31 |
+
headerToolbar: {
|
| 32 |
+
left: 'prev,next today',
|
| 33 |
+
center: 'title',
|
| 34 |
+
right: 'dayGridMonth,timeGridWeek,timeGridDay'
|
| 35 |
+
},
|
| 36 |
+
events: JSON.parse(localStorage.getItem('tasks'))?.map(task => ({
|
| 37 |
+
title: task.title,
|
| 38 |
+
start: task.dueDate || task.createdAt,
|
| 39 |
+
extendedProps: {
|
| 40 |
+
description: task.description,
|
| 41 |
+
priority: task.priority
|
| 42 |
+
},
|
| 43 |
+
backgroundColor:
|
| 44 |
+
task.priority === 'high' ? '#ef4444' :
|
| 45 |
+
task.priority === 'medium' ? '#f59e0b' :
|
| 46 |
+
'#10b981',
|
| 47 |
+
borderColor: 'transparent'
|
| 48 |
+
})) || []
|
| 49 |
+
});
|
| 50 |
+
calendar.render();
|
| 51 |
+
});
|
| 52 |
+
</script>
|
| 53 |
+
</body>
|
| 54 |
+
</html>
|
components/footer.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomFooter extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
footer {
|
| 7 |
+
background: #f9fafb;
|
| 8 |
+
color: #6b7280;
|
| 9 |
+
padding: 2rem 1rem;
|
| 10 |
+
text-align: center;
|
| 11 |
+
border-top: 1px solid #e5e7eb;
|
| 12 |
+
}
|
| 13 |
+
.footer-content {
|
| 14 |
+
max-width: 1200px;
|
| 15 |
+
margin: 0 auto;
|
| 16 |
+
display: flex;
|
| 17 |
+
flex-direction: column;
|
| 18 |
+
gap: 1rem;
|
| 19 |
+
}
|
| 20 |
+
.footer-links {
|
| 21 |
+
display: flex;
|
| 22 |
+
justify-content: center;
|
| 23 |
+
gap: 1.5rem;
|
| 24 |
+
margin-bottom: 1rem;
|
| 25 |
+
}
|
| 26 |
+
.footer-links a {
|
| 27 |
+
color: #6b7280;
|
| 28 |
+
text-decoration: none;
|
| 29 |
+
transition: color 0.2s;
|
| 30 |
+
}
|
| 31 |
+
.footer-links a:hover {
|
| 32 |
+
color: #6366f1;
|
| 33 |
+
}
|
| 34 |
+
.copyright {
|
| 35 |
+
font-size: 0.875rem;
|
| 36 |
+
}
|
| 37 |
+
.social-icons {
|
| 38 |
+
display: flex;
|
| 39 |
+
justify-content: center;
|
| 40 |
+
gap: 1rem;
|
| 41 |
+
margin-top: 0.5rem;
|
| 42 |
+
}
|
| 43 |
+
.social-icons a {
|
| 44 |
+
color: #9ca3af;
|
| 45 |
+
transition: color 0.2s;
|
| 46 |
+
}
|
| 47 |
+
.social-icons a:hover {
|
| 48 |
+
color: #6366f1;
|
| 49 |
+
}
|
| 50 |
+
</style>
|
| 51 |
+
<footer>
|
| 52 |
+
<div class="footer-content">
|
| 53 |
+
<div class="footer-links">
|
| 54 |
+
<a href="#">About</a>
|
| 55 |
+
<a href="#">Privacy</a>
|
| 56 |
+
<a href="#">Terms</a>
|
| 57 |
+
<a href="#">Contact</a>
|
| 58 |
+
</div>
|
| 59 |
+
<div class="social-icons">
|
| 60 |
+
<a href="#"><i data-feather="twitter"></i></a>
|
| 61 |
+
<a href="#"><i data-feather="github"></i></a>
|
| 62 |
+
<a href="#"><i data-feather="linkedin"></i></a>
|
| 63 |
+
<a href="#"><i data-feather="instagram"></i></a>
|
| 64 |
+
</div>
|
| 65 |
+
<div class="copyright">
|
| 66 |
+
© ${new Date().getFullYear()} TaskMaster Pro. All rights reserved.
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
</footer>
|
| 70 |
+
`;
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
customElements.define('custom-footer', CustomFooter);
|
components/navbar.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomNavbar extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
nav {
|
| 7 |
+
background: white;
|
| 8 |
+
padding: 1rem 2rem;
|
| 9 |
+
display: flex;
|
| 10 |
+
justify-content: space-between;
|
| 11 |
+
align-items: center;
|
| 12 |
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
|
| 13 |
+
}
|
| 14 |
+
.logo {
|
| 15 |
+
font-size: 1.25rem;
|
| 16 |
+
font-weight: 700;
|
| 17 |
+
color: #6366f1;
|
| 18 |
+
display: flex;
|
| 19 |
+
align-items: center;
|
| 20 |
+
gap: 0.5rem;
|
| 21 |
+
}
|
| 22 |
+
.nav-links {
|
| 23 |
+
display: flex;
|
| 24 |
+
gap: 1.5rem;
|
| 25 |
+
list-style: none;
|
| 26 |
+
margin: 0;
|
| 27 |
+
padding: 0;
|
| 28 |
+
}
|
| 29 |
+
.nav-links a {
|
| 30 |
+
color: #4b5563;
|
| 31 |
+
text-decoration: none;
|
| 32 |
+
font-weight: 500;
|
| 33 |
+
padding: 0.5rem 0;
|
| 34 |
+
position: relative;
|
| 35 |
+
transition: color 0.2s;
|
| 36 |
+
}
|
| 37 |
+
.nav-links a:hover {
|
| 38 |
+
color: #6366f1;
|
| 39 |
+
}
|
| 40 |
+
.nav-links a.active {
|
| 41 |
+
color: #6366f1;
|
| 42 |
+
}
|
| 43 |
+
.nav-links a.active::after {
|
| 44 |
+
content: '';
|
| 45 |
+
position: absolute;
|
| 46 |
+
bottom: 0;
|
| 47 |
+
left: 0;
|
| 48 |
+
width: 100%;
|
| 49 |
+
height: 2px;
|
| 50 |
+
background-color: #6366f1;
|
| 51 |
+
}
|
| 52 |
+
.user-avatar {
|
| 53 |
+
width: 2.5rem;
|
| 54 |
+
height: 2.5rem;
|
| 55 |
+
border-radius: 9999px;
|
| 56 |
+
background-color: #e0e7ff;
|
| 57 |
+
display: flex;
|
| 58 |
+
align-items: center;
|
| 59 |
+
justify-content: center;
|
| 60 |
+
color: #6366f1;
|
| 61 |
+
font-weight: 600;
|
| 62 |
+
}
|
| 63 |
+
@media (max-width: 768px) {
|
| 64 |
+
nav {
|
| 65 |
+
padding: 1rem;
|
| 66 |
+
flex-direction: column;
|
| 67 |
+
gap: 1rem;
|
| 68 |
+
}
|
| 69 |
+
.nav-links {
|
| 70 |
+
gap: 1rem;
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
</style>
|
| 74 |
+
<nav>
|
| 75 |
+
<div class="logo">
|
| 76 |
+
<i data-feather="check-circle"></i>
|
| 77 |
+
<span>TaskMaster Pro</span>
|
| 78 |
+
</div>
|
| 79 |
+
<ul class="nav-links">
|
| 80 |
+
<li><a href="/">Tasks</a></li>
|
| 81 |
+
<li><a href="/calendar.html" class="active">Calendar</a></li>
|
| 82 |
+
<li><a href="#">Reports</a></li>
|
| 83 |
+
<li><a href="#">Settings</a></li>
|
| 84 |
+
</ul>
|
| 85 |
+
<div class="user-avatar">
|
| 86 |
+
<i data-feather="user"></i>
|
| 87 |
+
</div>
|
| 88 |
+
</nav>
|
| 89 |
+
`;
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
customElements.define('custom-navbar', CustomNavbar);
|
index.html
CHANGED
|
@@ -1,19 +1,135 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>TaskMaster Pro</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
+
<script>
|
| 12 |
+
tailwind.config = {
|
| 13 |
+
theme: {
|
| 14 |
+
extend: {
|
| 15 |
+
colors: {
|
| 16 |
+
primary: '#6366f1',
|
| 17 |
+
secondary: '#8b5cf6',
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
</script>
|
| 23 |
+
</head>
|
| 24 |
+
<body class="bg-gray-50 min-h-screen flex flex-col">
|
| 25 |
+
<custom-navbar></custom-navbar>
|
| 26 |
+
|
| 27 |
+
<main class="flex-1 container mx-auto px-4 py-8">
|
| 28 |
+
<div class="max-w-6xl mx-auto">
|
| 29 |
+
<div class="flex justify-between items-center mb-8">
|
| 30 |
+
<h1 class="text-3xl font-bold text-gray-800">Your Tasks</h1>
|
| 31 |
+
<button id="addTaskBtn" class="bg-primary hover:bg-primary-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition">
|
| 32 |
+
<i data-feather="plus"></i> Add Task
|
| 33 |
+
</button>
|
| 34 |
+
</div>
|
| 35 |
+
|
| 36 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
|
| 37 |
+
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
| 38 |
+
<h3 class="text-gray-500 text-sm font-medium mb-1">Total Tasks</h3>
|
| 39 |
+
<p id="totalTasks" class="text-3xl font-bold text-gray-800">0</p>
|
| 40 |
+
</div>
|
| 41 |
+
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
| 42 |
+
<h3 class="text-gray-500 text-sm font-medium mb-1">Completed</h3>
|
| 43 |
+
<p id="completedTasks" class="text-3xl font-bold text-green-500">0</p>
|
| 44 |
+
</div>
|
| 45 |
+
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
| 46 |
+
<h3 class="text-gray-500 text-sm font-medium mb-1">Pending</h3>
|
| 47 |
+
<p id="pendingTasks" class="text-3xl font-bold text-yellow-500">0</p>
|
| 48 |
+
</div>
|
| 49 |
+
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
| 50 |
+
<h3 class="text-gray-500 text-sm font-medium mb-1">High Priority</h3>
|
| 51 |
+
<p id="highPriorityTasks" class="text-3xl font-bold text-red-500">0</p>
|
| 52 |
+
</div>
|
| 53 |
+
</div>
|
| 54 |
+
|
| 55 |
+
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
| 56 |
+
<div class="flex justify-between items-center p-4 border-b border-gray-100">
|
| 57 |
+
<div class="flex gap-2">
|
| 58 |
+
<button id="filterAll" class="filter-btn active px-4 py-2 rounded-lg bg-primary text-white">
|
| 59 |
+
All
|
| 60 |
+
</button>
|
| 61 |
+
<button id="filterPending" class="filter-btn px-4 py-2 rounded-lg bg-gray-100 hover:bg-gray-200 text-gray-700">
|
| 62 |
+
Pending
|
| 63 |
+
</button>
|
| 64 |
+
<button id="filterCompleted" class="filter-btn px-4 py-2 rounded-lg bg-gray-100 hover:bg-gray-200 text-gray-700">
|
| 65 |
+
Completed
|
| 66 |
+
</button>
|
| 67 |
+
</div>
|
| 68 |
+
<div class="relative">
|
| 69 |
+
<input type="text" id="searchTasks" placeholder="Search tasks..." class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary outline-none">
|
| 70 |
+
<i data-feather="search" class="absolute left-3 top-2.5 text-gray-400"></i>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
<div id="tasksContainer" class="divide-y divide-gray-100">
|
| 74 |
+
<!-- Tasks will be loaded here -->
|
| 75 |
+
<div class="p-6 text-center text-gray-500">
|
| 76 |
+
<i data-feather="inbox" class="w-12 h-12 mx-auto text-gray-300 mb-2"></i>
|
| 77 |
+
<p>No tasks found. Add your first task!</p>
|
| 78 |
+
</div>
|
| 79 |
+
</div>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
</main>
|
| 83 |
+
|
| 84 |
+
<!-- Add/Edit Task Modal -->
|
| 85 |
+
<div id="taskModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
|
| 86 |
+
<div class="bg-white rounded-xl shadow-lg w-full max-w-md mx-4">
|
| 87 |
+
<div class="flex justify-between items-center border-b border-gray-200 p-4">
|
| 88 |
+
<h3 class="text-lg font-semibold text-gray-800" id="modalTitle">Add New Task</h3>
|
| 89 |
+
<button id="closeModalBtn" class="text-gray-500 hover:text-gray-700">
|
| 90 |
+
<i data-feather="x"></i>
|
| 91 |
+
</button>
|
| 92 |
+
</div>
|
| 93 |
+
<form id="taskForm" class="p-4 space-y-4">
|
| 94 |
+
<input type="hidden" id="taskId">
|
| 95 |
+
<div>
|
| 96 |
+
<label for="taskTitle" class="block text-sm font-medium text-gray-700 mb-1">Title</label>
|
| 97 |
+
<input type="text" id="taskTitle" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary outline-none" required>
|
| 98 |
+
</div>
|
| 99 |
+
<div>
|
| 100 |
+
<label for="taskDescription" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
| 101 |
+
<textarea id="taskDescription" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary outline-none"></textarea>
|
| 102 |
+
</div>
|
| 103 |
+
<div class="grid grid-cols-2 gap-4">
|
| 104 |
+
<div>
|
| 105 |
+
<label for="taskPriority" class="block text-sm font-medium text-gray-700 mb-1">Priority</label>
|
| 106 |
+
<select id="taskPriority" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary outline-none">
|
| 107 |
+
<option value="high">High</option>
|
| 108 |
+
<option value="medium">Medium</option>
|
| 109 |
+
<option value="low">Low</option>
|
| 110 |
+
</select>
|
| 111 |
+
</div>
|
| 112 |
+
<div>
|
| 113 |
+
<label for="taskDueDate" class="block text-sm font-medium text-gray-700 mb-1">Due Date</label>
|
| 114 |
+
<input type="date" id="taskDueDate" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary outline-none">
|
| 115 |
+
</div>
|
| 116 |
+
</div>
|
| 117 |
+
<div class="flex justify-end gap-2 pt-4">
|
| 118 |
+
<button type="button" id="cancelModalBtn" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50">Cancel</button>
|
| 119 |
+
<button type="submit" class="px-4 py-2 bg-primary hover:bg-primary-600 text-white rounded-md">Save Task</button>
|
| 120 |
+
</div>
|
| 121 |
+
</form>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
|
| 125 |
+
<custom-footer></custom-footer>
|
| 126 |
+
|
| 127 |
+
<script src="components/navbar.js"></script>
|
| 128 |
+
<script src="components/footer.js"></script>
|
| 129 |
+
<script src="script.js"></script>
|
| 130 |
+
<script>
|
| 131 |
+
feather.replace();
|
| 132 |
+
</script>
|
| 133 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 134 |
+
</body>
|
| 135 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class TaskManager {
|
| 2 |
+
constructor() {
|
| 3 |
+
this.tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
| 4 |
+
this.currentFilter = 'all';
|
| 5 |
+
this.init();
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
init() {
|
| 9 |
+
this.bindEvents();
|
| 10 |
+
this.renderTasks();
|
| 11 |
+
this.updateSummary();
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
bindEvents() {
|
| 15 |
+
// Modal controls
|
| 16 |
+
document.getElementById('addTaskBtn').addEventListener('click', () => this.openModal());
|
| 17 |
+
document.getElementById('closeModalBtn').addEventListener('click', () => this.closeModal());
|
| 18 |
+
document.getElementById('cancelModalBtn').addEventListener('click', () => this.closeModal());
|
| 19 |
+
document.getElementById('taskForm').addEventListener('submit', (e) => {
|
| 20 |
+
e.preventDefault();
|
| 21 |
+
this.saveTask();
|
| 22 |
+
});
|
| 23 |
+
|
| 24 |
+
// Filter controls
|
| 25 |
+
document.getElementById('filterAll').addEventListener('click', () => this.filterTasks('all'));
|
| 26 |
+
document.getElementById('filterPending').addEventListener('click', () => this.filterTasks('pending'));
|
| 27 |
+
document.getElementById('filterCompleted').addEventListener('click', () => this.filterTasks('completed'));
|
| 28 |
+
|
| 29 |
+
// Search functionality
|
| 30 |
+
document.getElementById('searchTasks').addEventListener('input', (e) => {
|
| 31 |
+
this.searchTasks(e.target.value);
|
| 32 |
+
});
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
openModal(task = null) {
|
| 36 |
+
const modal = document.getElementById('taskModal');
|
| 37 |
+
const form = document.getElementById('taskForm');
|
| 38 |
+
|
| 39 |
+
if (task) {
|
| 40 |
+
document.getElementById('modalTitle').textContent = 'Edit Task';
|
| 41 |
+
document.getElementById('taskId').value = task.id;
|
| 42 |
+
document.getElementById('taskTitle').value = task.title;
|
| 43 |
+
document.getElementById('taskDescription').value = task.description;
|
| 44 |
+
document.getElementById('taskPriority').value = task.priority;
|
| 45 |
+
document.getElementById('taskDueDate').value = task.dueDate;
|
| 46 |
+
} else {
|
| 47 |
+
document.getElementById('modalTitle').textContent = 'Add New Task';
|
| 48 |
+
form.reset();
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
modal.classList.remove('hidden');
|
| 52 |
+
document.body.style.overflow = 'hidden';
|
| 53 |
+
feather.replace();
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
closeModal() {
|
| 57 |
+
document.getElementById('taskModal').classList.add('hidden');
|
| 58 |
+
document.body.style.overflow = 'auto';
|
| 59 |
+
document.getElementById('taskForm').reset();
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
saveTask() {
|
| 63 |
+
const form = document.getElementById('taskForm');
|
| 64 |
+
const taskId = document.getElementById('taskId').value;
|
| 65 |
+
const title = document.getElementById('taskTitle').value.trim();
|
| 66 |
+
const description = document.getElementById('taskDescription').value.trim();
|
| 67 |
+
const priority = document.getElementById('taskPriority').value;
|
| 68 |
+
const dueDate = document.getElementById('taskDueDate').value;
|
| 69 |
+
|
| 70 |
+
const taskData = {
|
| 71 |
+
id: taskId || Date.now().toString(),
|
| 72 |
+
title,
|
| 73 |
+
description,
|
| 74 |
+
priority,
|
| 75 |
+
dueDate,
|
| 76 |
+
status: 'pending',
|
| 77 |
+
createdAt: new Date().toISOString()
|
| 78 |
+
};
|
| 79 |
+
|
| 80 |
+
if (taskId) {
|
| 81 |
+
// Update existing task
|
| 82 |
+
const index = this.tasks.findIndex(t => t.id === taskId);
|
| 83 |
+
if (index !== -1) {
|
| 84 |
+
this.tasks[index] = taskData;
|
| 85 |
+
}
|
| 86 |
+
} else {
|
| 87 |
+
// Add new task
|
| 88 |
+
this.tasks.unshift(taskData);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
this.saveToLocalStorage();
|
| 92 |
+
this.closeModal();
|
| 93 |
+
this.renderTasks();
|
| 94 |
+
this.updateSummary();
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
deleteTask(taskId) {
|
| 98 |
+
if (confirm('Are you sure you want to delete this task?')) {
|
| 99 |
+
this.tasks = this.tasks.filter(task => task.id !== taskId);
|
| 100 |
+
this.saveToLocalStorage();
|
| 101 |
+
this.renderTasks();
|
| 102 |
+
this.updateSummary();
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
updateTaskStatus(taskId, newStatus) {
|
| 107 |
+
const task = this.tasks.find(t => t.id === taskId);
|
| 108 |
+
if (task) {
|
| 109 |
+
task.status = newStatus;
|
| 110 |
+
this.saveToLocalStorage();
|
| 111 |
+
this.renderTasks();
|
| 112 |
+
this.updateSummary();
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
filterTasks(filter) {
|
| 117 |
+
this.currentFilter = filter;
|
| 118 |
+
document.querySelectorAll('.filter-btn').forEach(btn => {
|
| 119 |
+
btn.classList.remove('active');
|
| 120 |
+
if (btn.textContent.toLowerCase().includes(filter)) {
|
| 121 |
+
btn.classList.add('active');
|
| 122 |
+
}
|
| 123 |
+
});
|
| 124 |
+
this.renderTasks();
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
searchTasks(query) {
|
| 128 |
+
this.renderTasks(query.toLowerCase());
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
renderTasks(searchQuery = '') {
|
| 132 |
+
const container = document.getElementById('tasksContainer');
|
| 133 |
+
|
| 134 |
+
// Filter tasks based on current filter and search query
|
| 135 |
+
let filteredTasks = this.tasks;
|
| 136 |
+
|
| 137 |
+
if (this.currentFilter !== 'all') {
|
| 138 |
+
filteredTasks = filteredTasks.filter(task => task.status === this.currentFilter);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
if (searchQuery) {
|
| 142 |
+
filteredTasks = filteredTasks.filter(task =>
|
| 143 |
+
task.title.toLowerCase().includes(searchQuery) ||
|
| 144 |
+
task.description.toLowerCase().includes(searchQuery)
|
| 145 |
+
);
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
if (filteredTasks.length === 0) {
|
| 149 |
+
container.innerHTML = `
|
| 150 |
+
<div class="p-6 text-center text-gray-500">
|
| 151 |
+
<i data-feather="inbox" class="w-12 h-12 mx-auto text-gray-300 mb-2"></i>
|
| 152 |
+
<p>No tasks found. ${searchQuery ? 'Try a different search.' : 'Add your first task!'}</p>
|
| 153 |
+
</div>
|
| 154 |
+
`;
|
| 155 |
+
feather.replace();
|
| 156 |
+
return;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
container.innerHTML = filteredTasks.map(task => `
|
| 160 |
+
<div class="task-card p-4 hover:bg-gray-50 ${'priority-' + task.priority}">
|
| 161 |
+
<div class="flex justify-between items-start gap-4">
|
| 162 |
+
<div class="flex-1">
|
| 163 |
+
<div class="flex items-center gap-2 mb-1">
|
| 164 |
+
<h3 class="font-medium text-gray-800">${task.title}</h3>
|
| 165 |
+
<span class="status-badge ${'status-' + task.status.replace(' ', '-')}">
|
| 166 |
+
${task.status.replace('-', ' ')}
|
| 167 |
+
</span>
|
| 168 |
+
</div>
|
| 169 |
+
<p class="text-gray-600 text-sm mb-2">${task.description || 'No description'}</p>
|
| 170 |
+
<div class="flex items-center gap-4 text-sm text-gray-500">
|
| 171 |
+
<div class="flex items-center gap-1">
|
| 172 |
+
<i data-feather="calendar" class="w-4 h-4"></i>
|
| 173 |
+
<span>${task.dueDate || 'No due date'}</span>
|
| 174 |
+
</div>
|
| 175 |
+
<div class="flex items-center gap-1">
|
| 176 |
+
<i data-feather="clock" class="w-4 h-4"></i>
|
| 177 |
+
<span>${new Date(task.createdAt).toLocaleDateString()}</span>
|
| 178 |
+
</div>
|
| 179 |
+
</div>
|
| 180 |
+
</div>
|
| 181 |
+
<div class="flex gap-2 task-actions">
|
| 182 |
+
<button class="edit-task p-2 text-gray-500 hover:text-primary rounded-full hover:bg-gray-100" data-id="${task.id}">
|
| 183 |
+
<i data-feather="edit" class="w-4 h-4"></i>
|
| 184 |
+
</button>
|
| 185 |
+
<button class="delete-task p-2 text-gray-500 hover:text-red-500 rounded-full hover:bg-gray-100" data-id="${task.id}">
|
| 186 |
+
<i data-feather="trash-2" class="w-4 h-4"></i>
|
| 187 |
+
</button>
|
| 188 |
+
<select class="status-select p-1.5 text-sm border border-gray-200 rounded-md focus:ring-primary focus:border-primary outline-none" data-id="${task.id}">
|
| 189 |
+
<option value="pending" ${task.status === 'pending' ? 'selected' : ''}>Pending</option>
|
| 190 |
+
<option value="in-progress" ${task.status === 'in-progress' ? 'selected' : ''}>In Progress</option>
|
| 191 |
+
<option value="completed" ${task.status === 'completed' ? 'selected' : ''}>Completed</option>
|
| 192 |
+
</select>
|
| 193 |
+
</div>
|
| 194 |
+
</div>
|
| 195 |
+
</div>
|
| 196 |
+
`).join('');
|
| 197 |
+
|
| 198 |
+
// Add event listeners to dynamic elements
|
| 199 |
+
document.querySelectorAll('.edit-task').forEach(btn => {
|
| 200 |
+
btn.addEventListener('click', (e) => {
|
| 201 |
+
const taskId = e.currentTarget.getAttribute('data-id');
|
| 202 |
+
const task = this.tasks.find(t => t.id === taskId);
|
| 203 |
+
if (task) this.openModal(task);
|
| 204 |
+
});
|
| 205 |
+
});
|
| 206 |
+
|
| 207 |
+
document.querySelectorAll('.delete-task').forEach(btn => {
|
| 208 |
+
btn.addEventListener('click', (e) => {
|
| 209 |
+
const taskId = e.currentTarget.getAttribute('data-id');
|
| 210 |
+
this.deleteTask(taskId);
|
| 211 |
+
});
|
| 212 |
+
});
|
| 213 |
+
|
| 214 |
+
document.querySelectorAll('.status-select').forEach(select => {
|
| 215 |
+
select.addEventListener('change', (e) => {
|
| 216 |
+
const taskId = e.currentTarget.getAttribute('data-id');
|
| 217 |
+
const newStatus = e.target.value;
|
| 218 |
+
this.updateTaskStatus(taskId, newStatus);
|
| 219 |
+
});
|
| 220 |
+
});
|
| 221 |
+
|
| 222 |
+
feather.replace();
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
updateSummary() {
|
| 226 |
+
const total = this.tasks.length;
|
| 227 |
+
const completed = this.tasks.filter(task => task.status === 'completed').length;
|
| 228 |
+
const pending = this.tasks.filter(task => task.status === 'pending').length;
|
| 229 |
+
const highPriority = this.tasks.filter(task => task.priority === 'high').length;
|
| 230 |
+
|
| 231 |
+
document.getElementById('totalTasks').textContent = total;
|
| 232 |
+
document.getElementById('completedTasks').textContent = completed;
|
| 233 |
+
document.getElementById('pendingTasks').textContent = pending;
|
| 234 |
+
document.getElementById('highPriorityTasks').textContent = highPriority;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
saveToLocalStorage() {
|
| 238 |
+
localStorage.setItem('tasks', JSON.stringify(this.tasks));
|
| 239 |
+
}
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
// Initialize the app when DOM is loaded
|
| 243 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 244 |
+
const app = new TaskManager();
|
| 245 |
+
});
|
style.css
CHANGED
|
@@ -1,28 +1,70 @@
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
.card {
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
.
|
| 27 |
-
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Shared styles across all pages */
|
| 2 |
body {
|
| 3 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
+
.filter-btn.active {
|
| 7 |
+
background-color: #6366f1;
|
| 8 |
+
color: white;
|
| 9 |
}
|
| 10 |
|
| 11 |
+
.task-card {
|
| 12 |
+
transition: all 0.2s ease;
|
|
|
|
|
|
|
|
|
|
| 13 |
}
|
| 14 |
|
| 15 |
+
.task-card:hover {
|
| 16 |
+
transform: translateY(-2px);
|
| 17 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
|
|
|
|
|
|
|
|
| 18 |
}
|
| 19 |
|
| 20 |
+
.priority-high {
|
| 21 |
+
border-left: 4px solid #ef4444;
|
| 22 |
}
|
| 23 |
+
|
| 24 |
+
.priority-medium {
|
| 25 |
+
border-left: 4px solid #f59e0b;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.priority-low {
|
| 29 |
+
border-left: 4px solid #10b981;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.status-badge {
|
| 33 |
+
font-size: 0.75rem;
|
| 34 |
+
padding: 0.25rem 0.5rem;
|
| 35 |
+
border-radius: 9999px;
|
| 36 |
+
font-weight: 500;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.status-pending {
|
| 40 |
+
background-color: #fef3c7;
|
| 41 |
+
color: #92400e;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
.status-in-progress {
|
| 45 |
+
background-color: #dbeafe;
|
| 46 |
+
color: #1e40af;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
.status-completed {
|
| 50 |
+
background-color: #d1fae5;
|
| 51 |
+
color: #065f46;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/* Animation for task completion */
|
| 55 |
+
@keyframes fadeIn {
|
| 56 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 57 |
+
to { opacity: 1; transform: translateY(0); }
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
.task-card {
|
| 61 |
+
animation: fadeIn 0.3s ease forwards;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/* Responsive adjustments */
|
| 65 |
+
@media (max-width: 640px) {
|
| 66 |
+
.task-actions {
|
| 67 |
+
flex-direction: column;
|
| 68 |
+
gap: 0.5rem;
|
| 69 |
+
}
|
| 70 |
+
}
|