Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files12345678910111213141516171819123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923<!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><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>TaskMaster Pro</title> <!-- Import Google Fonts (Poppins & Inter) --> <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=Inter:wght@300;400;500;600;700&family=Poppins:wght@600;700;800&display=swap" rel="stylesheet"> <!-- Import FontAwesome for Icons --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style> :root { /* Modern Color Palette - Light Mode */ --primary-color: #6366f1; --primary-hover: #4f46e5; --secondary-color: #ec4899; --bg-body: #f3f4f6; --bg-card: #ffffff; --text-main: #1f2937; --text-secondary: #6b7280; --border-color: #e5e7eb; --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1); --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
/* Dark Mode Variables */ [data-theme="dark"] { --bg-body: #0f172a; --bg-card: #1e293b; --text-main: #f1f5f9; --text-secondary: #94a3b8; --border-color: #334155; --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5); }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-body); color: var(--text-main); transition: var(--transition); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
/* --- Header Section --- */ header { background-color: var(--bg-card); padding: 1rem 2rem; box-shadow: var(--shadow-sm); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border-color); }
.brand { display: flex; align-items: center; gap: 10px; font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 1.5rem; color: var(--primary-color); }
.brand i { font-size: 1.8rem; }
.header-controls { display: flex; align-items: center; gap: 1.5rem; }
.theme-toggle { cursor: pointer; font-size: 1.2rem; color: var(--text-secondary); transition: color 0.3s; padding: 8px; border-radius: 50%; background: transparent; border: none; }
.theme-toggle:hover { background-color: var(--bg-body); color: var(--primary-color); }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 1rem; }
/* --- Main Layout --- */ main { flex: 1; padding: 2rem; max-width: 1400px; margin: 0 auto; width: 100%; }
.dashboard-header { margin-bottom: 2rem; display: flex; justify-content: space-between; align-items: flex-end; }
.dashboard-title h1 { font-family: 'Poppins', sans-serif; font-size: 2.5rem; font-weight: 700; }
.dashboard-title p { color: var(--text-secondary); margin-top: 0.5rem; }
.stats-container { display: flex; gap: 1.5rem; }
.stat-card { background-color: var(--bg-card); padding: 1rem 1.5rem; border-radius: 12px; box-shadow: var(--shadow-sm); border-left: 4px solid var(--primary-color); min-width: 150px; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary-color); }
.stat-label { color: var(--text-secondary); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; }
/* --- Task Board (Kanban) --- */ .board-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; height: 100%; }
.column { background-color: var(--bg-body); border-radius: 16px; padding: 1.5rem; display: flex; flex-direction: column; min-height: 600px; transition: var(--transition); }
.column-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid var(--border-color); }
.column-title { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }
.task-count { background-color: var(--bg-card); padding: 2px 8px; border-radius: 12px; font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; }
.add-btn { background: none; border: none; color: var(--primary-color); cursor: pointer; font-size: 1.2rem; transition: transform 0.2s; padding: 5px; border-radius: 8px; }
.add-btn:hover { background-color: rgba(99, 102, 241, 0.1); transform: scale(1.1); }
.task-list { flex: 1; overflow-y: auto; padding-right: 5px; scrollbar-width: thin; }
/* Custom Scrollbar */ .task-list::-webkit-scrollbar { width: 6px; } .task-list::-webkit-scrollbar-track { background: transparent; } .task-list::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 20px; }
/* --- Task Cards --- */ .task-card { background-color: var(--bg-card); padding: 1.25rem; border-radius: 12px; margin-bottom: 1rem; box-shadow: var(--shadow-sm); transition: var(--transition); border: 1px solid transparent; cursor: grab; position: relative; }
.task-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary-color); }
.task-card.dragging { opacity: 0.5; cursor: grabbing; }
.task-priority { display: inline-block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; margin-bottom: 0.75rem; }
.priority-high { background-color: #fee2e2; color: #dc2626; } .priority-medium { background-color: #fef3c7; color: #d97706; } .priority-low { background-color: #dbeafe; color: #2563eb; }
.task-title { font-family: 'Poppins', sans-serif; font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-main); }
.task-desc { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; white-space: pre-wrap; }
.task-meta { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border-color); padding-top: 0.75rem; font-size: 0.85rem; color: var(--text-secondary); }
.due-date { display: flex; align-items: center; gap: 5px; }
.delete-btn { background: none; border: none; color: #9ca3af; cursor: pointer; padding: 5px; border-radius: 4px; transition: all 0.2s; }
.delete-btn:hover { color: #ef4444; background-color: #fee2e2; }
/* --- Modal / Add Task Form --- */ .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 200; opacity: 0; visibility: hidden; transition: var(--transition); }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background-color: var(--bg-card); padding: 2rem; border-radius: 16px; width: 90%; max-width: 500px; box-shadow: var(--shadow-lg); transform: scale(0.9); transition: var(--transition); }
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { font-family: 'Poppins', sans-serif; font-size: 1.5rem; font-weight: 700; }
.close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); }
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; font-weight: 500; color: var(--text-main); }
.form-input { width: 100%; padding: 0.75rem; border-radius: 8px; border: 1px solid var(--border-color); background-color: var(--bg-body); color: var(--text-main); font-family: 'Inter', sans-serif; font-size: 1rem; transition: var(--transition); }
.form-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }
textarea.form-input { resize: vertical; min-height: 100px; }
.form-select { width: 100%; padding: 0.75rem; border-radius: 8px; border: 1px solid var(--border-color); background-color: var(--bg-body); color: var(--text-main); font-family: 'Inter', sans-serif; font-size: 1rem; cursor: pointer; }
.modal-footer { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 2rem; }
.btn { padding: 0.75rem 1.5rem; border-radius: 8px; font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: var(--transition); border: none; font-family: 'Inter', sans-serif; }
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background-color: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background-color: var(--bg-body); color: var(--text-main); }
/* --- Footer --- */ footer { text-align: center; padding: 2rem; color: var(--text-secondary); font-size: 0.9rem; border-top: 1px solid var(--border-color); margin-top: auto; }
.footer-link { color: var(--primary-color); text-decoration: none; font-weight: 600; } .footer-link:hover { text-decoration: underline; }
/* --- Responsive Mobile --- */ @media (max-width: 768px) { .dashboard-title h1 { font-size: 2rem; } .stats-container { grid-template-columns: 1fr 1fr; } .header-controls { gap: 1rem; } .brand span { display: none; } } </style></head><body>
<!-- Header --> <header> <div class="brand"> <i class="fa-solid fa-rocket"></i> <span>TaskMaster</span> </div> <div class="header-controls"> <button class="theme-toggle" id="themeToggle" title="Toggle Theme"> <i class="fa-solid fa-moon"></i> </button> <div class="user-avatar">JD</div> </div> </header>
<!-- Main Content --> <main> <div class="dashboard-header"> <div class="dashboard-title"> <h1>My Dashboard</h1> <p>Welcome back, John! You have <span id="totalTasks" style="color:var(--primary-color); font-weight:700;">0</span> pending tasks.</p> </div> <div class="stats-container"> <div class="stat-card"> <div class="stat-value" id="pendingCount">0</div> <div class="stat-label">To Do</div> </div> <div class="stat-card" style="border-color: #f59e0b;"> <div class="stat-value" id="progressCount">0</div> <div class="stat-label">In Progress</div> </div> <div class="stat-card" style="border-color: #10b981;"> <div class="stat-value" id="doneCount">0</div> <div class="stat-label">Completed</div> </div> </div> </div>
<!-- Kanban Board --> <div class="board-container"> <!-- Column: To Do --> <div class="column" id="todo"> <div class="column-header"> <div class="column-title"> <i class="fa-solid fa-list-check" style="color: #6366f1;"></i> To Do <span class="task-count" id="count-todo">0</span> </div> <button class="add-btn" onclick="openModal('todo')"> <i class="fa-solid fa-plus"></i> </button> </div> <div class="task-list" id="list-todo"> <!-- Tasks injected here --> </div> </div>
<!-- Column: In Progress --> <div class="column" id="inprogress"> <div class="column-header"> <div class="column-title"> <i class="fa-solid fa-circle-play" style="color: #f59e0b;"></i> In Progress <span class="task-count" id="count-inprogress">0</span> </div> <button class="add-btn" onclick="openModal('inprogress')"> <i class="fa-solid fa-plus"></i> </button> </div> <div class="task-list" id="list-inprogress"> <!-- Tasks injected here --> </div> </div>
<!-- Column: Done --> <div class="column" id="done"> <div class="column-header"> <div class="column-title"> <i class="fa-solid fa-check-to-slot" style="color: #10b981;"></i> Completed <span class="task-count" id="count-done">0</span> </div> </div> <div class="task-list" id="list-done"> <!-- Tasks injected here --> </div> </div>
</div> </main>
<!-- Footer with Requirement --> <footer> <p>© 2023 TaskMaster Pro. Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="footer-link">any coder</a>.</p> </footer>
<!-- Add Task Modal --> <div class="modal-overlay" id="taskModal"> <div class="modal"> <div class="modal-header"> <h2 class="modal-title" id="modalTitle">Add New Task</h2> <button class="close-btn" onclick="closeModal()">×</button> </div> <form id="taskForm"> <input type="hidden" id="taskId"> <div class="form-group"> <label class="form-label" for="taskTitle">Task Title</label> <input type="text" id="taskTitle" class="form-input" placeholder="e.g., Redesign Homepage" required> </div>
<div class="form-group"> <label class="form-label" for="taskDesc">Description</label> <textarea id="taskDesc" class="form-input" placeholder="Add details about this task..."></textarea> </div>
<div class="form-group"> <label class="form-label" for="taskPriority">Priority</label> <select id="taskPriority" class="form-select"> <option value="low">Low Priority</option> <option value="medium" selected>Medium Priority</option> <option value="high">High Priority</option> </select> </div>
<div class="form-group"> <label class="form-label" for="taskStatus">Move To</label> <select id="taskStatus" class="form-select"> <option value="todo">To Do</option> <option value="inprogress">In Progress</option> <option value="done">Completed</option> </select> </div>
<div class="modal-footer"> <button type="button" class="btn btn-secondary" onclick="closeModal()">Cancel</button> <button type="submit" class="btn btn-primary">Save Task</button> </div> </form> </div> </div>
<script> // --- State Management --- let tasks = JSON.parse(localStorage.getItem('taskMasterData')) || [ { id: 1, title: "Welcome to TaskMaster", desc: "This is a demo task. You can drag and drop this card!", priority: "low", status: "todo", date: new Date().toISOString().split('T')[0] }, { id: 2, title: "Update Settings", desc: "Remember to change the theme color in settings.", priority: "medium", status: "inprogress", date: new Date().toISOString().split('T')[0] }, { id: 3, title: "Complete Project", desc: "Finish the HTML, CSS, and JS parts.", priority: "high", status: "done", date: new Date().toISOString().split('T')[0] } ];
let draggedItem = null;
// --- DOM Elements --- const themeToggle = document.getElementById('themeToggle'); const modal = document.getElementById('taskModal'); const taskForm = document.getElementById('taskForm'); const modalTitle = document.getElementById('modalTitle'); const taskLists = { todo: document.getElementById('list-todo'), inprogress: document.getElementById('list-inprogress'), done: document.getElementById('list-done') };
// --- Initialization --- document.addEventListener('DOMContentLoaded', () => { renderTasks(); updateStats(); checkTheme(); });
// --- Theme Logic --- function checkTheme() { const savedTheme = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', savedTheme); updateThemeIcon(savedTheme); }
themeToggle.addEventListener('click', () => { const currentTheme = document.documentElement.getAttribute('data-theme'); const newTheme = currentTheme === 'light' ? 'dark' : 'light'; document.documentElement.setAttribute('data-theme', newTheme); localStorage.setItem('theme', newTheme); updateThemeIcon(newTheme); });
function updateThemeIcon(theme) { const icon = themeToggle.querySelector('i'); if (theme === 'dark') { icon.className = 'fa-solid fa-sun'; } else { icon.className = 'fa-solid fa-moon'; } }
// --- Task Rendering --- function renderTasks() { // Clear lists taskLists.todo.innerHTML = ''; taskLists.inprogress.innerHTML = ''; taskLists.done.innerHTML = '';
tasks.forEach(task => { const card = createTaskCard(task); taskLists[task.status].appendChild(card); });
updateStats(); saveData(); }
function createTaskCard(task) { const card = document.createElement('div'); card.className = 'task-card'; card.draggable = true; card.id = task.id;
// Priority Styles const priorityClass = `priority-${task.priority}`; const priorityLabel = task.priority.charAt(0).toUpperCase() + task.priority.slice(1);
card.innerHTML = ` <span class="task-priority ${priorityClass}">${priorityLabel}</span> <div class="task-title">${escapeHtml(task.title)}</div> <div class="task-desc">${escapeHtml(task.desc)}</div> <div class="task-meta"> <span class="due-date"> <i class="fa-regular fa-calendar"></i> ${task.date} </span> <div style="display:flex; gap:5px;"> <button class="delete-btn" onclick="deleteTask(${task.id})" title="Delete"> <i class="fa-solid fa-trash"></i> </button> </div> </div> `;
// Drag Events card.addEventListener('dragstart', handleDragStart); card.addEventListener('dragend', handleDragEnd); card.addEventListener('dragover', handleDragOver); card.addEventListener('drop', handleDrop); card.addEventListener('dragenter', handleDragEnter); card.addEventListener('dragleave', handleDragLeave);
return card; }
function updateStats() { const total = tasks.length; const pending = tasks.filter(t => t.status === 'todo').length; const progress = tasks.filter(t => t.status === 'inprogress').length; const done = tasks.filter(t => t.status === 'done').length;
document.getElementById('totalTasks').innerText = total; document.getElementById('pendingCount').innerText = pending; document.getElementById('progressCount').innerText = progress; document.getElementById('doneCount').innerText = done; document.getElementById('count-todo').innerText = pending; document.getElementById('count-inprogress').innerText = progress; document.getElementById('count-done').innerText = done; }
// --- Drag & Drop Logic --- function handleDragStart(e) { draggedItem = this; setTimeout(() => this.classList.add('dragging'), 0); }
function handleDragEnd(e) { this.classList.remove('dragging'); draggedItem = null; }
function handleDragOver(e) { e.preventDefault(); // Necessary to allow dropping }
function handleDragEnter(e) { e.preventDefault(); if (this !== draggedItem && this.classList.contains('task-list')) { this.style.borderColor = 'var(--primary-color)'; this.style.backgroundColor = 'var(--bg-card)'; } }
function handleDragLeave(e) { if (this.classList.contains('task-list')) { this.style.borderColor = 'transparent'; this.style.backgroundColor = 'var(--bg-body)'; } }
function handleDrop(e) { e.preventDefault(); this.style.borderColor = 'transparent'; this.style.backgroundColor = 'var(--bg-body)';
if (draggedItem && draggedItem !== this) { // Find the target task ID (if dropping on a card) or just append (if dropping on empty list) let targetTask = this; // If we dropped on the task-list container directly if (this.classList.contains('task-list')) { this.appendChild(draggedItem); updateTaskStatus(draggedItem.id, this.id.replace('list-', '')); return; }
// If we dropped on another card if (this.classList.contains('task-card')) { this.after(draggedItem); updateTaskStatus(draggedItem.id, this.parentElement.id.replace('list-', '')); } } }
function updateTaskStatus(taskId, newStatus) { const taskIndex = tasks.findIndex(t => t.id === taskId); if (taskIndex > -1) { tasks[taskIndex].status = newStatus; saveData(); updateStats(); } }
// --- Modal & Form Logic --- function openModal(status = 'todo') { modal.classList.add('active'); document.getElementById('modalTitle').innerText = "Add New Task"; taskForm.reset(); document.getElementById('taskStatus').value = status; document.getElementById('taskId').value = ''; }
function closeModal() { modal.classList.remove('active'); taskForm.reset(); }
taskForm.addEventListener('submit', (e) => { e.preventDefault(); const id = document.getElementById('taskId').value; const title = document.getElementById('taskTitle').value; const desc = document.getElementById('taskDesc').value; const priority = document.getElementById('taskPriority').value; const status = document.getElementById('taskStatus').value; const date = new Date().toISOString().split('T')[0];
if (id) { // Edit existing const taskIndex = tasks.findIndex(t => t.id == id); if (taskIndex > -1) { tasks[taskIndex] = { ...tasks[taskIndex], title, desc, priority, status, date }; } } else { // Create new const newTask = { id: Date.now(), title, desc, priority, status, date }; tasks.push(newTask); }
saveData(); renderTasks(); closeModal(); });
function deleteTask(id) { if (confirm('Are you sure you want to delete this task?')) { tasks = tasks.filter(task => task.id !== id); saveData(); renderTasks(); } }
// --- Utilities --- function saveData() { localStorage.setItem('taskMasterData', JSON.stringify(tasks)); }
function escapeHtml(text) { if (!text) return ""; return text .replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, """) .replace(/'/g, "'"); }
// Close modal if clicking outside modal.addEventListener('click', (e) => { if (e.target === modal) closeModal(); });
</script></body></html>index.html+923-19