Prenss commited on
Commit
c6fe16a
·
verified ·
1 Parent(s): 933f862

Make me an HTML application, the specifications are as follows: The app is a to do list app that first starts with a user login and registration module. Users are able to register and log into their accounts which have unique data tied to each. There are two user cases, basic user, and admin user. The admin user can manage every user and turn accounts active and inactive. The admin dashboard only has a view of a table of users and then they can select specific users they wish to mark as inactive. Then momving onto the user case, first is when the basic user logs in they will be met with a dashboard with a simplel abel on the top saying "Your Dashboard" And then there is a search bar for tasks, there is a button on the botttom to make tasks and task groups, when you make a task group you are able to press it to enter within the task group, and you can make tasks within it. You are also able to assign "Tags" To a task or task group from the dashboard, which adds a coloured label to them, such as "School" "Urgent" etc. the name of the system is TaskTrack.

Browse files
Files changed (8) hide show
  1. README.md +8 -5
  2. admin-dashboard.html +61 -0
  3. components/auth-form.js +102 -0
  4. components/navbar.js +63 -0
  5. dashboard.html +55 -0
  6. index.html +24 -19
  7. script.js +55 -0
  8. style.css +50 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Tasktrack Turbo
3
- emoji: 🐢
4
- colorFrom: green
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: TaskTrack Turbo 🚀
3
+ colorFrom: blue
4
+ colorTo: blue
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
admin-dashboard.html ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>TaskTrack | Admin Dashboard</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="components/navbar.js"></script>
12
+ </head>
13
+ <body class="auth-required bg-gray-100">
14
+ <custom-navbar></custom-navbar>
15
+
16
+ <div class="container mx-auto px-4 py-8">
17
+ <h1 class="text-2xl font-bold text-gray-800 mb-8">User Management</h1>
18
+
19
+ <div class="bg-white shadow rounded-lg overflow-hidden">
20
+ <table class="min-w-full divide-y divide-gray-200">
21
+ <thead class="bg-gray-50">
22
+ <tr>
23
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
24
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
25
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Role</th>
26
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
27
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
28
+ </tr>
29
+ </thead>
30
+ <tbody class="bg-white divide-y divide-gray-200">
31
+ <tr>
32
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">John Doe</td>
33
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">john@example.com</td>
34
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">User</td>
35
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
36
+ <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Active</span>
37
+ </td>
38
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
39
+ <button class="text-red-600 hover:text-red-900">Deactivate</button>
40
+ </td>
41
+ </tr>
42
+ <tr>
43
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Jane Smith</td>
44
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">jane@example.com</td>
45
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">User</td>
46
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
47
+ <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">Inactive</span>
48
+ </td>
49
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
50
+ <button class="text-green-600 hover:text-green-900">Activate</button>
51
+ </td>
52
+ </tr>
53
+ </tbody>
54
+ </table>
55
+ </div>
56
+ </div>
57
+
58
+ <script src="script.js"></script>
59
+ <script>feather.replace();</script>
60
+ </body>
61
+ </html>
components/auth-form.js ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class AuthForm extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ this.mode = 'login'; // 'login' or 'register'
5
+ }
6
+
7
+ connectedCallback() {
8
+ this.render();
9
+ this.setupEventListeners();
10
+ }
11
+
12
+ toggleMode() {
13
+ this.mode = this.mode === 'login' ? 'register' : 'login';
14
+ this.render();
15
+ this.setupEventListeners();
16
+ }
17
+
18
+ async handleSubmit(e) {
19
+ e.preventDefault();
20
+ const formData = new FormData(e.target);
21
+ const data = Object.fromEntries(formData.entries());
22
+
23
+ try {
24
+ const endpoint = this.mode === 'login' ? '/auth/login' : '/auth/register';
25
+ const response = await fetch(`${API_BASE_URL}${endpoint}`, {
26
+ method: 'POST',
27
+ headers: {
28
+ 'Content-Type': 'application/json',
29
+ },
30
+ body: JSON.stringify(data)
31
+ });
32
+
33
+ if (!response.ok) {
34
+ throw new Error(await response.text());
35
+ }
36
+
37
+ const { token, user } = await response.json();
38
+ localStorage.setItem('token', token);
39
+ localStorage.setItem('user', JSON.stringify(user));
40
+
41
+ if (user.role === 'admin') {
42
+ redirectTo('/admin-dashboard.html');
43
+ } else {
44
+ redirectTo('/dashboard.html');
45
+ }
46
+ } catch (error) {
47
+ showToast(error.message, 'error');
48
+ }
49
+ }
50
+
51
+ setupEventListeners() {
52
+ this.querySelector('form').addEventListener('submit', (e) => this.handleSubmit(e));
53
+ this.querySelector('#toggleMode').addEventListener('click', () => this.toggleMode());
54
+ }
55
+
56
+ render() {
57
+ this.innerHTML = `
58
+ <style>
59
+ .auth-form input {
60
+ transition: all 0.2s;
61
+ }
62
+ .auth-form input:focus {
63
+ border-color: #6366f1;
64
+ box-shadow: 0 0 0 1px #6366f1;
65
+ }
66
+ </style>
67
+ <form class="auth-form space-y-6">
68
+ <div class="space-y-4">
69
+ <div>
70
+ <label for="email" class="block text-sm font-medium text-gray-700">Email</label>
71
+ <input id="email" name="email" type="email" required
72
+ class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none">
73
+ </div>
74
+ <div>
75
+ <label for="password" class="block text-sm font-medium text-gray-700">Password</label>
76
+ <input id="password" name="password" type="password" required
77
+ class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none">
78
+ </div>
79
+ ${this.mode === 'register' ? `
80
+ <div>
81
+ <label for="name" class="block text-sm font-medium text-gray-700">Full Name</label>
82
+ <input id="name" name="name" type="text" required
83
+ class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none">
84
+ </div>
85
+ ` : ''}
86
+ </div>
87
+ <div>
88
+ <button type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
89
+ ${this.mode === 'login' ? 'Sign in' : 'Create account'}
90
+ </button>
91
+ </div>
92
+ <div class="text-center text-sm text-gray-600">
93
+ <button id="toggleMode" type="button" class="font-medium text-purple-600 hover:text-purple-500">
94
+ ${this.mode === 'login' ? 'Need an account? Register' : 'Already have an account? Sign in'}
95
+ </button>
96
+ </div>
97
+ </form>
98
+ `;
99
+ }
100
+ }
101
+
102
+ customElements.define('auth-form', AuthForm);
components/navbar.js ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.render();
5
+ }
6
+
7
+ handleLogout() {
8
+ localStorage.removeItem('token');
9
+ localStorage.removeItem('user');
10
+ redirectTo('/index.html');
11
+ }
12
+
13
+ render() {
14
+ const user = JSON.parse(localStorage.getItem('user') || '{}');
15
+
16
+ this.shadowRoot.innerHTML = `
17
+ <style>
18
+ .navbar {
19
+ transition: all 0.3s ease;
20
+ }
21
+ .nav-link:hover {
22
+ color: #6366f1;
23
+ }
24
+ .user-avatar {
25
+ transition: transform 0.2s;
26
+ }
27
+ .user-avatar:hover {
28
+ transform: scale(1.1);
29
+ }
30
+ </style>
31
+ <nav class="navbar bg-white shadow-sm">
32
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
33
+ <div class="flex justify-between h-16">
34
+ <div class="flex items-center">
35
+ <a href="${user.role === 'admin' ? '/admin-dashboard.html' : '/dashboard.html'}" class="flex-shrink-0 flex items-center">
36
+ <span class="text-xl font-bold text-blue-600">TaskTrack</span>
37
+ </a>
38
+ </div>
39
+ <div class="flex items-center space-x-4">
40
+ <div class="flex items-center space-x-1">
41
+ <div class="flex-shrink-0">
42
+ <div class="user-avatar h-8 w-8 rounded-full bg-purple-500 flex items-center justify-center text-white font-medium">
43
+ ${user.name ? user.name.charAt(0).toUpperCase() : 'U'}
44
+ </div>
45
+ </div>
46
+ <div class="ml-3">
47
+ <p class="text-sm font-medium text-gray-700">${user.name || 'User'}</p>
48
+ <p class="text-xs text-gray-500">${user.role === 'admin' ? 'Admin' : 'User'}</p>
49
+ </div>
50
+ </div>
51
+ <button id="logoutBtn" class="text-gray-500 hover:text-gray-700">
52
+ <i data-feather="log-out"></i>
53
+ </button>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </nav>
58
+ <script>
59
+ feather.replace();
60
+ document.getElementById('logoutBtn').addEventListener('click', () => {
61
+ localStorage.removeItem('token');
62
+ localStorage.removeItem('user');
63
+ window.location.href = '/index.html
dashboard.html ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>TaskTrack | Dashboard</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="components/navbar.js"></script>
12
+ <script src="components/task-group.js"></script>
13
+ <script src="components/task-item.js"></script>
14
+ <script src="components/create-task-modal.js"></script>
15
+ </head>
16
+ <body class="auth-required bg-gray-100">
17
+ <custom-navbar></custom-navbar>
18
+
19
+ <div class="container mx-auto px-4 py-8">
20
+ <div class="flex justify-between items-center mb-8">
21
+ <h1 class="text-2xl font-bold text-gray-800">Your Dashboard</h1>
22
+ <div class="relative w-64">
23
+ <input type="text" placeholder="Search tasks..." class="w-full pl-10 pr-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent">
24
+ <i data-feather="search" class="absolute left-3 top-2.5 text-gray-400"></i>
25
+ </div>
26
+ </div>
27
+
28
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
29
+ <task-group title="Personal Tasks" tag="personal">
30
+ <task-item title="Buy groceries" completed="false"></task-item>
31
+ <task-item title="Call mom" completed="true"></task-item>
32
+ </task-group>
33
+
34
+ <task-group title="Work Projects" tag="work">
35
+ <task-item title="Finish report" completed="false"></task-item>
36
+ <task-item title="Team meeting" completed="false"></task-item>
37
+ </task-group>
38
+
39
+ <task-group title="School Assignments" tag="school">
40
+ <task-item title="Math homework" completed="false"></task-item>
41
+ <task-item title="Research paper" completed="false"></task-item>
42
+ </task-group>
43
+ </div>
44
+
45
+ <button id="createTaskBtn" class="fixed bottom-8 right-8 bg-blue-600 hover:bg-blue-700 text-white rounded-full p-4 shadow-lg transition-transform hover:scale-110">
46
+ <i data-feather="plus"></i>
47
+ </button>
48
+ </div>
49
+
50
+ <create-task-modal></create-task-modal>
51
+
52
+ <script src="script.js"></script>
53
+ <script>feather.replace();</script>
54
+ </body>
55
+ </html>
index.html CHANGED
@@ -1,19 +1,24 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>TaskTrack | Login</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="components/auth-form.js"></script>
12
+ </head>
13
+ <body class="bg-gray-100 min-h-screen flex items-center justify-center">
14
+ <div class="w-full max-w-md p-8 space-y-8 bg-white rounded-xl shadow-lg">
15
+ <div class="text-center">
16
+ <h1 class="text-3xl font-bold text-blue-600">TaskTrack</h1>
17
+ <p class="mt-2 text-gray-600">Organize your tasks with ease</p>
18
+ </div>
19
+ <auth-form></auth-form>
20
+ </div>
21
+ <script>feather.replace();</script>
22
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
23
+ </body>
24
+ </html>
script.js ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Shared utility functions
2
+ const API_BASE_URL = 'http://localhost:3000/api';
3
+
4
+ async function fetchWithAuth(url, options = {}) {
5
+ const token = localStorage.getItem('token');
6
+ if (token) {
7
+ options.headers = {
8
+ ...options.headers,
9
+ 'Authorization': `Bearer ${token}`
10
+ };
11
+ }
12
+ const response = await fetch(`${API_BASE_URL}${url}`, options);
13
+ if (!response.ok) {
14
+ throw new Error(`HTTP error! status: ${response.status}`);
15
+ }
16
+ return response.json();
17
+ }
18
+
19
+ function redirectTo(path) {
20
+ window.location.href = path;
21
+ }
22
+
23
+ function showToast(message, type = 'success') {
24
+ const toast = document.createElement('div');
25
+ toast.className = `fixed top-4 right-4 px-4 py-2 rounded-md shadow-lg text-white ${
26
+ type === 'success' ? 'bg-green-500' : 'bg-red-500'
27
+ }`;
28
+ toast.textContent = message;
29
+ document.body.appendChild(toast);
30
+
31
+ setTimeout(() => {
32
+ toast.classList.add('opacity-0', 'transition-opacity', 'duration-300');
33
+ setTimeout(() => toast.remove(), 300);
34
+ }, 3000);
35
+ }
36
+
37
+ // Auth state management
38
+ function checkAuth() {
39
+ const token = localStorage.getItem('token');
40
+ const user = localStorage.getItem('user');
41
+
42
+ if (token && user) {
43
+ const parsedUser = JSON.parse(user);
44
+ if (parsedUser.role === 'admin') {
45
+ redirectTo('/admin-dashboard.html');
46
+ } else {
47
+ redirectTo('/dashboard.html');
48
+ }
49
+ }
50
+ }
51
+
52
+ // Initialize auth check on pages that require it
53
+ if (document.body.classList.contains('auth-required')) {
54
+ document.addEventListener('DOMContentLoaded', checkAuth);
55
+ }
style.css CHANGED
@@ -1,28 +1,60 @@
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
 
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
2
+
3
  body {
4
+ font-family: 'Inter', sans-serif;
5
+ }
6
+
7
+ /* Custom scrollbar */
8
+ ::-webkit-scrollbar {
9
+ width: 8px;
10
+ height: 8px;
11
+ }
12
+
13
+ ::-webkit-scrollbar-track {
14
+ background: #f1f1f1;
15
+ }
16
+
17
+ ::-webkit-scrollbar-thumb {
18
+ background: #888;
19
+ border-radius: 4px;
20
  }
21
 
22
+ ::-webkit-scrollbar-thumb:hover {
23
+ background: #555;
 
24
  }
25
 
26
+ /* Animation classes */
27
+ .fade-in {
28
+ animation: fadeIn 0.3s ease-in-out;
 
 
29
  }
30
 
31
+ @keyframes fadeIn {
32
+ from { opacity: 0; transform: translateY(10px); }
33
+ to { opacity: 1; transform: translateY(0); }
 
 
 
34
  }
35
 
36
+ /* Tag colors */
37
+ .tag-school {
38
+ background-color: #3b82f6;
39
+ color: white;
40
  }
41
+
42
+ .tag-urgent {
43
+ background-color: #ef4444;
44
+ color: white;
45
+ }
46
+
47
+ .tag-work {
48
+ background-color: #10b981;
49
+ color: white;
50
+ }
51
+
52
+ .tag-personal {
53
+ background-color: #8b5cf6;
54
+ color: white;
55
+ }
56
+
57
+ .tag-other {
58
+ background-color: #6b7280;
59
+ color: white;
60
+ }