File size: 18,817 Bytes
2b6805d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8edd1e9
2b6805d
 
8edd1e9
2b6805d
 
 
 
 
 
 
 
 
8edd1e9
 
 
 
 
 
 
 
 
 
 
2b6805d
 
8edd1e9
2b6805d
 
 
 
 
 
8edd1e9
 
2b6805d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8edd1e9
 
 
2b6805d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8edd1e9
 
 
 
2b6805d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4768c87
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TaskNinja Master - Slice Through Tasks! ⚔️</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.min.js"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#6366f1',
                        secondary: '#f59e0b'
                    }
                }
            }
        }
    </script>
    <style>
        .vanta-bg {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }
        .glass-effect {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        .task-card {
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
.task-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .fade-in {
            animation: fadeIn 0.5s ease-in;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
    </style>
</head>
<body class="min-h-screen bg-gradient-to-br from-gray-900 to-gray-800 text-white">
    <div id="vanta-bg" class="vanta-bg"></div>
    
    <!-- Navigation -->
    <nav class="glass-effect sticky top-0 z-50">
        <div class="container mx-auto px-4 py-4">
            <div class="flex justify-between items-center">
                <div class="flex items-center space-x-2">
                    <i data-feather="check-circle" class="text-primary"></i>
                    <h1 class="text-2xl font-bold">TaskNinja <span class="text-primary">Master</span> <span class="text-secondary">⚔️</span></h1>
</div>
                <div class="flex space-x-4">
                    <button id="tasks-tab" class="px-4 py-2 rounded-lg bg-primary text-white font-semibold transition-all duration-300">Tasks</button>
                    <button id="history-tab" class="px-4 py-2 rounded-lg bg-gray-700 hover:bg-gray-600 text-white font-semibold transition-all duration-300">History</button>
                </div>
            </div>
        </div>
    </nav>

    <!-- Main Content -->
    <main class="container mx-auto px-4 py-8">
        <!-- Tasks Section -->
        <section id="tasks-section" class="fade-in">
            <div class="max-w-4xl mx-auto">
                <!-- Add Task Form -->
                <div class="glass-effect rounded-2xl p-6 mb-8">
                    <h2 class="text-2xl font-bold mb-6 flex items-center">
                        <i data-feather="plus-circle" class="mr-3 text-primary animate-pulse"></i>
                        <span class="bg-clip-text text-transparent bg-gradient-to-r from-primary to-secondary">Throw a New Task Star</span> <span class="ml-2 text-secondary">✨</span>
                    </h2>
<form id="task-form" class="space-y-4">
                        <div class="grid md:grid-cols-2 gap-4">
                            <div>
                                <label class="block text-sm font-medium mb-2">Task Title</label>
                                <input type="text" id="task-title" placeholder="What needs to be done?" class="w-full px-4 py-3 rounded-lg bg-gray-800 border border-gray-600 focus:border-primary focus:ring-2 focus:ring-primary outline-none transition-all duration-300">
                            </div>
                            <div>
                                <label class="block text-sm font-medium mb-2">Priority</label>
                                <select id="task-priority" class="w-full px-4 py-3 rounded-lg bg-gray-800 border border-gray-600 focus:border-primary focus:ring-2 focus:ring-primary outline-none transition-all duration-300">
                                    <option value="low">Low</option>
                                    <option value="medium">Medium</option>
                                    <option value="high">High</option>
                                </select>
                            </div>
                        </div>
                        <div>
                            <label class="block text-sm font-medium mb-2">Description</label>
                            <textarea id="task-description" placeholder="Add some details..." rows="3" class="w-full px-4 py-3 rounded-lg bg-gray-800 border border-gray-600 focus:border-primary focus:ring-2 focus:ring-primary outline-none transition-all duration-300"></textarea>
                        </div>
                        <button type="submit" class="w-full bg-primary hover:bg-indigo-600 text-white font-semibold py-3 px-6 rounded-lg transition-all duration-300 transform hover:scale-105 flex items-center justify-center">
                            <i data-feather="plus" class="mr-2"></i>
                            Add Task
                        </button>
                    </form>
                </div>

                <!-- Task List -->
                <div class="glass-effect rounded-2xl p-6">
                    <h2 class="text-2xl font-bold mb-6 flex items-center">
                        <i data-feather="list" class="mr-3 text-secondary animate-spin" style="animation-duration: 3s"></i>
                        <span class="bg-clip-text text-transparent bg-gradient-to-r from-secondary to-primary">Dojo Tasks</span>
<span id="task-count" class="ml-3 bg-secondary text-white px-3 py-1 rounded-full text-sm">0 tasks</span>
                    </h2>
                    <div id="task-list" class="space-y-4">
                        <!-- Tasks will be dynamically added here -->
                    </div>
                </div>
            </div>
        </section>

        <!-- History Section -->
        <section id="history-section" class="hidden fade-in">
            <div class="max-w-4xl mx-auto">
                <div class="glass-effect rounded-2xl p-6">
                    <h2 class="text-2xl font-bold mb-6 flex items-center">
                        <i data-feather="clock" class="mr-3 text-secondary animate-bounce" style="animation-duration: 2s"></i>
                        <span class="bg-clip-text text-transparent bg-gradient-to-r from-gray-400 to-gray-300">Ninja Scroll Archive</span> <span class="ml-2">📜</span>
<span id="history-count" class="ml-3 bg-gray-600 text-white px-3 py-1 rounded-full text-sm">0 completed</span>
                    </h2>
                    <div id="history-list" class="space-y-4">
                        <!-- Completed tasks will be dynamically added here -->
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="glass-effect mt-12">
        <div class="container mx-auto px-4 py-6 text-center text-gray-400">
            <p class="text-sm">Crafted by <span class="font-bold text-primary">Ninja Developers</span> with <i data-feather="heart" class="inline w-4 h-4 text-red-500 animate-pulse"></i> | Sharpen your productivity katana daily!</p>
</div>
    </footer>

    <script>
        // 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: 0x6366f1,
            backgroundColor: 0x111827
        });

        // Task management functionality
        // Ninja-themed task storage with sound effects
        const taskSound = new Audio('https://assets.mixkit.co/sfx/preview/mixkit-positive-interface-beep-221.mp3');
        const completeSound = new Audio('https://assets.mixkit.co/sfx/preview/mixkit-unlock-game-notification-253.mp3');
        
        let tasks = JSON.parse(localStorage.getItem('ninjaTasks')) || [];
        let completedTasks = JSON.parse(localStorage.getItem('ninjaCompletedTasks')) || [];
// Tab switching
        document.getElementById('tasks-tab').addEventListener('click', () => {
            document.getElementById('tasks-section').classList.remove('hidden');
            document.getElementById('history-section').classList.add('hidden');
            document.getElementById('tasks-tab').classList.add('bg-primary', 'text-white');
            document.getElementById('tasks-tab').classList.remove('bg-gray-700');
            document.getElementById('history-tab').classList.add('bg-gray-700');
            document.getElementById('history-tab').classList.remove('bg-primary', 'text-white');
        });

        document.getElementById('history-tab').addEventListener('click', () => {
            document.getElementById('history-section').classList.remove('hidden');
            document.getElementById('tasks-section').classList.add('hidden');
            document.getElementById('history-tab').classList.add('bg-primary', 'text-white');
            document.getElementById('history-tab').classList.remove('bg-gray-700');
            document.getElementById('tasks-tab').classList.add('bg-gray-700');
            document.getElementById('tasks-tab').classList.remove('bg-primary', 'text-white');
            updateHistoryDisplay();
        });

        // Add task form
        document.getElementById('task-form').addEventListener('submit', (e) => {
            e.preventDefault();
            const title = document.getElementById('task-title').value.trim();
            const description = document.getElementById('task-description').value.trim();
            const priority = document.getElementById('task-priority').value;
            if (title) {
                const newTask = {
                    id: Date.now(),
                    title,
                    description,
                    priority,
                    createdAt: new Date().toISOString(),
                    completed: false
                };
                tasks.unshift(newTask); // Add to beginning instead of end
                saveTasks();
                document.getElementById('task-form').reset();
                
                // Ninja star throw animation
                anime({
                    targets: '#task-title',
                    translateX: [-20, 0],
                    translateY: [-10, 0],
                    opacity: [0, 1],
                    duration: 800,
                    easing: 'spring(1, 80, 10, 0)'
                });

                // Force re-render of task list
                updateTaskDisplay().then(() => {
                    // Animation for new task (first child since we added to beginning)
                    anime({
                        targets: '.task-card:first-child',
                        translateY: [50, 0],
                        opacity: [0, 1],
                        duration: 500,
                        easing: 'easeOutQuad'
                    });
                });
            }
});

        function saveTasks() {
            localStorage.setItem('ninjaTasks', JSON.stringify(tasks));
            localStorage.setItem('ninjaCompletedTasks', JSON.stringify(completedTasks));
            taskSound.play();
}
        async function updateTaskDisplay() {
const taskList = document.getElementById('task-list');
            const taskCount = document.getElementById('task-count');
            
            const pendingTasks = tasks.filter(task => !task.completed);
            taskCount.textContent = `${pendingTasks.length} ${pendingTasks.length === 1 ? 'task' : 'tasks'}`;
            
            taskList.innerHTML = pendingTasks.map(task => `
                <div class="task-card glass-effect rounded-xl p-4 border-l-4 ${
                    task.priority === 'high' ? 'border-red-500' : 
                    task.priority === 'medium' ? 'border-yellow-500' : 'border-green-500'
                }">
                    <div class="flex items-center justify-between">
                        <div class="flex items-center space-x-4">
                            <button onclick="toggleTask(${task.id})" class="w-6 h-6 rounded-full border-2 border-gray-400 hover:border-primary transition-all duration-300 flex items-center justify-center">
                                <i data-feather="check" class="w-4 h-4 text-white hidden"></i>
                            </button>
                            <div>
                                <h3 class="font-semibold text-lg">${task.title}</h3>
                                ${task.description ? `<p class="text-gray-300 text-sm mt-1">${task.description}</p>` : ''}
                                <div class="flex items-center space-x-4 mt-2">
                                    <span class="px-2 py-1 rounded-full text-xs ${
                                        task.priority === 'high' ? 'bg-red-500' : 
                                        task.priority === 'medium' ? 'bg-yellow-500' : 'bg-green-500'
                                    }">${task.priority}</span>
                                    <span class="text-gray-400 text-xs">${new Date(task.createdAt).toLocaleDateString()}</span>
                                </div>
                            </div>
                        </div>
                        <button onclick="deleteTask(${task.id})" class="text-gray-400 hover:text-red-400 transition-colors duration-300">
                            <i data-feather="trash-2" class="w-5 h-5"></i>
                        </button>
                    </div>
                </div>
            `).join('');
            await feather.replace();
            return Promise.resolve();
}

        function updateHistoryDisplay() {
            const historyList = document.getElementById('history-list');
            const historyCount = document.getElementById('history-count');
            
            historyCount.textContent = `${completedTasks.length} ${completedTasks.length === 1 ? 'completed' : 'completed'}`;
            
            historyList.innerHTML = completedTasks.map(task => `
                <div class="glass-effect rounded-xl p-4 border-l-4 border-gray-500 opacity-75">
                    <div class="flex items-center justify-between">
                        <div class="flex items-center space-x-4">
                            <div class="w-6 h-6 rounded-full bg-green-500 flex items-center justify-center">
                                <i data-feather="check" class="w-4 h-4 text-white"></i>
                            </div>
                            <div>
                                <h3 class="font-semibold text-lg line-through">${task.title}</h3>
                                ${task.description ? `<p class="text-gray-400 text-sm mt-1 line-through">${task.description}</p>` : ''}
                                <div class="flex items-center space-x-4 mt-2">
                                    <span class="px-2 py-1 rounded-full text-xs bg-gray-600">${task.priority}</span>
                                    <span class="text-gray-500 text-xs">Completed on ${new Date(task.completedAt).toLocaleDateString()}</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            `).join('');
            
            feather.replace();
        }
        function toggleTask(taskId) {
            // Play sound immediately with volume adjusted
            const sound = completeSound.cloneNode();
            sound.volume = 0.3;
            sound.play();
const task = tasks.find(t => t.id === taskId);
            if (task) {
                task.completed = true;
                task.completedAt = new Date().toISOString();
                completedTasks.push(task);
                tasks = tasks.filter(t => t.id !== taskId);
                saveTasks();
                updateTaskDisplay();
                
                // Show completion animation
                anime({
                    targets: '.task-card',
                    translateX: [0, -100],
                    opacity: [1, 0],
                    duration: 500,
                    easing: 'easeInQuad',
                    complete: function() {
                        updateTaskDisplay();
                    }
                });
            }
        }

        function deleteTask(taskId) {
            if (confirm('Are you sure you want to delete this task?')) {
                tasks = tasks.filter(t => t.id !== taskId);
                saveTasks();
                updateTaskDisplay();
            }
        }

        // Initialize display
        updateTaskDisplay();
        feather.replace();

        // Add some sample tasks if empty
        if (tasks.length === 0 && completedTasks.length === 0) {
                const sampleTasks = [
                    {
                        id: 1,
                        title: "Welcome to TaskNinja Master!",
                        description: "Slice through tasks like a true ninja master",
                        priority: "high",
                        createdAt: new Date().toISOString(),
                        completed: false
                    },
                    {
                        id: 2,
                        title: "Train your focus",
                        description: "Complete 5 tasks without distractions",
                        priority: "medium",
                        createdAt: new Date().toISOString(),
                        completed: false
                    },
                    {
                        id: 3,
                        title: "Achieve black belt",
                        description: "Complete 20 tasks to earn your black belt",
                        priority: "high",
                        createdAt: new Date().toISOString(),
                        completed: false
                    }
                ];
tasks = sampleTasks;
            saveTasks();
            updateTaskDisplay();
        }
    </script>
</body>
</html>