Spaces:
Running
Running
Build a next-gen, futuristic To-Do List web app with advanced task logic, smart animations, and gamified experience. The app should look and feel cutting-edge, like a productivity companion from the future — sleek, responsive, and mobile-optimized. 🔮 Visual Aesthetic Dark theme with neon/glassmorphism style. Use futuristic fonts like Orbitron, Exo 2, or Space Grotesk. Rounded cards, glowing borders, and subtle shadows. Transitions and animations powered by Framer Motion or Lottie. Icons from Lucide or sleek futuristic icon sets. ✅ Core Task Features Add New Task Input with title, optional description, category, and time. Tasks are displayed in a stacked card layout with soft glow. Complete Task with Animation When checked, play a laser-slice animation and apply strikethrough. Fade completed tasks but keep them visible until day ends. Daily Auto-Remove Completed tasks are auto-deleted at midnight. Uncompleted tasks auto-carry over to next day. Manual Force Remove "Clear Completed" button with subtle pulse animation. 💎 Cool & Unique Features XP & Level System: Earn XP for completing tasks. Show a glowing progress bar at top. Daily Streak Tracker: Show user streak with fire or lightning icon animation. Motivational Quotes or AI Tips shown at the top daily. Categorization Zones: Tasks organized by category tabs (e.g., Work, Life, Urgent). Timeline Mode: Alternate view to see tasks by hour like a vertical timeline. Theme Switcher: Toggle between Cyberpunk / Neon Grid / Glass Whiteout. 📲 Mobile Optimized + Download Button (PWA Feature) Add a "Download App" button in the top-right corner of the screen (like a floating icon or tucked in navbar corner). Button should be styled subtly — glass background, rounded, no clutter. When clicked: Trigger the PWA install prompt (Add to Home Screen). Show a small tooltip: "Install this app on your phone for full-screen experience." App should open in web view (no browser bar) after install. 💾 Storage & Sync (Optional) Store tasks using Supabase or localStorage. Optional auth (email/Google) to sync data across devices. 🗃 Optional Supabase Schema Table: tasks id, user_id, title, description, category, is_completed, created_at, updated_at, due_time Table: user_stats user_id, xp, level, current_streak, max_streak, last_checkin_date 🧩 Layout Notes Header area: App title left (e.g., “NeonTasks”) Right corner: floating or small “Download App” button. Main content: task input at top, tasks listed below, category tabs above list. Bottom: glowing “Clear Completed” button and streak/status bar. 🧠 Important UX Instructions All transitions should feel smooth and cinematic. The app should feel like an AI assistant with productivity gamification. Use a confetti or particle explosion animation on key achievements (e.g., 5 tasks completed). 🌐 Hosting & Behavior App must be PWA-compatible, installable via browser. - Initial Deployment
4681a40 verified Download index.html from krish95/simple-todo-app: direct link, hf CLI and curl.
- Browser
- Download file 37.4 kB
-
https://huggingface.co/spaces/krish95/simple-todo-app/resolve/main/index.html
- Command line
-
hf download hf://spaces/krish95/simple-todo-app/index.html
-
curl -L -o index.html https://huggingface.co/spaces/krish95/simple-todo-app/resolve/main/index.html
37.4 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>NeonTasks | Futuristic Productivity</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/lucide@latest"></script> | |
| <script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script> | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
| <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&family=Exo+2:wght@300;400;500;600;700&display=swap" rel="stylesheet"> | |
| <style> | |
| :root { | |
| --neon-blue: #08f7fe; | |
| --neon-pink: #fe53bb; | |
| --neon-green: #09fbd3; | |
| --neon-purple: #9467fe; | |
| --dark-bg: #0f0e17; | |
| --card-bg: rgba(15, 14, 23, 0.7); | |
| } | |
| body { | |
| font-family: 'Exo 2', sans-serif; | |
| background-color: var(--dark-bg); | |
| color: white; | |
| min-height: 100vh; | |
| overflow-x: hidden; | |
| } | |
| .font-futuristic { | |
| font-family: 'Orbitron', sans-serif; | |
| } | |
| .neon-text-blue { | |
| text-shadow: 0 0 5px var(--neon-blue), 0 0 10px var(--neon-blue); | |
| color: var(--neon-blue); | |
| } | |
| .neon-text-pink { | |
| text-shadow: 0 0 5px var(--neon-pink), 0 0 10px var(--neon-pink); | |
| color: var(--neon-pink); | |
| } | |
| .neon-text-green { | |
| text-shadow: 0 0 5px var(--neon-green), 0 0 10px var(--neon-green); | |
| color: var(--neon-green); | |
| } | |
| .neon-border-blue { | |
| box-shadow: 0 0 10px var(--neon-blue), inset 0 0 10px var(--neon-blue); | |
| border: 1px solid var(--neon-blue); | |
| } | |
| .neon-border-pink { | |
| box-shadow: 0 0 10px var(--neon-pink), inset 0 0 10px var(--neon-pink); | |
| border: 1px solid var(--neon-pink); | |
| } | |
| .neon-border-green { | |
| box-shadow: 0 0 10px var(--neon-green), inset 0 0 10px var(--neon-green); | |
| border: 1px solid var(--neon-green); | |
| } | |
| .glass-card { | |
| background: rgba(15, 14, 23, 0.7); | |
| backdrop-filter: blur(10px); | |
| -webkit-backdrop-filter: blur(10px); | |
| border-radius: 16px; | |
| } | |
| .glow-hover:hover { | |
| filter: drop-shadow(0 0 8px currentColor); | |
| } | |
| .task-completed { | |
| position: relative; | |
| opacity: 0.6; | |
| } | |
| .task-completed::before { | |
| content: ""; | |
| position: absolute; | |
| top: 50%; | |
| left: 0; | |
| right: 0; | |
| height: 2px; | |
| background: var(--neon-green); | |
| transform: scaleX(0); | |
| transform-origin: left; | |
| animation: strike 0.3s ease-out forwards; | |
| } | |
| @keyframes strike { | |
| to { transform: scaleX(1); } | |
| } | |
| .progress-bar { | |
| position: relative; | |
| overflow: hidden; | |
| } | |
| .progress-bar::after { | |
| content: ""; | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| height: 100%; | |
| width: var(--progress); | |
| background: linear-gradient(90deg, var(--neon-pink), var(--neon-blue)); | |
| transition: width 0.5s ease; | |
| } | |
| .streak-fire { | |
| animation: pulse 1.5s infinite alternate; | |
| } | |
| @keyframes pulse { | |
| from { filter: drop-shadow(0 0 5px #ff6b00); } | |
| to { filter: drop-shadow(0 0 15px #ff9500); } | |
| } | |
| .confetti { | |
| position: fixed; | |
| width: 100%; | |
| height: 100%; | |
| top: 0; | |
| left: 0; | |
| pointer-events: none; | |
| z-index: 1000; | |
| } | |
| .task-enter { | |
| animation: slideIn 0.3s ease-out forwards; | |
| } | |
| @keyframes slideIn { | |
| from { transform: translateY(20px); opacity: 0; } | |
| to { transform: translateY(0); opacity: 1; } | |
| } | |
| .category-tab.active { | |
| border-bottom: 2px solid var(--neon-blue); | |
| color: var(--neon-blue); | |
| } | |
| .timeline-item::before { | |
| content: ""; | |
| position: absolute; | |
| left: 20px; | |
| top: 30px; | |
| bottom: -30px; | |
| width: 2px; | |
| background: rgba(255, 255, 255, 0.2); | |
| } | |
| .timeline-item:last-child::before { | |
| display: none; | |
| } | |
| </style> | |
| </head> | |
| <body class="min-h-screen flex flex-col"> | |
| <!-- Confetti container (hidden by default) --> | |
| <div id="confetti" class="confetti hidden"></div> | |
| <!-- Header --> | |
| <header class="py-4 px-6 flex justify-between items-center border-b border-gray-800"> | |
| <h1 class="text-2xl font-futuristic neon-text-blue">NeonTasks</h1> | |
| <button id="installBtn" class="flex items-center gap-2 px-4 py-2 rounded-full glass-card neon-border-blue hover:bg-blue-900/20 transition-all group"> | |
| <i data-lucide="download" class="w-5 h-5 glow-hover"></i> | |
| <span class="hidden md:inline text-sm">Download App</span> | |
| <div class="absolute top-full mt-2 right-0 bg-gray-800 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity"> | |
| Install for full-screen experience | |
| </div> | |
| </button> | |
| </header> | |
| <!-- Motivational Quote --> | |
| <div class="px-6 py-3 text-center bg-gray-900/50 border-b border-gray-800"> | |
| <p id="motivationalQuote" class="text-sm italic">"Productivity is never an accident. It is always the result of a commitment to excellence, intelligent planning, and focused effort."</p> | |
| </div> | |
| <!-- Main Content --> | |
| <main class="flex-1 container mx-auto px-4 py-6 max-w-3xl"> | |
| <!-- XP Progress Bar --> | |
| <div class="mb-6"> | |
| <div class="flex justify-between items-center mb-1"> | |
| <span class="text-xs">Level <span id="currentLevel">1</span></span> | |
| <span class="text-xs"><span id="currentXP">0</span>/<span id="nextLevelXP">100</span> XP</span> | |
| </div> | |
| <div class="progress-bar h-2 rounded-full bg-gray-800" style="--progress: 0%"></div> | |
| </div> | |
| <!-- Streak Info --> | |
| <div class="flex items-center gap-2 mb-6"> | |
| <div class="flex items-center gap-1 px-3 py-1 rounded-full bg-gray-800/50"> | |
| <i data-lucide="flame" class="w-4 h-4 text-orange-400 streak-fire"></i> | |
| <span class="text-xs"><span id="streakCount">3</span> day streak</span> | |
| </div> | |
| <div class="flex items-center gap-1 px-3 py-1 rounded-full bg-gray-800/50"> | |
| <i data-lucide="trophy" class="w-4 h-4 text-yellow-400"></i> | |
| <span class="text-xs">Level <span id="displayLevel">1</span></span> | |
| </div> | |
| </div> | |
| <!-- Add Task Form --> | |
| <div class="glass-card p-4 mb-6 neon-border-blue"> | |
| <div class="flex gap-2"> | |
| <input id="taskInput" type="text" placeholder="What needs to be done?" class="flex-1 bg-gray-900/50 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:border-blue-500"> | |
| <button id="addTaskBtn" class="px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 transition-colors flex items-center gap-1"> | |
| <i data-lucide="plus" class="w-4 h-4"></i> | |
| <span>Add</span> | |
| </button> | |
| </div> | |
| <div class="mt-3 grid grid-cols-1 md:grid-cols-3 gap-2"> | |
| <select id="taskCategory" class="bg-gray-900/50 border border-gray-700 rounded-lg px-3 py-1 text-sm focus:outline-none"> | |
| <option value="general">General</option> | |
| <option value="work">Work</option> | |
| <option value="personal">Personal</option> | |
| <option value="urgent">Urgent</option> | |
| </select> | |
| <input id="taskTime" type="time" class="bg-gray-900/50 border border-gray-700 rounded-lg px-3 py-1 text-sm focus:outline-none"> | |
| <button id="showAdvancedBtn" class="text-xs text-gray-400 hover:text-white transition-colors flex items-center gap-1"> | |
| <i data-lucide="chevron-down" class="w-3 h-3"></i> | |
| <span>Advanced</span> | |
| </button> | |
| </div> | |
| <div id="advancedFields" class="mt-3 hidden"> | |
| <textarea id="taskDescription" placeholder="Description (optional)" class="w-full bg-gray-900/50 border border-gray-700 rounded-lg px-3 py-2 text-sm focus:outline-none resize-none" rows="2"></textarea> | |
| </div> | |
| </div> | |
| <!-- Category Tabs --> | |
| <div class="flex border-b border-gray-800 mb-4"> | |
| <button data-category="all" class="category-tab active px-4 py-2 text-sm">All</button> | |
| <button data-category="work" class="category-tab px-4 py-2 text-sm">Work</button> | |
| <button data-category="personal" class="category-tab px-4 py-2 text-sm">Personal</button> | |
| <button data-category="urgent" class="category-tab px-4 py-2 text-sm">Urgent</button> | |
| </div> | |
| <!-- View Toggle --> | |
| <div class="flex justify-end mb-4"> | |
| <div class="flex bg-gray-800 rounded-lg p-1"> | |
| <button id="listViewBtn" class="px-3 py-1 rounded-md bg-blue-600 text-white"> | |
| <i data-lucide="list" class="w-4 h-4"></i> | |
| </button> | |
| <button id="timelineViewBtn" class="px-3 py-1 rounded-md text-gray-400 hover:text-white"> | |
| <i data-lucide="align-justify" class="w-4 h-4"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Tasks List (Default View) --> | |
| <div id="tasksList" class="space-y-3"> | |
| <!-- Tasks will be added here dynamically --> | |
| </div> | |
| <!-- Timeline View (Hidden by default) --> | |
| <div id="timelineView" class="hidden space-y-6"> | |
| <!-- Timeline items will be added here dynamically --> | |
| </div> | |
| <!-- Empty State --> | |
| <div id="emptyState" class="text-center py-12 text-gray-500"> | |
| <i data-lucide="list-checks" class="w-12 h-12 mx-auto mb-4"></i> | |
| <h3 class="text-lg font-medium">No tasks yet</h3> | |
| <p class="text-sm">Add your first task to get started</p> | |
| </div> | |
| </main> | |
| <!-- Footer --> | |
| <footer class="py-4 px-6 border-t border-gray-800"> | |
| <div class="flex justify-between items-center"> | |
| <div class="text-sm text-gray-500"> | |
| <span id="taskCount">0</span> tasks remaining | |
| </div> | |
| <button id="clearCompletedBtn" class="px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 transition-colors flex items-center gap-1 neon-border-pink"> | |
| <i data-lucide="trash-2" class="w-4 h-4"></i> | |
| <span>Clear Completed</span> | |
| </button> | |
| </div> | |
| </footer> | |
| <script> | |
| // Initialize Lucide icons | |
| lucide.createIcons(); | |
| // App state | |
| let state = { | |
| tasks: [], | |
| xp: 0, | |
| level: 1, | |
| streak: 0, | |
| lastCheckinDate: null, | |
| viewMode: 'list', | |
| currentCategory: 'all' | |
| }; | |
| // DOM elements | |
| const elements = { | |
| taskInput: document.getElementById('taskInput'), | |
| addTaskBtn: document.getElementById('addTaskBtn'), | |
| tasksList: document.getElementById('tasksList'), | |
| timelineView: document.getElementById('timelineView'), | |
| emptyState: document.getElementById('emptyState'), | |
| clearCompletedBtn: document.getElementById('clearCompletedBtn'), | |
| taskCount: document.getElementById('taskCount'), | |
| currentXP: document.getElementById('currentXP'), | |
| nextLevelXP: document.getElementById('nextLevelXP'), | |
| currentLevel: document.getElementById('currentLevel'), | |
| displayLevel: document.getElementById('displayLevel'), | |
| streakCount: document.getElementById('streakCount'), | |
| motivationalQuote: document.getElementById('motivationalQuote'), | |
| confetti: document.getElementById('confetti'), | |
| taskCategory: document.getElementById('taskCategory'), | |
| taskTime: document.getElementById('taskTime'), | |
| taskDescription: document.getElementById('taskDescription'), | |
| showAdvancedBtn: document.getElementById('showAdvancedBtn'), | |
| advancedFields: document.getElementById('advancedFields'), | |
| listViewBtn: document.getElementById('listViewBtn'), | |
| timelineViewBtn: document.getElementById('timelineViewBtn'), | |
| installBtn: document.getElementById('installBtn'), | |
| categoryTabs: document.querySelectorAll('.category-tab') | |
| }; | |
| // Motivational quotes | |
| const quotes = [ | |
| "Productivity is never an accident. It is always the result of a commitment to excellence, intelligent planning, and focused effort.", | |
| "The secret of getting ahead is getting started.", | |
| "You don't have to be great to start, but you have to start to be great.", | |
| "The way to get started is to quit talking and begin doing.", | |
| "Your time is limited, don't waste it living someone else's life.", | |
| "The future depends on what you do today.", | |
| "Do the hard jobs first. The easy jobs will take care of themselves.", | |
| "Success is the sum of small efforts, repeated day in and day out.", | |
| "The only limit to our realization of tomorrow is our doubts of today.", | |
| "You are never too old to set another goal or to dream a new dream." | |
| ]; | |
| // Initialize the app | |
| function init() { | |
| loadState(); | |
| updateMotivationalQuote(); | |
| renderTasks(); | |
| setupEventListeners(); | |
| checkStreak(); | |
| // Check for PWA install prompt | |
| let deferredPrompt; | |
| window.addEventListener('beforeinstallprompt', (e) => { | |
| e.preventDefault(); | |
| deferredPrompt = e; | |
| elements.installBtn.style.display = 'flex'; | |
| }); | |
| elements.installBtn.addEventListener('click', async () => { | |
| if (deferredPrompt) { | |
| deferredPrompt.prompt(); | |
| const { outcome } = await deferredPrompt.userChoice; | |
| if (outcome === 'accepted') { | |
| elements.installBtn.style.display = 'none'; | |
| } | |
| deferredPrompt = null; | |
| } | |
| }); | |
| } | |
| // Set up event listeners | |
| function setupEventListeners() { | |
| elements.addTaskBtn.addEventListener('click', addTask); | |
| elements.taskInput.addEventListener('keypress', (e) => { | |
| if (e.key === 'Enter') addTask(); | |
| }); | |
| elements.clearCompletedBtn.addEventListener('click', clearCompletedTasks); | |
| elements.showAdvancedBtn.addEventListener('click', toggleAdvancedFields); | |
| elements.listViewBtn.addEventListener('click', () => switchView('list')); | |
| elements.timelineViewBtn.addEventListener('click', () => switchView('timeline')); | |
| elements.categoryTabs.forEach(tab => { | |
| tab.addEventListener('click', () => { | |
| elements.categoryTabs.forEach(t => t.classList.remove('active')); | |
| tab.classList.add('active'); | |
| state.currentCategory = tab.dataset.category; | |
| renderTasks(); | |
| }); | |
| }); | |
| } | |
| // Toggle advanced fields | |
| function toggleAdvancedFields() { | |
| elements.advancedFields.classList.toggle('hidden'); | |
| const icon = elements.showAdvancedBtn.querySelector('i'); | |
| if (elements.advancedFields.classList.contains('hidden')) { | |
| icon.setAttribute('data-lucide', 'chevron-down'); | |
| } else { | |
| icon.setAttribute('data-lucide', 'chevron-up'); | |
| } | |
| lucide.createIcons(); | |
| } | |
| // Switch between list and timeline view | |
| function switchView(view) { | |
| state.viewMode = view; | |
| if (view === 'list') { | |
| elements.tasksList.classList.remove('hidden'); | |
| elements.timelineView.classList.add('hidden'); | |
| elements.listViewBtn.classList.add('bg-blue-600', 'text-white'); | |
| elements.listViewBtn.classList.remove('text-gray-400'); | |
| elements.timelineViewBtn.classList.add('text-gray-400'); | |
| elements.timelineViewBtn.classList.remove('bg-blue-600', 'text-white'); | |
| } else { | |
| elements.tasksList.classList.add('hidden'); | |
| elements.timelineView.classList.remove('hidden'); | |
| elements.timelineViewBtn.classList.add('bg-blue-600', 'text-white'); | |
| elements.timelineViewBtn.classList.remove('text-gray-400'); | |
| elements.listViewBtn.classList.add('text-gray-400'); | |
| elements.listViewBtn.classList.remove('bg-blue-600', 'text-white'); | |
| } | |
| renderTasks(); | |
| } | |
| // Add a new task | |
| function addTask() { | |
| const title = elements.taskInput.value.trim(); | |
| if (!title) return; | |
| const newTask = { | |
| id: Date.now().toString(), | |
| title, | |
| description: elements.taskDescription.value.trim(), | |
| category: elements.taskCategory.value, | |
| time: elements.taskTime.value, | |
| completed: false, | |
| createdAt: new Date().toISOString() | |
| }; | |
| state.tasks.unshift(newTask); | |
| saveState(); | |
| renderTasks(); | |
| // Reset form | |
| elements.taskInput.value = ''; | |
| elements.taskDescription.value = ''; | |
| elements.taskTime.value = ''; | |
| if (!elements.advancedFields.classList.contains('hidden')) { | |
| toggleAdvancedFields(); | |
| } | |
| elements.taskInput.focus(); | |
| // Animation for new task | |
| const taskElement = document.getElementById(`task-${newTask.id}`); | |
| if (taskElement) { | |
| taskElement.classList.add('task-enter'); | |
| } | |
| } | |
| // Toggle task completion | |
| function toggleTaskCompletion(taskId) { | |
| const task = state.tasks.find(t => t.id === taskId); | |
| if (!task) return; | |
| task.completed = !task.completed; | |
| task.updatedAt = new Date().toISOString(); | |
| if (task.completed) { | |
| // Add XP for completing a task | |
| addXP(10); | |
| // Check for achievement (every 5 completed tasks) | |
| const completedCount = state.tasks.filter(t => t.completed).length; | |
| if (completedCount % 5 === 0) { | |
| showConfetti(); | |
| } | |
| } else { | |
| // Remove XP if unchecking | |
| addXP(-10); | |
| } | |
| saveState(); | |
| renderTasks(); | |
| } | |
| // Delete a task | |
| function deleteTask(taskId) { | |
| state.tasks = state.tasks.filter(task => task.id !== taskId); | |
| saveState(); | |
| renderTasks(); | |
| } | |
| // Clear completed tasks | |
| function clearCompletedTasks() { | |
| state.tasks = state.tasks.filter(task => !task.completed); | |
| saveState(); | |
| renderTasks(); | |
| // Animation | |
| elements.clearCompletedBtn.classList.add('animate-pulse'); | |
| setTimeout(() => { | |
| elements.clearCompletedBtn.classList.remove('animate-pulse'); | |
| }, 1000); | |
| } | |
| // Add XP and level up | |
| function addXP(amount) { | |
| state.xp += amount; | |
| // Calculate XP needed for next level (simple progression) | |
| const xpNeeded = state.level * 100; | |
| if (state.xp >= xpNeeded) { | |
| state.level++; | |
| state.xp = state.xp - xpNeeded; | |
| elements.displayLevel.textContent = state.level; | |
| elements.currentLevel.textContent = state.level; | |
| showConfetti(); | |
| } else if (state.xp < 0) { | |
| state.xp = 0; | |
| } | |
| // Update UI | |
| updateXPDisplay(); | |
| saveState(); | |
| } | |
| // Update XP display | |
| function updateXPDisplay() { | |
| elements.currentXP.textContent = state.xp; | |
| elements.nextLevelXP.textContent = state.level * 100; | |
| // Update progress bar | |
| const progress = (state.xp / (state.level * 100)) * 100; | |
| document.querySelector('.progress-bar').style.setProperty('--progress', `${progress}%`); | |
| } | |
| // Check and update streak | |
| function checkStreak() { | |
| const today = new Date().toDateString(); | |
| if (!state.lastCheckinDate) { | |
| // First time using the app | |
| state.lastCheckinDate = today; | |
| state.streak = 1; | |
| } else if (state.lastCheckinDate === today) { | |
| // Already checked in today | |
| return; | |
| } else { | |
| const lastDate = new Date(state.lastCheckinDate); | |
| const currentDate = new Date(); | |
| const dayDiff = (currentDate - lastDate) / (1000 * 60 * 60 * 24); | |
| if (dayDiff <= 1) { | |
| // Checked in consecutive days | |
| state.streak++; | |
| } else if (dayDiff > 1) { | |
| // Broken streak | |
| state.streak = 1; | |
| } | |
| state.lastCheckinDate = today; | |
| } | |
| elements.streakCount.textContent = state.streak; | |
| saveState(); | |
| } | |
| // Update motivational quote | |
| function updateMotivationalQuote() { | |
| const randomQuote = quotes[Math.floor(Math.random() * quotes.length)]; | |
| elements.motivationalQuote.textContent = randomQuote; | |
| // Change quote every 12 hours | |
| setTimeout(updateMotivationalQuote, 12 * 60 * 60 * 1000); | |
| } | |
| // Show confetti animation | |
| function showConfetti() { | |
| elements.confetti.classList.remove('hidden'); | |
| // Create confetti elements | |
| for (let i = 0; i < 100; i++) { | |
| const confetti = document.createElement('div'); | |
| confetti.style.position = 'absolute'; | |
| confetti.style.width = `${Math.random() * 10 + 5}px`; | |
| confetti.style.height = `${Math.random() * 10 + 5}px`; | |
| confetti.style.backgroundColor = getRandomColor(); | |
| confetti.style.left = `${Math.random() * 100}%`; | |
| confetti.style.top = '-10px'; | |
| confetti.style.opacity = '0.8'; | |
| confetti.style.transform = `rotate(${Math.random() * 360}deg)`; | |
| // Animation | |
| const animation = confetti.animate([ | |
| { top: '-10px', opacity: 0.8 }, | |
| { top: '100%', opacity: 0 } | |
| ], { | |
| duration: Math.random() * 3000 + 2000, | |
| easing: 'cubic-bezier(0.1, 0.8, 0.9, 1)' | |
| }); | |
| elements.confetti.appendChild(confetti); | |
| // Remove after animation | |
| animation.onfinish = () => { | |
| confetti.remove(); | |
| if (elements.confetti.children.length === 0) { | |
| elements.confetti.classList.add('hidden'); | |
| } | |
| }; | |
| } | |
| } | |
| // Get random neon color | |
| function getRandomColor() { | |
| const colors = ['#08f7fe', '#fe53bb', '#09fbd3', '#9467fe', '#f5d300']; | |
| return colors[Math.floor(Math.random() * colors.length)]; | |
| } | |
| // Render tasks based on current view and category | |
| function renderTasks() { | |
| // Filter tasks by category | |
| let filteredTasks = [...state.tasks]; | |
| if (state.currentCategory !== 'all') { | |
| filteredTasks = filteredTasks.filter(task => task.category === state.currentCategory); | |
| } | |
| // Update task count | |
| const activeTasks = filteredTasks.filter(task => !task.completed).length; | |
| elements.taskCount.textContent = activeTasks; | |
| // Show empty state if no tasks | |
| if (filteredTasks.length === 0) { | |
| elements.emptyState.classList.remove('hidden'); | |
| elements.tasksList.classList.add('hidden'); | |
| elements.timelineView.classList.add('hidden'); | |
| return; | |
| } else { | |
| elements.emptyState.classList.add('hidden'); | |
| } | |
| if (state.viewMode === 'list') { | |
| renderListTasks(filteredTasks); | |
| } else { | |
| renderTimelineTasks(filteredTasks); | |
| } | |
| } | |
| // Render tasks in list view | |
| function renderListTasks(tasks) { | |
| elements.tasksList.innerHTML = ''; | |
| elements.tasksList.classList.remove('hidden'); | |
| tasks.forEach(task => { | |
| const taskElement = document.createElement('div'); | |
| taskElement.id = `task-${task.id}`; | |
| taskElement.className = `glass-card p-4 flex items-start gap-3 transition-all ${task.completed ? 'task-completed' : ''}`; | |
| // Add category-specific border | |
| if (task.category === 'work') { | |
| taskElement.classList.add('neon-border-blue'); | |
| } else if (task.category === 'personal') { | |
| taskElement.classList.add('neon-border-green'); | |
| } else if (task.category === 'urgent') { | |
| taskElement.classList.add('neon-border-pink'); | |
| } else { | |
| taskElement.classList.add('border-gray-700'); | |
| } | |
| // Checkbox | |
| const checkbox = document.createElement('div'); | |
| checkbox.className = 'flex items-center mt-1'; | |
| checkbox.innerHTML = ` | |
| <input type="checkbox" id="check-${task.id}" ${task.completed ? 'checked' : ''} | |
| class="w-5 h-5 rounded bg-gray-800 border-2 border-gray-700 focus:ring-0 focus:ring-offset-0"> | |
| `; | |
| checkbox.querySelector('input').addEventListener('change', () => toggleTaskCompletion(task.id)); | |
| // Task content | |
| const content = document.createElement('div'); | |
| content.className = 'flex-1'; | |
| const title = document.createElement('div'); | |
| title.className = `font-medium ${task.completed ? 'line-through text-gray-400' : ''}`; | |
| title.textContent = task.title; | |
| const meta = document.createElement('div'); | |
| meta.className = 'flex flex-wrap gap-2 mt-1 text-xs text-gray-400'; | |
| if (task.category && task.category !== 'general') { | |
| const category = document.createElement('span'); | |
| category.className = 'px-2 py-0.5 rounded-full bg-gray-800/50'; | |
| category.textContent = task.category.charAt(0).toUpperCase() + task.category.slice(1); | |
| meta.appendChild(category); | |
| } | |
| if (task.time) { | |
| const time = document.createElement('span'); | |
| time.className = 'flex items-center gap-1'; | |
| time.innerHTML = `<i data-lucide="clock" class="w-3 h-3"></i> ${task.time}`; | |
| meta.appendChild(time); | |
| } | |
| if (task.description) { | |
| const desc = document.createElement('div'); | |
| desc.className = 'mt-2 text-sm text-gray-300'; | |
| desc.textContent = task.description; | |
| content.appendChild(desc); | |
| } | |
| content.appendChild(title); | |
| content.appendChild(meta); | |
| // Delete button | |
| const deleteBtn = document.createElement('button'); | |
| deleteBtn.className = 'p-1 text-gray-500 hover:text-red-400 transition-colors'; | |
| deleteBtn.innerHTML = '<i data-lucide="trash-2" class="w-4 h-4"></i>'; | |
| deleteBtn.addEventListener('click', (e) => { | |
| e.stopPropagation(); | |
| deleteTask(task.id); | |
| }); | |
| taskElement.appendChild(checkbox); | |
| taskElement.appendChild(content); | |
| taskElement.appendChild(deleteBtn); | |
| elements.tasksList.appendChild(taskElement); | |
| }); | |
| // Recreate Lucide icons for new elements | |
| lucide.createIcons(); | |
| } | |
| // Render tasks in timeline view | |
| function renderTimelineTasks(tasks) { | |
| elements.timelineView.innerHTML = ''; | |
| elements.timelineView.classList.remove('hidden'); | |
| // Sort tasks by time (if available) or creation date | |
| const sortedTasks = [...tasks].sort((a, b) => { | |
| if (a.time && b.time) return a.time.localeCompare(b.time); | |
| return new Date(a.createdAt) - new Date(b.createdAt); | |
| }); | |
| sortedTasks.forEach(task => { | |
| const taskElement = document.createElement('div'); | |
| taskElement.className = `timeline-item relative pl-12 ${task.completed ? 'opacity-60' : ''}`; | |
| // Time indicator | |
| const timeIndicator = document.createElement('div'); | |
| timeIndicator.className = 'absolute left-0 top-0 w-8 h-8 rounded-full flex items-center justify-center bg-gray-800 border-2 border-gray-700'; | |
| if (task.time) { | |
| timeIndicator.innerHTML = `<span class="text-xs">${task.time.split(':').slice(0, 2).join(':')}</span>`; | |
| } else { | |
| timeIndicator.innerHTML = '<i data-lucide="calendar" class="w-4 h-4"></i>'; | |
| } | |
| // Task card | |
| const card = document.createElement('div'); | |
| card.className = `glass-card p-4 mb-6 ${task.completed ? 'task-completed' : ''}`; | |
| // Add category-specific border | |
| if (task.category === 'work') { | |
| card.classList.add('neon-border-blue'); | |
| } else if (task.category === 'personal') { | |
| card.classList.add('neon-border-green'); | |
| } else if (task.category === 'urgent') { | |
| card.classList.add('neon-border-pink'); | |
| } else { | |
| card.classList.add('border-gray-700'); | |
| } | |
| // Task title and checkbox | |
| const header = document.createElement('div'); | |
| header.className = 'flex items-center justify-between'; | |
| const title = document.createElement('div'); | |
| title.className = `font-medium ${task.completed ? 'line-through text-gray-400' : ''}`; | |
| title.textContent = task.title; | |
| const checkbox = document.createElement('div'); | |
| checkbox.className = 'flex items-center'; | |
| checkbox.innerHTML = ` | |
| <input type="checkbox" id="check-${task.id}" ${task.completed ? 'checked' : ''} | |
| class="w-5 h-5 rounded bg-gray-800 border-2 border-gray-700 focus:ring-0 focus:ring-offset-0"> | |
| `; | |
| checkbox.querySelector('input').addEventListener('change', () => toggleTaskCompletion(task.id)); | |
| header.appendChild(title); | |
| header.appendChild(checkbox); | |
| // Task description | |
| const description = document.createElement('div'); | |
| description.className = 'mt-2 text-sm text-gray-300'; | |
| description.textContent = task.description; | |
| // Task meta (category) | |
| const meta = document.createElement('div'); | |
| meta.className = 'mt-2 flex justify-end'; | |
| if (task.category && task.category !== 'general') { | |
| const category = document.createElement('span'); | |
| category.className = 'px-2 py-0.5 rounded-full text-xs bg-gray-800/50'; | |
| category.textContent = task.category.charAt(0).toUpperCase() + task.category.slice(1); | |
| meta.appendChild(category); | |
| } | |
| card.appendChild(header); | |
| if (task.description) card.appendChild(description); | |
| card.appendChild(meta); | |
| taskElement.appendChild(timeIndicator); | |
| taskElement.appendChild(card); | |
| elements.timelineView.appendChild(taskElement); | |
| }); | |
| // Recreate Lucide icons for new elements | |
| lucide.createIcons(); | |
| } | |
| // Save state to localStorage | |
| function saveState() { | |
| localStorage.setItem('neonTasksState', JSON.stringify(state)); | |
| } | |
| // Load state from localStorage | |
| function loadState() { | |
| const savedState = localStorage.getItem('neonTasksState'); | |
| if (savedState) { | |
| state = JSON.parse(savedState); | |
| // Update UI from loaded state | |
| elements.currentXP.textContent = state.xp; | |
| elements.nextLevelXP.textContent = state.level * 100; | |
| elements.currentLevel.textContent = state.level; | |
| elements.displayLevel.textContent = state.level; | |
| elements.streakCount.textContent = state.streak; | |
| updateXPDisplay(); | |
| } | |
| } | |
| // Clean up old completed tasks at midnight | |
| function cleanUpCompletedTasks() { | |
| const now = new Date(); | |
| const midnight = new Date(); | |
| midnight.setHours(24, 0, 0, 0); | |
| // Check if it's midnight | |
| if (now.getHours() === 0 && now.getMinutes() === 0) { | |
| state.tasks = state.tasks.filter(task => !task.completed); | |
| saveState(); | |
| renderTasks(); | |
| } | |
| // Schedule next check in 1 minute | |
| setTimeout(cleanUpCompletedTasks, 60000); | |
| } | |
| // Initialize the app when DOM is loaded | |
| document.addEventListener('DOMContentLoaded', init); | |
| // Start the midnight cleanup check | |
| setTimeout(cleanUpCompletedTasks, 1000); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=krish95/simple-todo-app" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |