File size: 2,657 Bytes
272d177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
document.addEventListener('DOMContentLoaded', function() {
    // Theme toggle functionality
    const themeToggle = document.getElementById('theme-toggle');
    const html = document.documentElement;
    
    // Check for saved theme preference or use preferred color scheme
    const savedTheme = localStorage.getItem('theme') || 
                      (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
    html.classList.add(savedTheme);
    
    themeToggle.addEventListener('click', () => {
        html.classList.toggle('dark');
        const theme = html.classList.contains('dark') ? 'dark' : 'light';
        localStorage.setItem('theme', theme);
    });

    // Task modal functionality
    const addTaskBtn = document.getElementById('add-task-btn');
    const addTaskModal = document.getElementById('add-task-modal');
    const closeModalBtn = document.getElementById('close-modal-btn');
    const cancelTaskBtn = document.getElementById('cancel-task-btn');
    const taskForm = document.getElementById('task-form');

    addTaskBtn.addEventListener('click', () => {
        addTaskModal.classList.remove('hidden');
    });

    [closeModalBtn, cancelTaskBtn].forEach(btn => {
        btn.addEventListener('click', () => {
            addTaskModal.classList.add('hidden');
            taskForm.reset();
        });
    });

    taskForm.addEventListener('submit', (e) => {
        e.preventDefault();
        const title = document.getElementById('task-title').value;
        const description = document.getElementById('task-description').value;
        const category = document.getElementById('task-category').value;
        
        // In a real app, you would send this to your backend
        console.log('New task:', { title, description, category });
        
        // Close modal and reset form
        addTaskModal.classList.add('hidden');
        taskForm.reset();
        
        // Show success message
        alert('Task added to backlog!');
    });

    // Task action handlers
    document.querySelectorAll('.task-action-btn').forEach(btn => {
        btn.addEventListener('click', function() {
            const action = this.getAttribute('data-action');
            const taskCard = this.closest('.task-card');
            const taskId = taskCard.getAttribute('data-id');
            
            switch(action) {
                case 'assign':
                    // In a real app, you would show a modal to select assignee
                    alert(`Assigning task ${taskId} to a team member`);
                    break;
                case 'unassign':
                    alert(`Unassigning