Deploy from Lumerel

This commit is contained in:
Lumerel Deploy
2026-02-16 22:17:38 +00:00
commit 2af9090a8e
19 changed files with 934 additions and 0 deletions

142
public/dashboard.html Normal file
View File

@@ -0,0 +1,142 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TaskIt! - Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
<style>
body {
background-color: #f4f6f9;
font-family: 'Inter', sans-serif;
}
.dashboard-container {
max-width: 1200px;
margin: 2rem auto;
}
.project-card {
border-radius: 15px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
transition: transform 0.3s ease;
}
.project-card:hover {
transform: translateY(-10px);
}
.task-status {
font-size: 0.8rem;
padding: 0.2rem 0.5rem;
border-radius: 20px;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
<div class="container">
<a class="navbar-brand" href="#">TaskIt!</a>
<button class="btn btn-outline-danger" id="logoutBtn">Logout</button>
</div>
</nav>
<div class="dashboard-container">
<div class="row">
<div class="col-md-4">
<div class="card project-card mb-4">
<div class="card-body">
<h5 class="card-title">Create New Project</h5>
<form id="newProjectForm">
<div class="mb-3">
<input type="text" class="form-control" placeholder="Project Name" required>
</div>
<div class="mb-3">
<textarea class="form-control" placeholder="Project Description" rows="3" required></textarea>
</div>
<button type="submit" class="btn btn-primary w-100">Create Project</button>
</form>
</div>
</div>
</div>
<div class="col-md-8" id="projectList">
<!-- Projects will be dynamically loaded here -->
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Check Authentication
async function checkAuth() {
const response = await fetch('/api/projects', {
method: 'GET',
credentials: 'include'
});
if (response.status === 401) {
window.location.href = '/index.html';
}
}
// Logout Handler
document.getElementById('logoutBtn').addEventListener('click', async () => {
try {
const response = await fetch('/api/logout', { method: 'POST' });
const result = await response.json();
if (result.success) {
window.location.href = '/index.html';
}
} catch (error) {
console.error('Logout error:', error);
}
});
// Load Projects
async function loadProjects() {
const projectList = document.getElementById('projectList');
try {
const response = await fetch('/api/projects');
const projects = await response.json();
projectList.innerHTML = projects.map(project => `
<div class="card project-card mb-3">
<div class="card-body">
<h5 class="card-title">${project.name}</h5>
<p class="card-text">${project.description}</p>
<a href="/project.html?id=${project.id}" class="btn btn-outline-primary">View Tasks</a>
</div>
</div>
`).join('');
} catch (error) {
console.error('Projects load error:', error);
}
}
// Create New Project
document.getElementById('newProjectForm').addEventListener('submit', async function(e) {
e.preventDefault();
const name = this.querySelector('input[type="text"]').value;
const description = this.querySelector('textarea').value;
try {
const response = await fetch('/api/projects', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, description })
});
const result = await response.json();
if (result) {
loadProjects();
this.reset();
}
} catch (error) {
console.error('Project creation error:', error);
}
});
// Initial Load
checkAuth();
loadProjects();
</script>
</body>
</html>