Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Mobile menu toggle
+ const menuToggle = document.querySelector('.menu-toggle');
+ const navLinks = document.querySelector('.nav-links');
+
+ menuToggle?.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+ menuToggle.classList.toggle('active');
+ });
+
+ // Task management
+ const newTaskInput = document.getElementById('newTask');
+ const addTaskButton = document.getElementById('addTask');
+ const todoList = document.getElementById('todoList');
+ const inProgressList = document.getElementById('inProgressList');
+ const completedList = document.getElementById('completedList');
+
+ let tasks = JSON.parse(localStorage.getItem('tasks') || '[]');
+
+ function addTask(text) {
+ const task = {
+ id: Date.now(),
+ text,
+ status: 'todo'
+ };
+ tasks.push(task);
+ saveTasks();
+ renderTasks();
+ }
+
+ function saveTasks() {
+ localStorage.setItem('tasks', JSON.stringify(tasks));
+ }
+
+ function renderTasks() {
+ todoList.innerHTML = '';
+ inProgressList.innerHTML = '';
+ completedList.innerHTML = '';
+
+ tasks.forEach(task => {
+ const li = document.createElement('li');
+ li.textContent = task.text;
+ li.draggable = true;
+ li.dataset.id = task.id;
+
+ switch(task.status) {
+ case 'todo':
+ todoList.appendChild(li);
+ break;
+ case 'inProgress':
+ inProgressList.appendChild(li);
+ break;
+ case 'completed':
+ completedList.appendChild(li);
+ break;
+ }
+ });
+
+ updateAnalytics();
+ }
+
+ addTaskButton?.addEventListener('click', () => {
+ const text = newTaskInput.value.trim();
+ if (text) {
+ addTask(text);
+ newTaskInput.value = '';
+ }
+ });
+
+ // Drag and drop functionality
+ const taskLists = document.querySelectorAll('.task-list');
+
+ taskLists.forEach(list => {
+ list.addEventListener('dragover', e => {
+ e.preventDefault();
+ const draggingElement = document.querySelector('.dragging');
+ if (draggingElement) {
+ list.appendChild(draggingElement);
+ }
+ });
+ });
+
+ document.addEventListener('dragstart', e => {
+ if (e.target.matches('li')) {
+ e.target.classList.add('dragging');
+ }
+ });
+
+ document.addEventListener('dragend', e => {
+ if (e.target.matches('li')) {
+ e.target.classList.remove('dragging');
+ const taskId = parseInt(e.target.dataset.id);
+ const newStatus = e.target.parentElement.id.replace('List', '');
+
+ const taskIndex = tasks.findIndex(t => t.id === taskId);
+ if (taskIndex !== -1) {
+ tasks[taskIndex].status = newStatus;
+ saveTasks();
+ updateAnalytics();
+ }
+ }
+ });
+
+ // Analytics
+ function updateAnalytics() {
+ const total = tasks.length;
+ const completed = tasks.filter(t => t.status === 'completed').length;
+ const productivityScore = total ? Math.round((completed / total) * 100) : 0;
+
+ const scoreElement = document.querySelector('.score');
+ if (scoreElement) {
+ scoreElement.textContent = `${productivityScore}%`;
+ document.querySelector('.circle-progress').style.background =
+ `conic-gradient(var(--primary-color) ${productivityScore}%, #eee ${productivityScore}%)`;
+ }
+ }
+
+ // Initial render
+ renderTasks();
+ });