Download index.html from molozo12/test: direct link, hf CLI and curl.
- Browser
- Download file 25.3 kB
-
https://huggingface.co/spaces/molozo12/test/resolve/main/index.html
- Command line
-
hf download hf://spaces/molozo12/test/index.html
-
curl -L -o index.html https://huggingface.co/spaces/molozo12/test/resolve/main/index.html
25.3 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Kanban Board</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.14.0/Sortable.min.js"></script> | |
| <style> | |
| .kanban-column { | |
| min-height: 500px; | |
| } | |
| .task-card { | |
| transition: all 0.3s ease; | |
| } | |
| .task-card:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); | |
| } | |
| .selected-task { | |
| border-left: 4px solid #3b82f6; | |
| background-color: #f8fafc; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50"> | |
| <div id="app" class="min-h-screen"> | |
| <!-- Navigation --> | |
| <nav class="bg-white shadow-sm"> | |
| <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> | |
| <div class="flex justify-between h-16"> | |
| <div class="flex"> | |
| <div class="flex-shrink-0 flex items-center"> | |
| <i data-feather="trello" class="text-blue-500"></i> | |
| <span class="ml-2 text-xl font-semibold text-gray-800">Kanban Board</span> | |
| </div> | |
| </div> | |
| <div class="flex items-center"> | |
| <div class="ml-4 flex items-center md:ml-6"> | |
| <div class="ml-3 relative"> | |
| <div class="flex items-center space-x-4"> | |
| <span id="current-user" class="text-sm font-medium text-gray-700"></span> | |
| <button onclick="logout()" class="px-3 py-1 rounded-md text-sm font-medium text-white bg-blue-500 hover:bg-blue-600"> | |
| Logout | |
| </button> | |
| <button onclick="window.location.href='admin.html'" id="admin-btn" class="hidden px-3 py-1 rounded-md text-sm font-medium text-white bg-purple-500 hover:bg-purple-600"> | |
| Admin | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| <!-- Main Content --> | |
| <main class="py-6 px-4 sm:px-6 lg:px-8"> | |
| <div class="mb-6 flex justify-between items-center"> | |
| <h2 class="text-2xl font-bold text-gray-800">Team Tasks</h2> | |
| <div class="flex space-x-2"> | |
| <button id="add-task-btn" class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 flex items-center"> | |
| <i data-feather="plus" class="mr-2"></i> Add Task | |
| </button> | |
| <button onclick="exportToExcel()" class="px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600 flex items-center"> | |
| <i data-feather="file-text" class="mr-2"></i> Excel | |
| </button> | |
| <button onclick="exportToPDF()" class="px-4 py-2 bg-red-500 text-white rounded-md hover:bg-red-600 flex items-center"> | |
| <i data-feather="file" class="mr-2"></i> PDF | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Kanban Board --> | |
| <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6"> | |
| <!-- Backlog Column --> | |
| <div class="bg-gray-100 rounded-lg p-4 kanban-column"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="font-semibold text-lg text-gray-700">Backlog</h3> | |
| <span id="backlog-count" class="bg-gray-200 text-gray-700 text-xs font-semibold px-2 py-1 rounded-full">0</span> | |
| </div> | |
| <div id="backlog-tasks" class="space-y-3"></div> | |
| </div> | |
| <!-- To Do Column --> | |
| <div class="bg-blue-50 rounded-lg p-4 kanban-column"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="font-semibold text-lg text-blue-700">To Do</h3> | |
| <span id="todo-count" class="bg-blue-200 text-blue-700 text-xs font-semibold px-2 py-1 rounded-full">0</span> | |
| </div> | |
| <div id="todo-tasks" class="space-y-3"></div> | |
| </div> | |
| <!-- In Progress Column --> | |
| <div class="bg-yellow-50 rounded-lg p-4 kanban-column"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="font-semibold text-lg text-yellow-700">In Progress</h3> | |
| <span id="progress-count" class="bg-yellow-200 text-yellow-700 text-xs font-semibold px-2 py-1 rounded-full">0</span> | |
| </div> | |
| <div id="progress-tasks" class="space-y-3"></div> | |
| </div> | |
| <!-- Done Column --> | |
| <div class="bg-green-50 rounded-lg p-4 kanban-column"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="font-semibold text-lg text-green-700">Done</h3> | |
| <span id="done-count" class="bg-green-200 text-green-700 text-xs font-semibold px-2 py-1 rounded-full">0</span> | |
| </div> | |
| <div id="done-tasks" class="space-y-3"></div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Add Task Modal --> | |
| <div id="task-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden"> | |
| <div class="bg-white rounded-lg p-6 w-full max-w-md"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="text-lg font-semibold">Add New Task</h3> | |
| <button onclick="closeModal()" class="text-gray-500 hover:text-gray-700"> | |
| <i data-feather="x"></i> | |
| </button> | |
| </div> | |
| <form id="task-form" class="space-y-4"> | |
| <div> | |
| <label for="task-title" class="block text-sm font-medium text-gray-700">Title</label> | |
| <input type="text" id="task-title" required class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| </div> | |
| <div> | |
| <label for="task-description" class="block text-sm font-medium text-gray-700">Description</label> | |
| <textarea id="task-description" rows="3" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"></textarea> | |
| </div> | |
| <div> | |
| <label for="task-priority" class="block text-sm font-medium text-gray-700">Priority</label> | |
| <select id="task-priority" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500"> | |
| <option value="low">Low</option> | |
| <option value="medium" selected>Medium</option> | |
| <option value="high">High</option> | |
| </select> | |
| </div> | |
| <div class="flex justify-end space-x-3"> | |
| <button type="button" onclick="closeModal()" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50"> | |
| Cancel | |
| </button> | |
| <button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded-md text-sm font-medium hover:bg-blue-600"> | |
| Add Task | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Initialize feather icons | |
| feather.replace(); | |
| // App state | |
| const state = { | |
| currentUser: null, | |
| users: [], | |
| tasks: [], | |
| permissions: {} | |
| }; | |
| // Initialize the app | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Check if this is first run - initialize default data if no users exist | |
| if (!localStorage.getItem('users')) { | |
| initializeDefaultData(); | |
| } | |
| // Check if user is logged in | |
| const user = localStorage.getItem('currentUser'); | |
| if (!user) { | |
| window.location.href = 'login.html'; | |
| return; | |
| } | |
| state.currentUser = JSON.parse(user); | |
| document.getElementById('current-user').textContent = `Welcome, ${state.currentUser.name}`; | |
| // Load data from localStorage | |
| loadData(); | |
| renderBoard(); | |
| // Initialize drag and drop | |
| initSortable(); | |
| // Check if user is admin | |
| if (state.currentUser.role === 'admin') { | |
| document.getElementById('admin-btn').classList.remove('hidden'); | |
| } | |
| // Check if user can add tasks | |
| const canAdd = state.permissions[state.currentUser.id]?.add || false; | |
| document.getElementById('add-task-btn').style.display = canAdd ? 'flex' : 'none'; | |
| // Event listeners | |
| document.getElementById('add-task-btn').addEventListener('click', openModal); | |
| document.getElementById('task-form').addEventListener('submit', handleAddTask); | |
| }); | |
| function initializeDefaultData() { | |
| // Default users | |
| const defaultUsers = [ | |
| { id: '1', name: 'Admin', username: 'admin', password: 'admin123', role: 'admin' }, | |
| { id: '2', name: 'Regular User', username: 'user', password: 'user123', role: 'user' } | |
| ]; | |
| localStorage.setItem('users', JSON.stringify(defaultUsers)); | |
| // Default permissions | |
| const defaultPermissions = { | |
| '1': { read: true, add: true, move: true, delete: true }, // Admin | |
| '2': { read: true, add: true, move: true, delete: false } // Regular user | |
| }; | |
| localStorage.setItem('permissions', JSON.stringify(defaultPermissions)); | |
| // Default tasks | |
| const defaultTasks = [ | |
| { | |
| id: '1', | |
| title: 'Welcome to Kanban Board', | |
| description: 'This is a sample task. You can drag it between columns.', | |
| priority: 'medium', | |
| status: 'todo', | |
| createdAt: new Date().toISOString(), | |
| createdBy: '1', | |
| assignedTo: null | |
| }, | |
| { | |
| id: '2', | |
| title: 'Try moving tasks', | |
| description: 'Drag tasks between columns to change their status.', | |
| priority: 'low', | |
| status: 'backlog', | |
| createdAt: new Date().toISOString(), | |
| createdBy: '1', | |
| assignedTo: null | |
| } | |
| ]; | |
| localStorage.setItem('tasks', JSON.stringify(defaultTasks)); | |
| } | |
| function loadData() { | |
| const users = localStorage.getItem('users'); | |
| const tasks = localStorage.getItem('tasks'); | |
| const permissions = localStorage.getItem('permissions'); | |
| if (users) state.users = JSON.parse(users); | |
| if (tasks) state.tasks = JSON.parse(tasks); | |
| if (permissions) state.permissions = JSON.parse(permissions); | |
| } | |
| function saveData() { | |
| localStorage.setItem('tasks', JSON.stringify(state.tasks)); | |
| localStorage.setItem('users', JSON.stringify(state.users)); | |
| localStorage.setItem('permissions', JSON.stringify(state.permissions)); | |
| } | |
| function renderBoard() { | |
| // Clear all columns | |
| document.getElementById('backlog-tasks').innerHTML = ''; | |
| document.getElementById('todo-tasks').innerHTML = ''; | |
| document.getElementById('progress-tasks').innerHTML = ''; | |
| document.getElementById('done-tasks').innerHTML = ''; | |
| // Count tasks in each column | |
| let backlogCount = 0; | |
| let todoCount = 0; | |
| let progressCount = 0; | |
| let doneCount = 0; | |
| // Render tasks | |
| state.tasks.forEach(task => { | |
| const taskElement = createTaskElement(task); | |
| switch(task.status) { | |
| case 'backlog': | |
| document.getElementById('backlog-tasks').appendChild(taskElement); | |
| backlogCount++; | |
| break; | |
| case 'todo': | |
| document.getElementById('todo-tasks').appendChild(taskElement); | |
| todoCount++; | |
| break; | |
| case 'progress': | |
| document.getElementById('progress-tasks').appendChild(taskElement); | |
| progressCount++; | |
| break; | |
| case 'done': | |
| document.getElementById('done-tasks').appendChild(taskElement); | |
| doneCount++; | |
| break; | |
| } | |
| }); | |
| // Update counts | |
| document.getElementById('backlog-count').textContent = backlogCount; | |
| document.getElementById('todo-count').textContent = todoCount; | |
| document.getElementById('progress-count').textContent = progressCount; | |
| document.getElementById('done-count').textContent = doneCount; | |
| // Re-initialize feather icons for new elements | |
| feather.replace(); | |
| } | |
| function createTaskElement(task) { | |
| const taskElement = document.createElement('div'); | |
| taskElement.className = 'task-card bg-white p-4 rounded-md shadow cursor-move'; | |
| taskElement.dataset.taskId = task.id; | |
| // Priority color | |
| let priorityColor = 'bg-gray-200'; | |
| if (task.priority === 'high') priorityColor = 'bg-red-200'; | |
| else if (task.priority === 'medium') priorityColor = 'bg-yellow-200'; | |
| // Assigned user indicator | |
| let assignedUser = ''; | |
| if (task.assignedTo) { | |
| const user = state.users.find(u => u.id === task.assignedTo); | |
| if (user) { | |
| assignedUser = `<span class="text-xs text-gray-500">Assigned to: ${user.name}</span>`; | |
| } | |
| } | |
| taskElement.innerHTML = ` | |
| <div class="flex justify-between items-start"> | |
| <div> | |
| <div class="flex items-center space-x-2"> | |
| <span class="text-sm font-medium text-gray-900">${task.title}</span> | |
| <span class="text-xs px-2 py-1 rounded-full ${priorityColor}">${task.priority}</span> | |
| </div> | |
| ${assignedUser} | |
| </div> | |
| <div class="flex space-x-1"> | |
| <button onclick="handleSelectTask('${task.id}')" class="text-blue-500 hover:text-blue-700"> | |
| <i data-feather="user-plus" class="w-4 h-4"></i> | |
| </button> | |
| <button onclick="handleDeleteTask('${task.id}')" class="text-red-500 hover:text-red-700"> | |
| <i data-feather="trash-2" class="w-4 h-4"></i> | |
| </button> | |
| </div> | |
| </div> | |
| ${task.description ? `<p class="mt-2 text-sm text-gray-600">${task.description}</p>` : ''} | |
| <div class="mt-2 flex justify-between items-center"> | |
| <span class="text-xs text-gray-500">Created: ${new Date(task.createdAt).toLocaleDateString()}</span> | |
| <span class="text-xs text-gray-500">${task.createdBy === state.currentUser.id ? 'You created this' : ''}</span> | |
| </div> | |
| `; | |
| return taskElement; | |
| } | |
| function initSortable() { | |
| const canMove = state.permissions[state.currentUser.id]?.move || false; | |
| if (!canMove) return; | |
| const columns = [ | |
| document.getElementById('backlog-tasks'), | |
| document.getElementById('todo-tasks'), | |
| document.getElementById('progress-tasks'), | |
| document.getElementById('done-tasks') | |
| ]; | |
| columns.forEach(column => { | |
| new Sortable(column, { | |
| group: 'tasks', | |
| animation: 150, | |
| ghostClass: 'bg-blue-50', | |
| onEnd: function(evt) { | |
| const taskId = evt.item.dataset.taskId; | |
| const newStatus = getStatusFromColumnId(evt.to.id); | |
| updateTaskStatus(taskId, newStatus); | |
| } | |
| }); | |
| }); | |
| } | |
| function getStatusFromColumnId(columnId) { | |
| switch(columnId) { | |
| case 'backlog-tasks': return 'backlog'; | |
| case 'todo-tasks': return 'todo'; | |
| case 'progress-tasks': return 'progress'; | |
| case 'done-tasks': return 'done'; | |
| default: return 'backlog'; | |
| } | |
| } | |
| function updateTaskStatus(taskId, newStatus) { | |
| const taskIndex = state.tasks.findIndex(t => t.id === taskId); | |
| if (taskIndex !== -1) { | |
| state.tasks[taskIndex].status = newStatus; | |
| saveData(); | |
| renderBoard(); | |
| } | |
| } | |
| function handleSelectTask(taskId) { | |
| const taskIndex = state.tasks.findIndex(t => t.id === taskId); | |
| if (taskIndex !== -1) { | |
| if (state.tasks[taskIndex].assignedTo === state.currentUser.id) { | |
| // Unassign if already assigned to current user | |
| state.tasks[taskIndex].assignedTo = null; | |
| } else { | |
| // Assign to current user | |
| state.tasks[taskIndex].assignedTo = state.currentUser.id; | |
| } | |
| saveData(); | |
| renderBoard(); | |
| } | |
| } | |
| function handleDeleteTask(taskId) { | |
| const canDelete = state.permissions[state.currentUser.id]?.delete || false; | |
| if (!canDelete) { | |
| alert('You do not have permission to delete tasks.'); | |
| return; | |
| } | |
| const taskIndex = state.tasks.findIndex(t => t.id === taskId); | |
| if (taskIndex !== -1 && state.tasks[taskIndex].createdBy === state.currentUser.id) { | |
| state.tasks.splice(taskIndex, 1); | |
| saveData(); | |
| renderBoard(); | |
| } else { | |
| alert('You can only delete tasks you created.'); | |
| } | |
| } | |
| function openModal() { | |
| document.getElementById('task-modal').classList.remove('hidden'); | |
| } | |
| function closeModal() { | |
| document.getElementById('task-modal').classList.add('hidden'); | |
| document.getElementById('task-form').reset(); | |
| } | |
| function handleAddTask(e) { | |
| e.preventDefault(); | |
| const title = document.getElementById('task-title').value; | |
| const description = document.getElementById('task-description').value; | |
| const priority = document.getElementById('task-priority').value; | |
| const newTask = { | |
| id: Date.now().toString(), | |
| title, | |
| description, | |
| priority, | |
| status: 'backlog', | |
| createdAt: new Date().toISOString(), | |
| createdBy: state.currentUser.id, | |
| assignedTo: null | |
| }; | |
| state.tasks.push(newTask); | |
| saveData(); | |
| renderBoard(); | |
| closeModal(); | |
| } | |
| function logout() { | |
| localStorage.removeItem('currentUser'); | |
| window.location.href = 'login.html'; | |
| } | |
| function exportToExcel() { | |
| // Prepare data | |
| const data = state.tasks.map(task => { | |
| const createdByUser = state.users.find(u => u.id === task.createdBy); | |
| const assignedToUser = state.users.find(u => u.id === task.assignedTo); | |
| return { | |
| 'Title': task.title, | |
| 'Description': task.description, | |
| 'Status': task.status.charAt(0).toUpperCase() + task.status.slice(1), | |
| 'Priority': task.priority.charAt(0).toUpperCase() + task.priority.slice(1), | |
| 'Created By': createdByUser ? createdByUser.name : 'Unknown', | |
| 'Assigned To': assignedToUser ? assignedToUser.name : 'Unassigned', | |
| 'Created Date': new Date(task.createdAt).toLocaleString() | |
| }; | |
| }); | |
| // Create workbook | |
| const wb = XLSX.utils.book_new(); | |
| const ws = XLSX.utils.json_to_sheet(data); | |
| XLSX.utils.book_append_sheet(wb, ws, "Tasks"); | |
| // Generate and download | |
| XLSX.writeFile(wb, `kanban_tasks_${new Date().toISOString().slice(0,10)}.xlsx`); | |
| } | |
| function exportToPDF() { | |
| const { jsPDF } = window.jspdf; | |
| const doc = new jsPDF(); | |
| // Title | |
| doc.setFontSize(20); | |
| doc.setTextColor(40); | |
| doc.text('Kanban Tasks Report', 105, 15, { align: 'center' }); | |
| // Date | |
| doc.setFontSize(10); | |
| doc.setTextColor(100); | |
| doc.text(`Generated on: ${new Date().toLocaleString()}`, 105, 22, { align: 'center' }); | |
| // Logo | |
| doc.addImage('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTE5IDE5SDVWNUgxOU0xOSAzSDVBMiAyIDAgMCAwIDMgNXYxNGEyIDIgMCAwIDAgMiAyaDE0YTIgMiAwIDAgMCAyLTJWNUEyIDIgMCAwIDAgMTkgM3oiIGZpbGw9IiMzYjgxZjYiLz48L3N2Zz4=', 'SVG', 15, 25, 15, 15); | |
| // Table data | |
| const columns = [ | |
| { header: 'Title', dataKey: 'title' }, | |
| { header: 'Status', dataKey: 'status' }, | |
| { header: 'Priority', dataKey: 'priority' }, | |
| { header: 'Assigned To', dataKey: 'assignedTo' } | |
| ]; | |
| const rows = state.tasks.map(task => { | |
| const assignedToUser = state.users.find(u => u.id === task.assignedTo); | |
| return { | |
| title: task.title, | |
| status: task.status.charAt(0).toUpperCase() + task.status.slice(1), | |
| priority: task.priority.charAt(0).toUpperCase() + task.priority.slice(1), | |
| assignedTo: assignedToUser ? assignedToUser.name : 'Unassigned' | |
| }; | |
| }); | |
| // Add table | |
| doc.autoTable({ | |
| head: [columns.map(col => col.header)], | |
| body: rows.map(row => columns.map(col => row[col.dataKey])), | |
| startY: 45, | |
| styles: { | |
| halign: 'center', | |
| cellPadding: 3, | |
| fontSize: 10 | |
| }, | |
| headStyles: { | |
| fillColor: [59, 130, 246], | |
| textColor: 255, | |
| fontStyle: 'bold' | |
| }, | |
| alternateRowStyles: { | |
| fillColor: [241, 245, 249] | |
| }, | |
| columnStyles: { | |
| 0: { cellWidth: 'auto' }, | |
| 1: { cellWidth: 30 }, | |
| 2: { cellWidth: 30 }, | |
| 3: { cellWidth: 40 } | |
| } | |
| }); | |
| // Footer | |
| const pageCount = doc.internal.getNumberOfPages(); | |
| for(let i = 1; i <= pageCount; i++) { | |
| doc.setPage(i); | |
| doc.setFontSize(8); | |
| doc.setTextColor(150); | |
| doc.text(`Page ${i} of ${pageCount}`, 105, 285, { align: 'center' }); | |
| } | |
| // Save | |
| doc.save(`kanban_tasks_${new Date().toISOString().slice(0,10)}.pdf`); | |
| } | |
| </script> | |
| </body> | |
| </html> | |