Spaces:
Running
Running
Je veux en 3 pages. Revois le design. Les fonctionnalités ne marchent pas
Browse filesFiles changed (8)
- README.md+6-3
- components/footer.jsAdded+44
- components/navbar.jsAdded+138
- focus.htmlAdded+136
- index.html+185-19
- script.jsAdded+483
- style.css+133-19
- tasks.htmlAdded+153
12345678910---title: Flowstateemoji: 🐨colorFrom: yellowcolorTo: bluesdk: staticpinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference12345678910111213---title: FlowState 🧠colorFrom: yellowcolorTo: blueemoji: 🐳sdk: staticpinned: falsetags:- deepsite-v3---# Welcome to your new DeepSite project!This project was created with [DeepSite](https://huggingface.co/deepsite).
1234567891011121314151617181920212223242526272829303132333435363738394041424344class FlowFooter extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` <style> :host { display: block; } a { text-decoration: none; transition: color 0.2s; } a:hover { color: #10b981; } </style> <footer class="bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 mt-12"> <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8"> <div class="flex flex-col md:flex-row justify-between items-center gap-4"> <div class="flex items-center gap-2"> <span class="text-xl font-bold text-gray-800 dark:text-white"> <span class="text-primary-500">Flow</span>State </span> <span class="text-sm text-gray-500">© 2024</span> </div> <div class="flex items-center gap-6 text-sm text-gray-600 dark:text-gray-400"> <a href="index.html">Dashboard</a> <a href="tasks.html">Tasks</a> <a href="focus.html">Focus</a> </div> <div class="text-sm text-gray-500 dark:text-gray-500"> Stay productive, stay focused </div> </div> </div> </footer> `; }}
customElements.define('flow-footer', FlowFooter);123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138class FlowNavbar extends HTMLElement { connectedCallback() { this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = ` <style> :host { display: block; } .navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 50; background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(0, 0, 0, 0.1); } .dark .navbar { background: rgba(17, 24, 39, 0.8); border-bottom: 1px solid rgba(255, 255, 255, 0.1); } .nav-link { position: relative; padding: 0.5rem 1rem; border-radius: 0.5rem; transition: all 0.3s; color: #4b5563; text-decoration: none; } .dark .nav-link { color: #9ca3af; } .nav-link:hover { background-color: rgba(16, 185, 129, 0.1); color: #059669; } .nav-link.active { color: #059669; font-weight: 600; } .dark .nav-link.active { color: #34d399; } .nav-link.active::after { content: ''; position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); width: 20px; height: 3px; background: #10b981; border-radius: 2px; } .mobile-menu { display: none; } .menu-open .mobile-menu { display: block; } @media (max-width: 768px) { .desktop-menu { display: none; } } </style> <nav class="navbar"> <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> <div class="flex justify-between h-16 items-center"> <a href="index.html" class="flex items-center gap-2 text-2xl font-bold text-gray-800 dark:text-white hover:scale-105 transition-transform"> <span class="text-primary-500">Flow</span>State <span class="text-2xl">🧠</span> </a> <div class="desktop-menu flex items-center gap-1"> <a href="index.html" class="nav-link" data-page="index">Dashboard</a> <a href="tasks.html" class="nav-link" data-page="tasks">Tasks</a> <a href="focus.html" class="nav-link" data-page="focus">Focus</a> <button id="theme-toggle" class="ml-4 p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors" title="Toggle theme"> <svg class="w-5 h-5 hidden dark:block text-yellow-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path> </svg> <svg class="w-5 h-5 block dark:hidden text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"></path> </svg> </button> </div> <button id="mobile-menu-btn" class="md:hidden p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800"> <svg class="w-6 h-6 dark:text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path> </svg> </button> </div> <div class="mobile-menu pb-4 md:hidden"> <a href="index.html" class="block px-4 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 dark:text-gray-300">Dashboard</a> <a href="tasks.html" class="block px-4 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 dark:text-gray-300">Tasks</a> <a href="focus.html" class="block px-4 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 dark:text-gray-300">Focus</a> <button id="mobile-theme-toggle" class="w-full text-left px-4 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 dark:text-gray-300 flex items-center gap-2"> <span>Toggle Theme</span> </button> </div> </div> </nav> `; // Theme toggle const themeBtn = this.shadowRoot.getElementById('theme-toggle'); const mobileThemeBtn = this.shadowRoot.getElementById('mobile-theme-toggle'); const toggleTheme = () => { const isDark = document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', isDark ? 'dark' : 'light'); }; themeBtn?.addEventListener('click', toggleTheme); mobileThemeBtn?.addEventListener('click', toggleTheme); // Mobile menu toggle const menuBtn = this.shadowRoot.getElementById('mobile-menu-btn'); menuBtn?.addEventListener('click', () => { this.shadowRoot.querySelector('.navbar').classList.toggle('menu-open'); }); // Set active nav link const currentPage = window.location.pathname.split('/').pop().replace('.html', '') || 'index'; const activeLink = this.shadowRoot.querySelector(`[data-page="${currentPage}"]`); if (activeLink) { activeLink.classList.add('active'); } }}
customElements.define('flow-navbar', FlowNavbar);123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136<!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>FlowState - Focus Mode</title> <link rel="stylesheet" href="style.css"> <script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> <script> tailwind.config = { darkMode: 'class', theme: { extend: { colors: { primary: { 50: '#ecfdf5', 100: '#d1fae5', 500: '#10b981', 600: '#059669', 700: '#047857', }, secondary: { 50: '#f5f3ff', 100: '#ede9fe', 500: '#8b5cf6', 600: '#7c3aed', 700: '#6d28d9', } }, animation: { 'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite', 'spin-slow': 'spin 3s linear infinite', } } } } </script></head><body class="bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-100 transition-colors duration-300"> <flow-navbar></flow-navbar>
<main class="pt-24 pb-12 px-4 sm:px-6 lg:px-8 max-w-5xl mx-auto"> <div class="text-center mb-12"> <h1 class="text-4xl font-bold mb-4">Focus Mode</h1> <p class="text-gray-600 dark:text-gray-400 text-lg">Stay in the zone with the Pomodoro technique</p> </div>
<!-- Timer Card --> <div class="bg-white dark:bg-gray-800 rounded-3xl p-8 sm:p-12 shadow-2xl border border-gray-200 dark:border-gray-700 max-w-2xl mx-auto mb-12 relative overflow-hidden"> <div class="absolute inset-0 bg-gradient-to-br from-primary-500/5 to-secondary-500/5"></div> <div class="relative z-10"> <!-- Mode Selector --> <div class="flex justify-center gap-2 mb-8"> <button onclick="setTimerMode(25)" class="timer-mode px-4 py-2 rounded-full text-sm font-medium transition-all bg-primary-100 text-primary-700 dark:bg-primary-900 dark:text-primary-300" data-mode="25">Focus (25)</button> <button onclick="setTimerMode(5)" class="timer-mode px-4 py-2 rounded-full text-sm font-medium transition-all hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400" data-mode="5">Short Break</button> <button onclick="setTimerMode(15)" class="timer-mode px-4 py-2 rounded-full text-sm font-medium transition-all hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400" data-mode="15">Long Break</button> </div>
<!-- Timer Display --> <div class="relative w-64 h-64 mx-auto mb-8"> <svg class="w-full h-full transform -rotate-90" viewBox="0 0 100 100"> <circle cx="50" cy="50" r="45" fill="none" stroke="currentColor" stroke-width="8" class="text-gray-200 dark:text-gray-700"></circle> <circle id="progress-ring" cx="50" cy="50" r="45" fill="none" stroke="currentColor" stroke-width="8" stroke-linecap="round" class="text-primary-500 transition-all duration-1000" stroke-dasharray="283" stroke-dashoffset="0"></circle> </svg> <div class="absolute inset-0 flex items-center justify-center"> <div class="text-center"> <div id="timer-display" class="text-6xl font-bold tabular-nums">25:00</div> <div id="timer-status" class="text-sm text-gray-500 mt-2 font-medium uppercase tracking-wider">Ready</div> </div> </div> </div>
<!-- Controls --> <div class="flex justify-center gap-4"> <button id="start-btn" onclick="toggleTimer()" class="w-16 h-16 rounded-full bg-primary-600 hover:bg-primary-700 text-white flex items-center justify-center shadow-lg hover:shadow-primary-500/50 transition-all transform hover:scale-110"> <i data-feather="play" class="w-6 h-6 ml-1" id="play-icon"></i> </button> <button onclick="resetTimer()" class="w-16 h-16 rounded-full bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 flex items-center justify-center transition-all transform hover:scale-110"> <i data-feather="rotate-ccw" class="w-6 h-6"></i> </button> </div> </div> </div>
<!-- Session Stats --> <div class="grid grid-cols-1 md:grid-cols-3 gap-6"> <div class="bg-white dark:bg-gray-800 rounded-2xl p-6 shadow-lg border border-gray-200 dark:border-gray-700 text-center"> <div class="w-12 h-12 mx-auto mb-3 bg-primary-100 dark:bg-primary-900 rounded-full flex items-center justify-center"> <i data-feather="check-circle" class="w-6 h-6 text-primary-600"></i> </div> <h3 class="text-2xl font-bold mb-1" id="sessions-completed">0</h3> <p class="text-sm text-gray-600 dark:text-gray-400">Sessions Completed</p> </div>
<div class="bg-white dark:bg-gray-800 rounded-2xl p-6 shadow-lg border border-gray-200 dark:border-gray-700 text-center"> <div class="w-12 h-12 mx-auto mb-3 bg-secondary-100 dark:bg-secondary-900 rounded-full flex items-center justify-center"> <i data-feather="clock" class="w-6 h-6 text-secondary-600"></i> </div> <h3 class="text-2xl font-bold mb-1" id="total-focus-time">0h 0m</h3> <p class="text-sm text-gray-600 dark:text-gray-400">Total Focus Time</p> </div>
<div class="bg-white dark:bg-gray-800 rounded-2xl p-6 shadow-lg border border-gray-200 dark:border-gray-700 text-center"> <div class="w-12 h-12 mx-auto mb-3 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center"> <i data-feather="calendar" class="w-6 h-6 text-orange-600"></i> </div> <h3 class="text-2xl font-bold mb-1" id="current-streak">5</h3> <p class="text-sm text-gray-600 dark:text-gray-400">Day Streak</p> </div> </div>
<!-- Quote --> <div class="mt-12 text-center max-w-2xl mx-auto"> <blockquote class="text-xl italic text-gray-600 dark:text-gray-400"> "Focus on being productive instead of busy." </blockquote> <cite class="block mt-2 text-sm text-gray-500 not-italic">— Tim Ferriss</cite> </div> </main>
<flow-footer></flow-footer>
<script src="components/navbar.js"></script> <script src="components/footer.js"></script> <script src="script.js"></script> <script> feather.replace(); // Focus page specific initialization document.addEventListener('DOMContentLoaded', () => { loadTimerStats(); }); </script></body></html>12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185<!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>FlowState - Dashboard</title><link rel="stylesheet" href="style.css"><script src="https://cdn.tailwindcss.com"></script><script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script><script>tailwind.config = {darkMode: 'class',theme: {extend: {colors: {primary: {50: '#ecfdf5',100: '#d1fae5',500: '#10b981',600: '#059669',700: '#047857',900: '#064e3b',},secondary: {50: '#f5f3ff',100: '#ede9fe',500: '#8b5cf6',600: '#7c3aed',700: '#6d28d9',}},animation: {'float': 'float 3s ease-in-out infinite','pulse-slow': 'pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite',},keyframes: {float: {'0%, 100%': { transform: 'translateY(0)' },'50%': { transform: 'translateY(-10px)' },}}}}}</script></head><body class="bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-100 transition-colors duration-300"><flow-navbar></flow-navbar><main class="pt-24 pb-12 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto"><!-- Hero Section --><div class="mb-12 relative overflow-hidden rounded-3xl bg-gradient-to-br from-primary-500 to-secondary-600 p-8 sm:p-12 text-white shadow-2xl"><div class="absolute top-0 right-0 -mt-16 -mr-16 w-64 h-64 bg-white opacity-10 rounded-full blur-3xl"></div><div class="absolute bottom-0 left-0 -mb-16 -ml-16 w-48 h-48 bg-white opacity-10 rounded-full blur-2xl"></div><div class="relative z-10"><h1 class="text-4xl sm:text-5xl font-bold mb-4 animate-float">Welcome back, Creator 🌟</h1><p class="text-lg opacity-90 mb-6 max-w-2xl">Stay in the flow. You have <span id="pending-count" class="font-bold underline">0</span> tasks waiting for your attention today.</p><a href="tasks.html" class="inline-flex items-center px-6 py-3 bg-white text-primary-600 rounded-full font-semibold hover:bg-gray-100 transition-all transform hover:scale-105 shadow-lg"><i data-feather="plus-circle" class="w-5 h-5 mr-2"></i>Quick Add Task</a></div></div><!-- Stats Grid --><div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12"><div class="glass-card p-6 rounded-2xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg hover:shadow-xl transition-shadow"><div class="flex items-center justify-between mb-4"><div class="p-3 bg-primary-100 dark:bg-primary-900 rounded-xl"><i data-feather="check-circle" class="w-6 h-6 text-primary-600"></i></div><span class="text-sm text-gray-500 dark:text-gray-400">Today</span></div><h3 class="text-3xl font-bold mb-1" id="completed-stat">0</h3><p class="text-sm text-gray-600 dark:text-gray-400">Tasks completed</p><div class="mt-4 h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden"><div id="completion-bar" class="h-full bg-primary-500 rounded-full transition-all duration-500" style="width: 0%"></div></div></div><div class="glass-card p-6 rounded-2xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg hover:shadow-xl transition-shadow"><div class="flex items-center justify-between mb-4"><div class="p-3 bg-secondary-100 dark:bg-secondary-900 rounded-xl"><i data-feather="zap" class="w-6 h-6 text-secondary-600"></i></div><span class="text-sm text-gray-500 dark:text-gray-400">Focus Time</span></div><h3 class="text-3xl font-bold mb-1" id="focus-stat">0h</h3><p class="text-sm text-gray-600 dark:text-gray-400">Deep work sessions</p><div class="mt-4 flex items-center text-sm text-secondary-600"><i data-feather="trending-up" class="w-4 h-4 mr-1"></i><span>+12% from last week</span></div></div><div class="glass-card p-6 rounded-2xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg hover:shadow-xl transition-shadow"><div class="flex items-center justify-between mb-4"><div class="p-3 bg-orange-100 dark:bg-orange-900 rounded-xl"><i data-feather="award" class="w-6 h-6 text-orange-600"></i></div><span class="text-sm text-gray-500 dark:text-gray-400">Streak</span></div><h3 class="text-3xl font-bold mb-1" id="streak-stat">5</h3><p class="text-sm text-gray-600 dark:text-gray-400">Days in a row</p><div class="mt-4 flex gap-1"><div class="h-2 w-full bg-primary-500 rounded-full"></div><div class="h-2 w-full bg-primary-500 rounded-full"></div><div class="h-2 w-full bg-primary-500 rounded-full"></div><div class="h-2 w-full bg-primary-500 rounded-full"></div><div class="h-2 w-full bg-primary-500 rounded-full"></div><div class="h-2 w-full bg-gray-300 dark:bg-gray-600 rounded-full"></div><div class="h-2 w-full bg-gray-300 dark:bg-gray-600 rounded-full"></div></div></div></div><!-- Recent Tasks Preview --><div class="grid grid-cols-1 lg:grid-cols-2 gap-8"><div class="bg-white dark:bg-gray-800 rounded-2xl p-6 shadow-lg border border-gray-200 dark:border-gray-700"><div class="flex items-center justify-between mb-6"><h2 class="text-xl font-bold flex items-center"><i data-feather="clock" class="w-5 h-5 mr-2 text-primary-500"></i>Recent Tasks</h2><a href="tasks.html" class="text-sm text-primary-600 hover:text-primary-700 font-medium">View all</a></div><div id="recent-tasks-list" class="space-y-3"><!-- Tasks injected here --><div class="text-center py-8 text-gray-500"><i data-feather="inbox" class="w-12 h-12 mx-auto mb-3 opacity-50"></i><p>No tasks yet. Start by adding one!</p></div></div></div><div class="bg-white dark:bg-gray-800 rounded-2xl p-6 shadow-lg border border-gray-200 dark:border-gray-700"><div class="flex items-center justify-between mb-6"><h2 class="text-xl font-bold flex items-center"><i data-feather="target" class="w-5 h-5 mr-2 text-secondary-500"></i>Categories</h2></div><div class="space-y-4" id="categories-list"><div class="flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700 rounded-xl"><div class="flex items-center"><div class="w-3 h-3 rounded-full bg-primary-500 mr-3"></div><span>Work</span></div><span class="text-sm text-gray-500" id="count-work">0 tasks</span></div><div class="flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700 rounded-xl"><div class="flex items-center"><div class="w-3 h-3 rounded-full bg-secondary-500 mr-3"></div><span>Personal</span></div><span class="text-sm text-gray-500" id="count-personal">0 tasks</span></div><div class="flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700 rounded-xl"><div class="flex items-center"><div class="w-3 h-3 rounded-full bg-orange-500 mr-3"></div><span>Learning</span></div><span class="text-sm text-gray-500" id="count-learning">0 tasks</span></div></div></div></div></main><flow-footer></flow-footer><script src="components/navbar.js"></script><script src="components/footer.js"></script><script src="script.js"></script><script>feather.replace();// Dashboard specific initializationdocument.addEventListener('DOMContentLoaded', () => {updateDashboardStats();});</script><script src="https://huggingface.co/deepsite/deepsite-badge.js"></script></body></html>
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483// State Managementlet tasks = JSON.parse(localStorage.getItem('flowstate_tasks')) || [];let currentFilter = 'all';let searchQuery = '';
// Timer Statelet timerInterval = null;let timeLeft = 25 * 60;let totalTime = 25 * 60;let isTimerRunning = false;let currentMode = 25;
// Theme Togglefunction initTheme() { const theme = localStorage.getItem('theme') || 'light'; if (theme === 'dark') { document.documentElement.classList.add('dark'); }}
function toggleTheme() { const isDark = document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', isDark ? 'dark' : 'light');}
// Task Managementfunction saveTasks() { localStorage.setItem('flowstate_tasks', JSON.stringify(tasks)); updateDashboardStats();}
function generateId() { return Date.now().toString(36) + Math.random().toString(36).substr(2);}
function handleTaskSubmit(e) { e.preventDefault(); const id = document.getElementById('task-id').value; const title = document.getElementById('task-title').value; const description = document.getElementById('task-desc').value; const category = document.getElementById('task-category').value; const priority = document.getElementById('task-priority').value; if (id) { // Edit existing const index = tasks.findIndex(t => t.id === id); if (index !== -1) { tasks[index] = { ...tasks[index], title, description, category, priority }; } } else { // Create new const task = { id: generateId(), title, description, category, priority, completed: false, createdAt: new Date().toISOString() }; tasks.push(task); } saveTasks(); closeModal(); renderTasks();}
function toggleTaskComplete(id) { const task = tasks.find(t => t.id === id); if (task) { task.completed = !task.completed; task.completedAt = task.completed ? new Date().toISOString() : null; saveTasks(); renderTasks(); }}
function deleteTask(id) { if (confirm('Are you sure you want to delete this task?')) { tasks = tasks.filter(t => t.id !== id); saveTasks(); renderTasks(); }}
function editTask(id) { const task = tasks.find(t => t.id === id); if (task) { document.getElementById('task-id').value = task.id; document.getElementById('task-title').value = task.title; document.getElementById('task-desc').value = task.description || ''; document.getElementById('task-category').value = task.category || 'work'; document.getElementById('task-priority').value = task.priority || 'medium'; document.getElementById('modal-title').textContent = 'Edit Task'; openModal(); }}
function getPriorityColor(priority) { const colors = { high: 'text-red-600 bg-red-100 dark:bg-red-900/30', medium: 'text-amber-600 bg-amber-100 dark:bg-amber-900/30', low: 'text-emerald-600 bg-emerald-100 dark:bg-emerald-900/30' }; return colors[priority] || colors.medium;}
function getCategoryIcon(category) { const icons = { work: 'briefcase', personal: 'user', learning: 'book', health: 'heart' }; return icons[category] || 'tag';}
function renderTasks() { const container = document.getElementById('tasks-container'); const emptyState = document.getElementById('empty-state'); if (!container) return; // Not on tasks page let filteredTasks = tasks; // Apply filter if (currentFilter === 'pending') { filteredTasks = filteredTasks.filter(t => !t.completed); } else if (currentFilter === 'completed') { filteredTasks = filteredTasks.filter(t => t.completed); } // Apply search if (searchQuery) { filteredTasks = filteredTasks.filter(t => t.title.toLowerCase().includes(searchQuery.toLowerCase()) || (t.description && t.description.toLowerCase().includes(searchQuery.toLowerCase())) ); } // Sort: pending first, then by priority filteredTasks.sort((a, b) => { if (a.completed === b.completed) return 0; return a.completed ? 1 : -1; }); if (filteredTasks.length === 0) { container.innerHTML = ''; emptyState.classList.remove('hidden'); return; } emptyState.classList.add('hidden'); container.innerHTML = filteredTasks.map(task => ` <div class="task-item bg-white dark:bg-gray-800 rounded-xl p-4 sm:p-6 shadow-md border border-gray-200 dark:border-gray-700 priority-${task.priority} ${task.completed ? 'opacity-60' : ''} animate-slide-in"> <div class="flex items-start gap-4"> <label class="checkbox-wrapper cursor-pointer relative flex items-center mt-1"> <input type="checkbox" class="sr-only" ${task.completed ? 'checked' : ''} onchange="toggleTaskComplete('${task.id}')"> <div class="w-6 h-6 border-2 border-gray-300 dark:border-gray-600 rounded-lg flex items-center justify-center transition-all hover:border-primary-500"> <svg class="w-4 h-4 text-white hidden" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M5 13l4 4L19 7"></path> </svg> </div> </label> <div class="flex-1 min-w-0"> <div class="flex items-start justify-between gap-4"> <div> <h3 class="font-semibold text-lg ${task.completed ? 'line-through text-gray-500' : ''}">${escapeHtml(task.title)}</h3> ${task.description ? `<p class="text-gray-600 dark:text-gray-400 text-sm mt-1">${escapeHtml(task.description)}</p>` : ''} <div class="flex flex-wrap items-center gap-2 mt-3"> <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium capitalize ${getPriorityColor(task.priority)}"> ${task.priority} </span> <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400"> <i data-feather="${getCategoryIcon(task.category)}" class="w-3 h-3 mr-1"></i> ${task.category} </span> ${task.completed ? ` <span class="text-xs text-gray-400"> Completed ${new Date(task.completedAt).toLocaleDateString()} </span> ` : ''} </div> </div> <div class="flex items-center gap-2"> <button onclick="editTask('${task.id}')" class="p-2 text-gray-400 hover:text-primary-600 hover:bg-primary-50 dark:hover:bg-primary-900/30 rounded-lg transition-colors"> <i data-feather="edit-2" class="w-4 h-4"></i> </button> <button onclick="deleteTask('${task.id}')" class="p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/30 rounded-lg transition-colors"> <i data-feather="trash-2" class="w-4 h-4"></i> </button> </div> </div> </div> </div> </div> `).join(''); feather.replace();}
// Utilityfunction escapeHtml(text) { if (!text) return ''; const div = document.createElement('div'); div.textContent = text; return div.innerHTML;}
// Modal Functionsfunction openModal() { const modal = document.getElementById('task-modal'); const content = document.getElementById('modal-content'); modal.classList.remove('hidden'); modal.classList.add('flex'); setTimeout(() => { modal.classList.add('show'); }, 10); // Reset form if new task if (!document.getElementById('task-id').value) { document.getElementById('task-form').reset(); document.getElementById('modal-title').textContent = 'New Task'; }}
function closeModal() { const modal = document.getElementById('task-modal'); const content = document.getElementById('modal-content'); modal.classList.remove('show'); setTimeout(() => { modal.classList.add('hidden'); modal.classList.remove('flex'); document.getElementById('task-form').reset(); document.getElementById('task-id').value = ''; }, 300);}
// Filter Functionsfunction filterTasks(filter) { currentFilter = filter; // Update UI document.querySelectorAll('.filter-btn').forEach(btn => { if (btn.dataset.filter === filter) { btn.classList.remove('hover:bg-gray-100', 'dark:hover:bg-gray-700', 'text-gray-600', 'dark:text-gray-400'); btn.classList.add('bg-primary-100', 'text-primary-700', 'dark:bg-primary-900', 'dark:text-primary-300'); } else { btn.classList.add('hover:bg-gray-100', 'dark:hover:bg-gray-700', 'text-gray-600', 'dark:text-gray-400'); btn.classList.remove('bg-primary-100', 'text-primary-700', 'dark:bg-primary-900', 'dark:text-primary-300'); } }); renderTasks();}
function searchTasks(query) { searchQuery = query; renderTasks();}
// Dashboard Statsfunction updateDashboardStats() { const completed = tasks.filter(t => t.completed).length; const pending = tasks.filter(t => !t.completed).length; const total = tasks.length; // Update counts const pendingEl = document.getElementById('pending-count'); const completedEl = document.getElementById('completed-stat'); const completionBar = document.getElementById('completion-bar'); if (pendingEl) pendingEl.textContent = pending; if (completedEl) completedEl.textContent = completed; if (completionBar) { const percentage = total > 0 ? (completed / total) * 100 : 0; completionBar.style.width = percentage + '%'; } // Update category counts const categories = ['work', 'personal', 'learning']; categories.forEach(cat => { const count = tasks.filter(t => t.category === cat && !t.completed).length; const el = document.getElementById(`count-${cat}`); if (el) el.textContent = `${count} tasks`; }); // Update recent tasks const recentList = document.getElementById('recent-tasks-list'); if (recentList) { const recentTasks = tasks .filter(t => !t.completed) .slice(0, 5); if (recentTasks.length === 0) { recentList.innerHTML = ` <div class="text-center py-8 text-gray-500"> <i data-feather="inbox" class="w-12 h-12 mx-auto mb-3 opacity-50"></i> <p>No pending tasks. Great job!</p> </div> `; } else { recentList.innerHTML = recentTasks.map(task => ` <div class="flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700/50 rounded-xl border border-gray-100 dark:border-gray-700"> <div class="flex items-center gap-3"> <div class="w-2 h-2 rounded-full bg-${task.priority === 'high' ? 'red' : task.priority === 'medium' ? 'amber' : 'emerald'}-500"></div> <span class="text-sm font-medium truncate max-w-[200px]">${escapeHtml(task.title)}</span> </div> <button onclick="toggleTaskComplete('${task.id}')" class="text-gray-400 hover:text-primary-600 transition-colors"> <i data-feather="check" class="w-4 h-4"></i> </button> </div> `).join(''); } feather.replace(); }}
// Timer Functionsfunction formatTime(seconds) { const mins = Math.floor(seconds / 60); const secs = seconds % 60; return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;}
function updateTimerDisplay() { const display = document.getElementById('timer-display'); const ring = document.getElementById('progress-ring'); if (display) { display.textContent = formatTime(timeLeft); } if (ring) { const circumference = 2 * Math.PI * 45; // r=45 const progress = (totalTime - timeLeft) / totalTime; const offset = circumference - (progress * circumference); ring.style.strokeDashoffset = offset; }}
function toggleTimer() { if (isTimerRunning) { pauseTimer(); } else { startTimer(); }}
function startTimer() { if (timeLeft === 0) return; isTimerRunning = true; document.getElementById('start-btn').innerHTML = '<i data-feather="pause" class="w-6 h-6"></i>'; document.getElementById('timer-status').textContent = 'Focusing...'; document.getElementById('timer-status').classList.add('text-primary-600'); feather.replace(); timerInterval = setInterval(() => { timeLeft--; updateTimerDisplay(); if (timeLeft === 0) { completeTimer(); } }, 1000);}
function pauseTimer() { isTimerRunning = false; clearInterval(timerInterval); document.getElementById('start-btn').innerHTML = '<i data-feather="play" class="w-6 h-6 ml-1"></i>'; document.getElementById('timer-status').textContent = 'Paused'; document.getElementById('timer-status').classList.remove('text-primary-600'); feather.replace();}
function resetTimer() { pauseTimer(); timeLeft = currentMode * 60; totalTime = currentMode * 60; updateTimerDisplay(); document.getElementById('timer-status').textContent = 'Ready';}
function completeTimer() { pauseTimer(); document.getElementById('timer-status').textContent = 'Completed!'; // Play sound (optional, using Web Audio API for a beep) playCompletionSound(); // Save stats const stats = JSON.parse(localStorage.getItem('flowstate_stats')) || { sessions: 0, totalMinutes: 0 }; stats.sessions++; stats.totalMinutes += currentMode; localStorage.setItem('flowstate_stats', JSON.stringify(stats)); loadTimerStats(); // Reset after 3 seconds setTimeout(() => { resetTimer(); }, 3000);}
function playCompletionSound() { try { const audioContext = new (window.AudioContext || window.webkitAudioContext)(); const oscillator = audioContext.createOscillator(); const gainNode = audioContext.createGain(); oscillator.connect(gainNode); gainNode.connect(audioContext.destination); oscillator.frequency.value = 800; oscillator.type = 'sine'; gainNode.gain.setValueAtTime(0.3, audioContext.currentTime); gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.5); oscillator.start(audioContext.currentTime); oscillator.stop(audioContext.currentTime + 0.5); } catch (e) { console.log('Audio not supported'); }}
function setTimerMode(minutes) { currentMode = minutes; resetTimer(); // Update UI document.querySelectorAll('.timer-mode').forEach(btn => { if (parseInt(btn.dataset.mode) === minutes) { btn.classList.remove('hover:bg-gray-100', 'dark:hover:bg-gray-700', 'text-gray-600', 'dark:text-gray-400'); btn.classList.add('bg-primary-100', 'text-primary-700', 'dark:bg-primary-900', 'dark:text-primary-300'); } else { btn.classList.add('hover:bg-gray-100', 'dark:hover:bg-gray-700', 'text-gray-600', 'dark:text-gray-400'); btn.classList.remove('bg-primary-100', 'text-primary-700', 'dark:bg-primary-900', 'dark:text-primary-300'); } });}
function loadTimerStats() { const stats = JSON.parse(localStorage.getItem('flowstate_stats')) || { sessions: 0, totalMinutes: 0 }; const sessionsEl = document.getElementById('sessions-completed'); const timeEl = document.getElementById('total-focus-time'); if (sessionsEl) sessionsEl.textContent = stats.sessions; if (timeEl) { const hours = Math.floor(stats.totalMinutes / 60); const mins = stats.totalMinutes % 60; timeEl.textContent = `${hours}h ${mins}m`; }}
// Initializedocument.addEventListener('DOMContentLoaded', () => { initTheme(); // Close modal on outside click const modal = document.getElementById('task-modal'); if (modal) { modal.addEventListener('click', (e) => { if (e.target === modal) closeModal(); }); }});12345678910111213141516171819202122232425262728body {padding: 2rem;font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;}h1 {font-size: 16px;margin-top: 0;}p {color: rgb(107, 114, 128);font-size: 15px;margin-bottom: 10px;margin-top: 5px;}.card {max-width: 620px;margin: 0 auto;padding: 16px;border: 1px solid lightgray;border-radius: 16px;}.card p:last-child {margin-bottom: 0;}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142@tailwind base;@tailwind components;@tailwind utilities;/* Custom Scrollbar */::-webkit-scrollbar {width: 8px;height: 8px;}::-webkit-scrollbar-track {background: #f1f1f1;border-radius: 4px;}::-webkit-scrollbar-thumb {background: #c1c1c1;border-radius: 4px;}::-webkit-scrollbar-thumb:hover {background: #a8a8a8;}.dark ::-webkit-scrollbar-track {background: #1f2937;}.dark ::-webkit-scrollbar-thumb {background: #4b5563;}.dark ::-webkit-scrollbar-thumb:hover {background: #6b7280;}/* Glassmorphism */.glass-card {background: rgba(255, 255, 255, 0.7);backdrop-filter: blur(10px);-webkit-backdrop-filter: blur(10px);}.dark .glass-card {background: rgba(31, 41, 55, 0.7);}/* Animations */@keyframes slideIn {from {opacity: 0;transform: translateY(10px);}to {opacity: 1;transform: translateY(0);}}.animate-slide-in {animation: slideIn 0.3s ease-out forwards;}/* Checkbox Animation */.checkbox-wrapper input:checked + div {background-color: #10b981;border-color: #10b981;}.checkbox-wrapper input:checked + div svg {display: block;}/* Task Item Hover Effects */.task-item {transition: all 0.3s ease;}.task-item:hover {transform: translateX(4px);}/* Modal Animation */#modal-content {transition: all 0.3s ease;}#task-modal.show #modal-content {transform: scale(1);opacity: 1;}/* Priority Indicators */.priority-high {border-left: 4px solid #ef4444;}.priority-medium {border-left: 4px solid #f59e0b;}.priority-low {border-left: 4px solid #10b981;}/* Focus Ring Pulse */.focus-ring {animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;}@keyframes pulse-ring {0% {transform: scale(0.95);box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);}70% {transform: scale(1);box-shadow: 0 0 0 20px rgba(16, 185, 129, 0);}100% {transform: scale(0.95);box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);}}/* Custom Selection */::selection {background-color: #10b981;color: white;}/* Smooth Theme Transition */* {transition-property: background-color, border-color, color, fill, stroke;transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);transition-duration: 150ms;}/* Prevent transition on page load */.preload * {transition: none !important;}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153<!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>FlowState - Tasks</title> <link rel="stylesheet" href="style.css"> <script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> <script> tailwind.config = { darkMode: 'class', theme: { extend: { colors: { primary: { 50: '#ecfdf5', 100: '#d1fae5', 500: '#10b981', 600: '#059669', 700: '#047857', }, secondary: { 50: '#f5f3ff', 100: '#ede9fe', 500: '#8b5cf6', 600: '#7c3aed', 700: '#6d28d9', } } } } } </script></head><body class="bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-100 transition-colors duration-300"> <flow-navbar></flow-navbar>
<main class="pt-24 pb-12 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto"> <!-- Header Controls --> <div class="flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8 gap-4"> <div> <h1 class="text-3xl font-bold mb-2">My Tasks</h1> <p class="text-gray-600 dark:text-gray-400">Manage your daily goals and stay productive</p> </div> <button onclick="openModal()" class="w-full sm:w-auto px-6 py-3 bg-primary-600 hover:bg-primary-700 text-white rounded-xl font-semibold transition-all transform hover:scale-105 flex items-center justify-center shadow-lg hover:shadow-primary-500/30"> <i data-feather="plus" class="w-5 h-5 mr-2"></i> New Task </button> </div>
<!-- Filter Bar --> <div class="bg-white dark:bg-gray-800 rounded-2xl p-4 mb-8 shadow-md border border-gray-200 dark:border-gray-700 flex flex-wrap gap-4 items-center justify-between"> <div class="flex gap-2 overflow-x-auto pb-2 sm:pb-0"> <button onclick="filterTasks('all')" class="filter-btn active px-4 py-2 rounded-lg text-sm font-medium transition-all bg-primary-100 text-primary-700 dark:bg-primary-900 dark:text-primary-300" data-filter="all"> All Tasks </button> <button onclick="filterTasks('pending')" class="filter-btn px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400" data-filter="pending"> Pending </button> <button onclick="filterTasks('completed')" class="filter-btn px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400" data-filter="completed"> Completed </button> </div> <div class="flex items-center gap-2"> <i data-feather="search" class="w-5 h-5 text-gray-400"></i> <input type="text" id="search-input" placeholder="Search tasks..." class="bg-transparent border-none outline-none text-sm w-48" oninput="searchTasks(this.value)"> </div> </div>
<!-- Tasks Grid --> <div id="tasks-container" class="grid grid-cols-1 gap-4"> <!-- Tasks will be injected here --> </div>
<!-- Empty State --> <div id="empty-state" class="hidden text-center py-16"> <div class="w-24 h-24 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center"> <i data-feather="clipboard" class="w-12 h-12 text-gray-400"></i> </div> <h3 class="text-xl font-semibold mb-2">No tasks found</h3> <p class="text-gray-500 mb-6">Create your first task to get started</p> <button onclick="openModal()" class="px-6 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors"> Create Task </button> </div> </main>
<!-- Add/Edit Task Modal --> <div id="task-modal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden items-center justify-center z-50 p-4"> <div class="bg-white dark:bg-gray-800 rounded-2xl w-full max-w-md p-6 shadow-2xl transform transition-all scale-95 opacity-0" id="modal-content"> <div class="flex justify-between items-center mb-6"> <h2 class="text-2xl font-bold" id="modal-title">New Task</h2> <button onclick="closeModal()" class="p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors"> <i data-feather="x" class="w-5 h-5"></i> </button> </div> <form id="task-form" onsubmit="handleTaskSubmit(event)"> <input type="hidden" id="task-id"> <div class="mb-4"> <label class="block text-sm font-medium mb-2">Task Title</label> <input type="text" id="task-title" required class="w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 focus:ring-2 focus:ring-primary-500 outline-none transition-all" placeholder="What needs to be done?"> </div>
<div class="mb-4"> <label class="block text-sm font-medium mb-2">Description</label> <textarea id="task-desc" rows="3" class="w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 focus:ring-2 focus:ring-primary-500 outline-none transition-all resize-none" placeholder="Add details..."></textarea> </div>
<div class="grid grid-cols-2 gap-4 mb-6"> <div> <label class="block text-sm font-medium mb-2">Category</label> <select id="task-category" class="w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 focus:ring-2 focus:ring-primary-500 outline-none"> <option value="work">Work</option> <option value="personal">Personal</option> <option value="learning">Learning</option> <option value="health">Health</option> </select> </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-xl border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 focus:ring-2 focus:ring-primary-500 outline-none"> <option value="low">Low</option> <option value="medium">Medium</option> <option value="high">High</option> </select> </div> </div>
<div class="flex gap-3"> <button type="button" onclick="closeModal()" class="flex-1 px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">Cancel</button> <button type="submit" class="flex-1 px-4 py-3 bg-primary-600 text-white rounded-xl hover:bg-primary-700 transition-colors font-medium">Save Task</button> </div> </form> </div> </div>
<flow-footer></flow-footer>
<script src="components/navbar.js"></script> <script src="components/footer.js"></script> <script src="script.js"></script> <script> feather.replace(); // Tasks page specific document.addEventListener('DOMContentLoaded', () => { renderTasks(); }); </script></body></html>README.md+6-3
components/footer.jsAdded+44
components/navbar.jsAdded+138
focus.htmlAdded+136
index.html+185-19
script.jsAdded+483
style.css+133-19
tasks.htmlAdded+153