Spaces:
Running

undefined / tasks.html
moazelgen's picture
عايزو ييكون قادر علي ادا المهم الحقيقيه ومتكامل في كل الوظاف
e153705 verified
Raw History Blame Contribute Delete
10.9 kB
<!DOCTYPE html>
<html lang="en" class="scroll-smooth">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tasks | Cosmic Canvas</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Space Grotesk', sans-serif;
}
#vanta-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
.gradient-text {
background: linear-gradient(90deg, #0ea5e9 0%, #8b5cf6 100%);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.task-completed {
text-decoration: line-through;
opacity: 0.7;
}
</style>
</head>
<body class="bg-gray-900 text-white min-h-screen">
<div id="vanta-bg"></div>
<nav class="fixed w-full z-50 bg-gray-900/80 backdrop-blur-md">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16 items-center">
<div class="flex items-center">
<span class="text-2xl font-bold gradient-text">Cosmic Canvas</span>
</div>
<div class="hidden md:flex space-x-8">
<a href="index.html" class="text-white hover:text-primary-400 transition">Home</a>
<a href="gallery.html" class="text-white hover:text-primary-400 transition">Gallery</a>
<a href="ai-lab.html" class="text-white hover:text-primary-400 transition">AI Lab</a>
<a href="about.html" class="text-white hover:text-primary-400 transition">About</a>
<a href="chat.html" class="text-white hover:text-primary-400 transition">Chat</a>
<a href="tech-stack.html" class="text-white hover:text-primary-400 transition">Tech Stack</a>
<a href="tasks.html" class="text-white hover:text-primary-400 transition font-bold">Tasks</a>
</div>
<button class="md:hidden text-white">
<i data-feather="menu"></i>
</button>
</div>
</div>
</nav>
<main class="pt-24 pb-16 px-4 sm:px-6 lg:px-8">
<section class="max-w-7xl mx-auto">
<h1 class="text-5xl md:text-7xl font-bold mb-6 text-center">
<span class="gradient-text">Task</span> Manager
</h1>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8 mt-12">
<!-- Task Input -->
<div class="lg:col-span-3 bg-gray-800/50 backdrop-blur-md p-6 rounded-xl border border-gray-700">
<div class="flex items-center gap-4">
<input type="text" id="task-input" class="flex-1 bg-gray-700 text-white px-4 py-3 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500" placeholder="Add a new task...">
<button onclick="addTask()" class="bg-primary-600 hover:bg-primary-700 text-white px-6 py-3 rounded-lg flex items-center gap-2">
<i data-feather="plus"></i> Add
</button>
</div>
<div class="flex gap-4 mt-4">
<select id="task-priority" class="bg-gray-700 text-white px-4 py-2 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500">
<option value="low">Low Priority</option>
<option value="medium" selected>Medium Priority</option>
<option value="high">High Priority</option>
</select>
<input type="date" id="task-due" class="bg-gray-700 text-white px-4 py-2 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500">
</div>
</div>
<!-- Task Lists -->
<div class="bg-gray-800/50 backdrop-blur-md p-6 rounded-xl border border-gray-700">
<h2 class="text-xl font-bold mb-4 flex items-center gap-2">
<i data-feather="list"></i>
<span>All Tasks</span>
<span id="task-count" class="ml-auto bg-primary-600 text-white text-sm px-2 py-1 rounded-full">0</span>
</h2>
<div class="space-y-2" id="task-list"></div>
</div>
<div class="bg-gray-800/50 backdrop-blur-md p-6 rounded-xl border border-gray-700">
<h2 class="text-xl font-bold mb-4 flex items-center gap-2">
<i data-feather="check-circle"></i>
<span>Completed</span>
<span id="completed-count" class="ml-auto bg-secondary-600 text-white text-sm px-2 py-1 rounded-full">0</span>
</h2>
<div class="space-y-2" id="completed-list"></div>
</div>
<div class="bg-gray-800/50 backdrop-blur-md p-6 rounded-xl border border-gray-700">
<h2 class="text-xl font-bold mb-4 flex items-center gap-2">
<i data-feather="alert-triangle"></i>
<span>High Priority</span>
<span id="high-priority-count" class="ml-auto bg-red-600 text-white text-sm px-2 py-1 rounded-full">0</span>
</h2>
<div class="space-y-2" id="priority-list"></div>
</div>
</div>
</section>
</main>
<script>
feather.replace();
// Initialize Vanta.js background
VANTA.GLOBE({
el: "#vanta-bg",
mouseControls: true,
touchControls: true,
gyroControls: false,
minHeight: 200.00,
minWidth: 200.00,
scale: 1.00,
scaleMobile: 1.00,
color: 0x3b82f6,
backgroundColor: 0x111827
});
// Task Manager Functionality
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
function renderTasks() {
const taskList = document.getElementById('task-list');
const completedList = document.getElementById('completed-list');
const priorityList = document.getElementById('priority-list');
taskList.innerHTML = '';
completedList.innerHTML = '';
priorityList.innerHTML = '';
let activeCount = 0;
let completedCount = 0;
let highPriorityCount = 0;
tasks.forEach((task, index) => {
const taskElement = document.createElement('div');
taskElement.className = `flex items-center gap-3 p-3 rounded-lg ${task.completed ? 'bg-gray-700/50 task-completed' : 'bg-gray-700'}`;
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.checked = task.completed;
checkbox.className = 'rounded text-primary-600 focus:ring-primary-500';
checkbox.onchange = () => toggleTask(index);
const taskText = document.createElement('span');
taskText.className = 'flex-1';
taskText.textContent = task.text;
const priorityBadge = document.createElement('span');
priorityBadge.className = `text-xs px-2 py-1 rounded-full ${
task.priority === 'high' ? 'bg-red-600' :
task.priority === 'medium' ? 'bg-yellow-600' : 'bg-green-600'
}`;
priorityBadge.textContent = task.priority;
const deleteBtn = document.createElement('button');
deleteBtn.className = 'text-red-400 hover:text-red-300';
deleteBtn.innerHTML = '<i data-feather="trash-2" class="w-4 h-4"></i>';
deleteBtn.onclick = (e) => {
e.stopPropagation();
deleteTask(index);
};
taskElement.appendChild(checkbox);
taskElement.appendChild(taskText);
taskElement.appendChild(priorityBadge);
taskElement.appendChild(deleteBtn);
if (task.completed) {
completedList.appendChild(taskElement);
completedCount++;
} else {
taskList.appendChild(taskElement);
activeCount++;
if (task.priority === 'high') {
priorityList.appendChild(taskElement.cloneNode(true));
highPriorityCount++;
}
}
});
document.getElementById('task-count').textContent = activeCount;
document.getElementById('completed-count').textContent = completedCount;
document.getElementById('high-priority-count').textContent = highPriorityCount;
feather.replace();
}
function addTask() {
const input = document.getElementById('task-input');
const priority = document.getElementById('task-priority').value;
const dueDate = document.getElementById('task-due').value;
if (input.value.trim() === '') return;
tasks.push({
text: input.value.trim(),
priority,
dueDate: dueDate || null,
completed: false,
createdAt: new Date().toISOString()
});
input.value = '';
saveTasks();
renderTasks();
}
function toggleTask(index) {
tasks[index].completed = !tasks[index].completed;
saveTasks();
renderTasks();
}
function deleteTask(index) {
if (confirm('Are you sure you want to delete this task?')) {
tasks.splice(index, 1);
saveTasks();
renderTasks();
}
}
function saveTasks() {
localStorage.setItem('tasks', JSON.stringify(tasks));
}
// Initial render
renderTasks();
</script>
</body>
</html>