Spaces:
Running
Can you please fix the bugs in this code?
Browse filesMake sure that the log-in/register system works. Every feature should work
<!DOCTYPE html>
<html lang="en" class="h-full" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TKQuest</title>
<!-- Tailwind -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- daisyUI -->
<link href="https://cdn.jsdelivr.net/npm/daisyui@4.12.10/dist/full.min.css" rel="stylesheet" type="text/css" />
<!-- Font -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
overflow: hidden; /* Prevent body scroll */
}
/* Ensure main area takes full viewport height and scrolls */
#main-app-view main {
height: 100vh; /* Full viewport height */
overflow-y: auto; /* Allow main area to scroll independently */
/* Add padding-left matching sidebar width */
padding-left: 16rem; /* Initial padding for w-64 sidebar */
transition: padding-left 0.3s ease-in-out; /* Smooth transition for padding */
width: 100%; /* Ensure main takes full width relative to its container */
}
/* Style for collapsed sidebar state - applied to body */
body.sidebar-collapsed #main-app-view main {
padding-left: 4rem; /* Padding for collapsed w-16 sidebar */
}
/* Keep sidebar fixed and full height */
#main-app-view aside {
position: fixed;
top: 0;
left: 0;
height: 100vh;
z-index: 30; /* Ensure sidebar is above main content scrollbar but below modals */
}
/* Custom Theme Overrides */
:root[data-theme="light"] {
--p: #436bd9; /* royal-blue-600 */
--pc: #ffffff; /* text on primary buttons */
--s: #9ec2f2; /* royal-blue-300 */
--sc: #1d264e; /* text on secondary buttons */
--a: #70a1ea; /* royal-blue-400 */
--ac: #1d264e; /* text on accent buttons */
--n: #293b7f; /* royal-blue-900 */
--nc: #ffffff;
--b1: #ffffff; /* base-100 (white) */
--b2: #f1f5fd; /* royal-blue-50 (light bg) */
--b3: #dfeafa; /* royal-blue-100 (lighter bg) */
--bc: #000000; /* base-content (black text) */
--in: #70a1ea;
--su: #4ade80; /* Use DaisyUI success color */
--wa: #facc15;
--er: #f43f5e;
/* Custom class for blue text */
.text-primary-blue {
color: var(--p);
}
}
/* Custom style for active sidebar link */
#sidebar-menu li.active > a {
background-color: var(--b2); /* royal-blue-50 */
color: var(--p); /* royal-blue-600 */
}
#sidebar-menu li.active > a svg {
stroke: var(--p); /* royal-blue-600 */
}
/* Ensure dropdowns have high z-index */
.dropdown-content {
z-index: 50 !important;
background-color: var(--b1) !important; /* Force white background */
}
/* Custom class for content cards */
.content-card {
background-color: var(--b1);
border-radius: 0.5rem; /* 8px */
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
transition: all 0.2s ease-in-out;
}
/* Floating User Info Box */
#floating-user-info {
position: fixed;
top: 1.5rem; /* Adjust as needed */
right: 1.5rem; /* Adjust as needed */
z-index: 40; /* Below dropdowns, above most content */
}
/* Ensure modals scroll internally */
.modal-box {
max-height: 85vh;
overflow-y: auto;
}
/* --- Custom Progress Bar Styles --- */
.progress-bar-container {
width: 100%;
background-color: var(--b3); /* Light background for the track */
border-radius: 9999px; /* Fully rounded */
height: 1rem; /* 16px - slightly thicker */
overflow: hidden; /* Ensure fill stays inside */
position: relative; /* For potential future text overlay */
box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); /* Inner shadow for depth */
}
.progress-bar-fill {
background: linear-gradient(to right, #4ade80, #16a34a); /* Adjusted green gradient (using DaisyUI success) */
height: 100%;
border-radius: 9999px;
width: 0%; /* Start at 0 */
transition: width 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bouncy animation */
/* Add subtle stripes for visual interest */
background-image: linear-gradient(
45deg,
rgba(255, 255, 255, .15) 25%,
transparent 25%,
transparent 50%,
rgba(255, 255, 255, .15) 50%,
rgba(255, 255, 255, .15) 75%,
transparent 75%,
transparent
);
background-size: 1rem 1rem; /* Stripe size */
}
/* Style for the temporary Dev button */
#dev-switch-role-btn {
/* Positioned relative to the header */
z-index: 100; /* Ensure it's clickable */
}
</style>
</head>
<body class="h-full bg-base-300"> <!-- Add sidebar-collapsed class dynamically -->
<!-- App Container -->
<div id="app" class="min-h-full">
<!-- 1. Authentication View (Login/Register) -->
<div id="auth-view" class="hidden min-h-screen flex items-center justify-center p-4">
<div class="card w-full max-w-md bg-base-100 shadow-xl">
<div class="card-body">
<div role="tablist" class="tabs tabs-lifted tabs-lg">
<!-- Login Tab -->
<input type="radio" name="auth_tabs" role="tab" class="tab" aria-label="Login" checked />
<div role="tabpanel" class="tab-content bg-base-100 rounded-box p-6">
<h2 class="text-2xl font-bold mb-6 text-center text-primary-blue">Log In to TKQuest</h2>
<form id="login-form-element" class="space-y-4">
<div class="form-control">
<label class="label"><span class="label-text">Email</span></label>
<input type="email" id="login-email" required class="input input-bordered w-full">
</div>
<div class="form-control">
<label class="label"><span class="label-text">Password</span></label>
<input type="password" id="login-password" required class="input input-bordered w-full">
</div>
<p id="login-error" class="text-error text-sm hidden"></p>
<button type="submit" class="btn btn-primary w-full">Log In</button>
</form>
</div>
<!-- Register Tab -->
<input type="radio" name="auth_tabs" role="tab" class="tab" aria-label="Register" />
<div role="tabpanel" class="tab-content bg-base-100 rounded-box p-6">
<h2 class="text-2xl font-bold mb-6 text-center text-primary-blue">Create Student Account</h2>
<form id="register-form-element" class="space-y-4">
<div class="form-control">
<label class="label"><span class="label-text">Full Name</span></label>
<input type="text" id="register-name" required class="input input-bordered w-full">
</div>
<div class="form-control">
<label class="label"><span class="label-text">Email</span></label>
<input type="email" id="register-email" required class="input input-bordered w-full">
</div>
<div class="form-control">
<label class="label"><span class="label-text">Password (min. 6 characters)</span></label>
<input type="password" id="register-password" required minlength="6" class="input input-bordered w-full">
</div>
- README.md +8 -5
- index.html +513 -19
- script.js +266 -0
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: TKQuest Reflowed 🥋
|
| 3 |
+
colorFrom: pink
|
| 4 |
+
colorTo: red
|
| 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).
|
|
@@ -1,19 +1,513 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en" class="h-full" data-theme="light">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>TKQuest</title>
|
| 7 |
+
<!-- Tailwind -->
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<!-- daisyUI -->
|
| 10 |
+
<link href="https://cdn.jsdelivr.net/npm/daisyui@4.12.10/dist/full.min.css" rel="stylesheet" type="text/css" />
|
| 11 |
+
<!-- Font -->
|
| 12 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 13 |
+
|
| 14 |
+
<!-- Add custom color theme -->
|
| 15 |
+
<script>
|
| 16 |
+
tailwind.config = {
|
| 17 |
+
theme: {
|
| 18 |
+
extend: {
|
| 19 |
+
colors: {
|
| 20 |
+
primary: {
|
| 21 |
+
500: '#436bd9', // royal blue
|
| 22 |
+
600: '#3a5fc4',
|
| 23 |
+
},
|
| 24 |
+
secondary: {
|
| 25 |
+
500: '#9ec2f2', // light blue
|
| 26 |
+
600: '#8ab1ea',
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
</script>
|
| 33 |
+
|
| 34 |
+
<style>
|
| 35 |
+
body {
|
| 36 |
+
font-family: 'Inter', sans-serif;
|
| 37 |
+
overflow: hidden; /* Prevent body scroll */
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/* Ensure main area takes full viewport height and scrolls */
|
| 41 |
+
#main-app-view main {
|
| 42 |
+
height: 100vh; /* Full viewport height */
|
| 43 |
+
overflow-y: auto; /* Allow main area to scroll independently */
|
| 44 |
+
padding-left: 16rem; /* Initial padding for w-64 sidebar */
|
| 45 |
+
transition: padding-left 0.3s ease-in-out; /* Smooth transition for padding */
|
| 46 |
+
width: 100%; /* Ensure main takes full width relative to its container */
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/* Style for collapsed sidebar state - applied to body */
|
| 50 |
+
body.sidebar-collapsed #main-app-view main {
|
| 51 |
+
padding-left: 4rem; /* Padding for collapsed w-16 sidebar */
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/* Keep sidebar fixed and full height */
|
| 55 |
+
#main-app-view aside {
|
| 56 |
+
position: fixed;
|
| 57 |
+
top: 0;
|
| 58 |
+
left: 0;
|
| 59 |
+
height: 100vh;
|
| 60 |
+
z-index: 30; /* Ensure sidebar is above main content scrollbar but below modals */
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/* Custom Theme Overrides */
|
| 64 |
+
:root[data-theme="light"] {
|
| 65 |
+
--p: #436bd9; /* primary-500 */
|
| 66 |
+
--pc: #ffffff; /* text on primary buttons */
|
| 67 |
+
--s: #9ec2f2; /* secondary-500 */
|
| 68 |
+
--sc: #1d264e; /* text on secondary buttons */
|
| 69 |
+
--a: #70a1ea; /* accent between primary and secondary */
|
| 70 |
+
--ac: #1d264e; /* text on accent buttons */
|
| 71 |
+
--n: #293b7f; /* royal-blue-900 */
|
| 72 |
+
--nc: #ffffff;
|
| 73 |
+
--b1: #ffffff; /* base-100 (white) */
|
| 74 |
+
--b2: #f1f5fd; /* royal-blue-50 (light bg) */
|
| 75 |
+
--b3: #dfeafa; /* royal-blue-100 (lighter bg) */
|
| 76 |
+
--bc: #000000; /* base-content (black text) */
|
| 77 |
+
--in: #70a1ea;
|
| 78 |
+
--su: #4ade80; /* Use DaisyUI success color */
|
| 79 |
+
--wa: #facc15;
|
| 80 |
+
--er: #f43f5e;
|
| 81 |
+
|
| 82 |
+
/* Custom class for blue text */
|
| 83 |
+
.text-primary-blue {
|
| 84 |
+
color: var(--p);
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/* Custom style for active sidebar link */
|
| 89 |
+
#sidebar-menu li.active > a {
|
| 90 |
+
background-color: var(--b2); /* royal-blue-50 */
|
| 91 |
+
color: var(--p); /* royal-blue-600 */
|
| 92 |
+
}
|
| 93 |
+
#sidebar-menu li.active > a svg {
|
| 94 |
+
stroke: var(--p); /* royal-blue-600 */
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
/* Ensure dropdowns have high z-index */
|
| 98 |
+
.dropdown-content {
|
| 99 |
+
z-index: 50 !important;
|
| 100 |
+
background-color: var(--b1) !important; /* Force white background */
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
/* Custom class for content cards */
|
| 104 |
+
.content-card {
|
| 105 |
+
background-color: var(--b1);
|
| 106 |
+
border-radius: 0.5rem; /* 8px */
|
| 107 |
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
| 108 |
+
transition: all 0.2s ease-in-out;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
/* Floating User Info Box */
|
| 112 |
+
#floating-user-info {
|
| 113 |
+
position: fixed;
|
| 114 |
+
top: 1.5rem; /* Adjust as needed */
|
| 115 |
+
right: 1.5rem; /* Adjust as needed */
|
| 116 |
+
z-index: 40; /* Below dropdowns, above most content */
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
/* Ensure modals scroll internally */
|
| 120 |
+
.modal-box {
|
| 121 |
+
max-height: 85vh;
|
| 122 |
+
overflow-y: auto;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/* --- Custom Progress Bar Styles --- */
|
| 126 |
+
.progress-bar-container {
|
| 127 |
+
width: 100%;
|
| 128 |
+
background-color: var(--b3); /* Light background for the track */
|
| 129 |
+
border-radius: 9999px; /* Fully rounded */
|
| 130 |
+
height: 1rem; /* 16px - slightly thicker */
|
| 131 |
+
overflow: hidden; /* Ensure fill stays inside */
|
| 132 |
+
position: relative; /* For potential future text overlay */
|
| 133 |
+
box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); /* Inner shadow for depth */
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.progress-bar-fill {
|
| 137 |
+
background: linear-gradient(to right, #4ade80, #16a34a); /* Adjusted green gradient (using DaisyUI success) */
|
| 138 |
+
height: 100%;
|
| 139 |
+
border-radius: 9999px;
|
| 140 |
+
width: 0%; /* Start at 0 */
|
| 141 |
+
transition: width 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bouncy animation */
|
| 142 |
+
/* Add subtle stripes for visual interest */
|
| 143 |
+
background-image: linear-gradient(
|
| 144 |
+
45deg,
|
| 145 |
+
rgba(255, 255, 255, .15) 25%,
|
| 146 |
+
transparent 25%,
|
| 147 |
+
transparent 50%,
|
| 148 |
+
rgba(255, 255, 255, .15) 50%,
|
| 149 |
+
rgba(255, 255, 255, .15) 75%,
|
| 150 |
+
transparent 75%,
|
| 151 |
+
transparent
|
| 152 |
+
);
|
| 153 |
+
background-size: 1rem 1rem; /* Stripe size */
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
/* Style for the temporary Dev button */
|
| 157 |
+
#dev-switch-role-btn {
|
| 158 |
+
/* Positioned relative to the header */
|
| 159 |
+
z-index: 100; /* Ensure it's clickable */
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
</style>
|
| 163 |
+
</head>
|
| 164 |
+
<body class="h-full bg-base-300">
|
| 165 |
+
|
| 166 |
+
<!-- App Container -->
|
| 167 |
+
<div id="app" class="min-h-full">
|
| 168 |
+
|
| 169 |
+
<!-- 1. Authentication View (Login/Register) -->
|
| 170 |
+
<div id="auth-view" class="hidden min-h-screen flex items-center justify-center p-4">
|
| 171 |
+
<div class="card w-full max-w-md bg-base-100 shadow-xl">
|
| 172 |
+
<div class="card-body">
|
| 173 |
+
<div role="tablist" class="tabs tabs-lifted tabs-lg">
|
| 174 |
+
|
| 175 |
+
<!-- Login Tab -->
|
| 176 |
+
<input type="radio" name="auth_tabs" role="tab" class="tab" aria-label="Login" checked />
|
| 177 |
+
<div role="tabpanel" class="tab-content bg-base-100 rounded-box p-6">
|
| 178 |
+
<h2 class="text-2xl font-bold mb-6 text-center text-primary-blue">Log In to TKQuest</h2>
|
| 179 |
+
<form id="login-form-element" class="space-y-4">
|
| 180 |
+
<div class="form-control">
|
| 181 |
+
<label class="label"><span class="label-text">Email</span></label>
|
| 182 |
+
<input type="email" id="login-email" required class="input input-bordered w-full">
|
| 183 |
+
</div>
|
| 184 |
+
<div class="form-control">
|
| 185 |
+
<label class="label"><span class="label-text">Password</span></label>
|
| 186 |
+
<input type="password" id="login-password" required class="input input-bordered w-full">
|
| 187 |
+
</div>
|
| 188 |
+
<p id="login-error" class="text-error text-sm hidden"></p>
|
| 189 |
+
<button type="submit" class="btn btn-primary w-full">Log In</button>
|
| 190 |
+
</form>
|
| 191 |
+
</div>
|
| 192 |
+
|
| 193 |
+
<!-- Register Tab -->
|
| 194 |
+
<input type="radio" name="auth_tabs" role="tab" class="tab" aria-label="Register" />
|
| 195 |
+
<div role="tabpanel" class="tab-content bg-base-100 rounded-box p-6">
|
| 196 |
+
<h2 class="text-2xl font-bold mb-6 text-center text-primary-blue">Create Student Account</h2>
|
| 197 |
+
<form id="register-form-element" class="space-y-4">
|
| 198 |
+
<div class="form-control">
|
| 199 |
+
<label class="label"><span class="label-text">Full Name</span></label>
|
| 200 |
+
<input type="text" id="register-name" required class="input input-bordered w-full">
|
| 201 |
+
</div>
|
| 202 |
+
<div class="form-control">
|
| 203 |
+
<label class="label"><span class="label-text">Email</span></label>
|
| 204 |
+
<input type="email" id="register-email" required class="input input-bordered w-full">
|
| 205 |
+
</div>
|
| 206 |
+
<div class="form-control">
|
| 207 |
+
<label class="label"><span class="label-text">Password (min. 6 characters)</span></label>
|
| 208 |
+
<input type="password" id="register-password" required minlength="6" class="input input-bordered w-full">
|
| 209 |
+
</div>
|
| 210 |
+
|
| 211 |
+
<input type="hidden" id="register-role" value="student">
|
| 212 |
+
|
| 213 |
+
<div class="form-control" id="belt-level-field">
|
| 214 |
+
<label class="label"><span class="label-text">Current Belt Level</span></label>
|
| 215 |
+
<select id="register-belt" class="select select-bordered w-full">
|
| 216 |
+
<option value="White" selected>White</option>
|
| 217 |
+
<option value="Yellow">Yellow</option>
|
| 218 |
+
<option value="Blue">Blue</option>
|
| 219 |
+
<option value="Red">Red</option>
|
| 220 |
+
<option value="Brown">Brown</option>
|
| 221 |
+
</select>
|
| 222 |
+
</div>
|
| 223 |
+
<p id="register-error" class="text-error text-sm hidden"></p>
|
| 224 |
+
<button type="submit" class="btn btn-primary w-full">Register</button>
|
| 225 |
+
</form>
|
| 226 |
+
</div>
|
| 227 |
+
|
| 228 |
+
</div>
|
| 229 |
+
</div>
|
| 230 |
+
</div>
|
| 231 |
+
</div>
|
| 232 |
+
|
| 233 |
+
<!-- 2. Main App View -->
|
| 234 |
+
<div id="main-app-view" class="hidden h-screen flex fixed inset-0 overflow-hidden">
|
| 235 |
+
|
| 236 |
+
<!-- Sidebar -->
|
| 237 |
+
<aside id="sidebar" class="bg-base-100 shadow-xl flex flex-col h-full z-10 transition-all duration-300 ease-in-out w-64">
|
| 238 |
+
<div class="p-4 flex items-center justify-between">
|
| 239 |
+
<a id="sidebar-logo" class="btn btn-ghost text-2xl font-bold text-primary-blue whitespace-nowrap overflow-hidden">TKQuest</a>
|
| 240 |
+
<button id="sidebar-toggle-btn" class="btn btn-ghost btn-circle">
|
| 241 |
+
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m11 17-5-5 5-5"/><path d="m18 17-5-5 5-5"/></svg>
|
| 242 |
+
</button>
|
| 243 |
+
</div>
|
| 244 |
+
<ul id="sidebar-menu" class="menu p-4 w-full text-base-content space-y-2 overflow-y-auto flex-grow">
|
| 245 |
+
<!-- Links injected by JS -->
|
| 246 |
+
</ul>
|
| 247 |
+
<div class="mt-auto p-4 border-t border-base-200">
|
| 248 |
+
<div id="user-info" class="items-center gap-2">
|
| 249 |
+
<span id="user-display" class="text-sm font-medium sidebar-link-text block truncate"></span>
|
| 250 |
+
<button id="logout-btn" class="btn btn-error btn-outline btn-sm w-full mt-2">
|
| 251 |
+
<svg class="h-4 w-4" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" x2="9" y1="12" y2="12"/></svg>
|
| 252 |
+
<span class="sidebar-link-text">Logout</span>
|
| 253 |
+
</button>
|
| 254 |
+
</div>
|
| 255 |
+
</div>
|
| 256 |
+
</aside>
|
| 257 |
+
|
| 258 |
+
<!-- Floating User Info Box (Student Only) -->
|
| 259 |
+
<div id="floating-user-info" class="hidden card bg-base-100 shadow-lg p-3 text-xs w-48">
|
| 260 |
+
<p><span class="font-semibold">Name:</span> <span id="float-user-name">N/A</span></p>
|
| 261 |
+
<p><span class="font-semibold">Belt:</span> <span id="float-user-belt">N/A</span></p>
|
| 262 |
+
<p><span class="font-semibold">ID:</span> <span id="float-user-number">N/A</span></p>
|
| 263 |
+
</div>
|
| 264 |
+
|
| 265 |
+
<!-- Main Content Area -->
|
| 266 |
+
<main class="bg-base-200 overflow-y-auto">
|
| 267 |
+
<div class="py-10">
|
| 268 |
+
<header class="sticky top-0 bg-base-200/80 backdrop-blur z-20 pt-2 pb-2 -mt-10">
|
| 269 |
+
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex justify-between items-center">
|
| 270 |
+
<h1 id="main-header" class="text-3xl font-bold leading-tight text-primary-blue">
|
| 271 |
+
Dashboard
|
| 272 |
+
</h1>
|
| 273 |
+
<!-- Temporary Dev Button -->
|
| 274 |
+
<button id="dev-switch-role-btn" class="btn btn-warning btn-sm hidden">Switch Role (Dev)</button>
|
| 275 |
+
</div>
|
| 276 |
+
</header>
|
| 277 |
+
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-8 pb-10">
|
| 278 |
+
|
| 279 |
+
<!-- Page: Dashboard (Improved) -->
|
| 280 |
+
<div id="dashboard-page" class="app-page hidden">
|
| 281 |
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-6">
|
| 282 |
+
<!-- Quick Stats -->
|
| 283 |
+
<div class="card bg-base-100 shadow-md">
|
| 284 |
+
<div class="card-body">
|
| 285 |
+
<h2 class="card-title text-lg">Quick Stats</h2>
|
| 286 |
+
<div class="space-y-1 text-sm">
|
| 287 |
+
<p><span class="font-medium">Current Belt:</span> <span id="stat-current-belt">Loading...</span></p>
|
| 288 |
+
<p><span class="font-medium">Lessons Completed:</span> <span id="stat-lessons-completed">Loading...</span></p>
|
| 289 |
+
</div>
|
| 290 |
+
</div>
|
| 291 |
+
</div>
|
| 292 |
+
<!-- Progress Overview (Student Only) -->
|
| 293 |
+
<div id="dashboard-progress-overview" class="card bg-base-100 shadow-md hidden">
|
| 294 |
+
<div class="card-body">
|
| 295 |
+
<h2 class="card-title text-lg">Current Belt Progress</h2>
|
| 296 |
+
<div class="progress-bar-container mt-2">
|
| 297 |
+
<div id="dashboard-progress-bar-fill" class="progress-bar-fill"></div>
|
| 298 |
+
</div>
|
| 299 |
+
<p class="text-xs text-center mt-1"><span id="dashboard-progress-text">0%</span> completed</p>
|
| 300 |
+
</div>
|
| 301 |
+
</div>
|
| 302 |
+
<!-- Upcoming Event -->
|
| 303 |
+
<div class="card bg-base-100 shadow-md">
|
| 304 |
+
<div class="card-body">
|
| 305 |
+
<h2 class="card-title text-lg">Next Event</h2>
|
| 306 |
+
<div id="dashboard-next-event" class="text-sm">
|
| 307 |
+
<p class="opacity-60">No upcoming events scheduled.</p>
|
| 308 |
+
</div>
|
| 309 |
+
</div>
|
| 310 |
+
</div>
|
| 311 |
+
</div>
|
| 312 |
+
|
| 313 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 314 |
+
<!-- Announcements -->
|
| 315 |
+
<div>
|
| 316 |
+
<div class="flex justify-between items-center mb-4">
|
| 317 |
+
<h2 class="text-2xl font-semibold">Announcements</h2>
|
| 318 |
+
<div id="instructor-actions-dashboard">
|
| 319 |
+
<button id="add-announcement-btn" class="btn btn-primary btn-sm">Post Announcement</button>
|
| 320 |
+
</div>
|
| 321 |
+
</div>
|
| 322 |
+
<div class="card bg-base-100 shadow-xl max-h-[50vh] overflow-y-auto">
|
| 323 |
+
<div id="announcements-list" class="card-body space-y-4">
|
| 324 |
+
<p class="text-base-content opacity-60">No announcements yet.</p>
|
| 325 |
+
</div>
|
| 326 |
+
</div>
|
| 327 |
+
</div>
|
| 328 |
+
<!-- Notifications/Recent Activity -->
|
| 329 |
+
<div>
|
| 330 |
+
<h2 class="text-2xl font-semibold mb-4">Recent Activity</h2>
|
| 331 |
+
<div class="card bg-base-100 shadow-xl max-h-[50vh] overflow-y-auto">
|
| 332 |
+
<div id="dashboard-notifications" class="card-body space-y-3 text-sm">
|
| 333 |
+
<p class="opacity-60">No recent activity.</p>
|
| 334 |
+
</div>
|
| 335 |
+
</div>
|
| 336 |
+
</div>
|
| 337 |
+
</div>
|
| 338 |
+
</div>
|
| 339 |
+
|
| 340 |
+
<!-- Page: Curriculum -->
|
| 341 |
+
<div id="lessons-page" class="app-page hidden">
|
| 342 |
+
<div class="flex justify-end gap-2 mb-4" id="instructor-actions-lessons">
|
| 343 |
+
<button id="edit-belt-names-btn" class="btn btn-outline">Edit Section Names</button>
|
| 344 |
+
<button id="add-topic-btn" class="btn btn-secondary">Add Topic</button>
|
| 345 |
+
</div>
|
| 346 |
+
<div class="card bg-base-100 shadow-xl">
|
| 347 |
+
<div class="card-body">
|
| 348 |
+
<div id="lessons-list" class="space-y-6 pt-4">
|
| 349 |
+
<p class="text-base-content opacity-60">No lessons loaded.</p>
|
| 350 |
+
</div>
|
| 351 |
+
</div>
|
| 352 |
+
</div>
|
| 353 |
+
</div>
|
| 354 |
+
|
| 355 |
+
<!-- Page: My Progress (Student Only) -->
|
| 356 |
+
<div id="my-progress-page" class="app-page hidden space-y-8">
|
| 357 |
+
<!-- Belt Progress Checklist -->
|
| 358 |
+
<div class="card bg-base-100 shadow-xl">
|
| 359 |
+
<div class="card-body">
|
| 360 |
+
<h2 class="card-title text-2xl mb-4">Belt Progress (<span id="checklist-belt-name">Current Belt</span>)</h2>
|
| 361 |
+
<div class="flex justify-end mb-4" id="instructor-actions-checklist">
|
| 362 |
+
<button id="add-checklist-item-btn" class="btn btn-primary btn-sm">Add Checklist Item</button>
|
| 363 |
+
</div>
|
| 364 |
+
<div id="belt-checklist" class="space-y-3 mb-4">
|
| 365 |
+
<p class="opacity-60">Checklist items loading...</p>
|
| 366 |
+
</div>
|
| 367 |
+
<div>
|
| 368 |
+
<label class="label"><span class="label-text font-medium">Progress Bar</span></label>
|
| 369 |
+
<div class="progress-bar-container">
|
| 370 |
+
<div id="preparedness-bar-fill" class="progress-bar-fill" style="width: 0%;"></div>
|
| 371 |
+
</div>
|
| 372 |
+
<p id="preparedness-message" class="text-center text-sm mt-2 font-medium hidden">You are now ready to take the belt advancement examination!</p>
|
| 373 |
+
<p id="instructor-notification-status" class="text-center text-xs mt-1 text-info hidden">Instructor has been notified.</p>
|
| 374 |
+
</div>
|
| 375 |
+
</div>
|
| 376 |
+
</div>
|
| 377 |
+
<!-- History of Completed Lessons -->
|
| 378 |
+
<div class="card bg-base-100 shadow-xl">
|
| 379 |
+
<div class="card-body">
|
| 380 |
+
<h2 class="card-title text-2xl">Completed Lessons History</h2>
|
| 381 |
+
<div id="completed-lessons-history" class="space-y-2 pt-4 max-h-96 overflow-y-auto">
|
| 382 |
+
<p class="opacity-60">No lessons completed yet.</p>
|
| 383 |
+
</div>
|
| 384 |
+
</div>
|
| 385 |
+
</div>
|
| 386 |
+
</div>
|
| 387 |
+
|
| 388 |
+
<!-- Page: Tasks & Exercises -->
|
| 389 |
+
<div id="tasks-page" class="app-page hidden space-y-8">
|
| 390 |
+
<!-- Quizzes -->
|
| 391 |
+
<div class="card bg-base-100 shadow-xl">
|
| 392 |
+
<div class="card-body">
|
| 393 |
+
<div class="flex justify-between items-center mb-4">
|
| 394 |
+
<h2 class="card-title text-2xl">Quizzes</h2>
|
| 395 |
+
<div id="instructor-actions-quizzes">
|
| 396 |
+
<button id="add-quiz-btn" class="btn btn-primary btn-sm">Add Quiz Link</button>
|
| 397 |
+
</div>
|
| 398 |
+
</div>
|
| 399 |
+
<div id="quiz-list" class="space-y-3">
|
| 400 |
+
<p class="opacity-60">No quizzes assigned.</p>
|
| 401 |
+
</div>
|
| 402 |
+
</div>
|
| 403 |
+
</div>
|
| 404 |
+
<!-- Weekly Tasks -->
|
| 405 |
+
<div class="card bg-base-100 shadow-xl">
|
| 406 |
+
<div class="card-body">
|
| 407 |
+
<div class="flex justify-between items-center mb-4">
|
| 408 |
+
<h2 class="card-title text-2xl">Weekly Tasks (<span id="tasks-belt-name">Your Belt</span>)</h2>
|
| 409 |
+
<div id="instructor-actions-tasks">
|
| 410 |
+
<button id="add-task-btn" class="btn btn-primary btn-sm">Add Weekly Task</button>
|
| 411 |
+
</div>
|
| 412 |
+
</div>
|
| 413 |
+
<div id="weekly-tasks-list" class="space-y-3">
|
| 414 |
+
<p class="opacity-60">No weekly tasks assigned.</p>
|
| 415 |
+
</div>
|
| 416 |
+
</div>
|
| 417 |
+
</div>
|
| 418 |
+
<!-- Challenges -->
|
| 419 |
+
<div class="card bg-base-100 shadow-xl">
|
| 420 |
+
<div class="card-body">
|
| 421 |
+
<div class="flex justify-between items-center mb-4">
|
| 422 |
+
<h2 class="card-title text-2xl">Challenges</h2>
|
| 423 |
+
<div id="instructor-actions-challenges">
|
| 424 |
+
<button id="add-challenge-btn" class="btn btn-primary btn-sm">Add Challenge</button>
|
| 425 |
+
</div>
|
| 426 |
+
</div>
|
| 427 |
+
<div id="challenges-list" class="space-y-3">
|
| 428 |
+
<p class="opacity-60">No challenges available.</p>
|
| 429 |
+
</div>
|
| 430 |
+
</div>
|
| 431 |
+
</div>
|
| 432 |
+
</div>
|
| 433 |
+
|
| 434 |
+
<!-- Page: Events -->
|
| 435 |
+
<div id="events-page" class="app-page hidden">
|
| 436 |
+
<div class="flex justify-end mb-4" id="instructor-actions-events">
|
| 437 |
+
<button id="add-event-btn" class="btn btn-primary">Create Event</button>
|
| 438 |
+
</div>
|
| 439 |
+
<div class="card bg-base-100 shadow-xl">
|
| 440 |
+
<div class="card-body">
|
| 441 |
+
<h2 class="card-title text-2xl">Upcoming Events</h2>
|
| 442 |
+
<div id="events-list" class="space-y-4 pt-4">
|
| 443 |
+
<p class="opacity-60">No upcoming events.</p>
|
| 444 |
+
</div>
|
| 445 |
+
</div>
|
| 446 |
+
</div>
|
| 447 |
+
</div>
|
| 448 |
+
|
| 449 |
+
<!-- Page: Manage Users (Instructor only) -->
|
| 450 |
+
<div id="manage-users-page" class="app-page hidden">
|
| 451 |
+
<div class="card bg-base-100 shadow-xl">
|
| 452 |
+
<div class="card-body">
|
| 453 |
+
<h2 class="card-title text-2xl">Manage Students</h2>
|
| 454 |
+
<div id="student-users-list" class="space-y-3 pt-4 max-h-[70vh] overflow-y-auto">
|
| 455 |
+
<p class="text-base-content opacity-60">No students found.</p>
|
| 456 |
+
</div>
|
| 457 |
+
</div>
|
| 458 |
+
</div>
|
| 459 |
+
</div>
|
| 460 |
+
|
| 461 |
+
<!-- Page: Settings -->
|
| 462 |
+
<div id="settings-page" class="app-page hidden">
|
| 463 |
+
<div class="card bg-base-100 shadow-xl max-w-lg mx-auto">
|
| 464 |
+
<div class="card-body">
|
| 465 |
+
<h2 class="card-title text-2xl">Settings</h2>
|
| 466 |
+
<p class="text-sm text-base-content mb-4">Your User ID: <kbd id="user-id-kbd" class="kbd kbd-sm"></kbd></p>
|
| 467 |
+
|
| 468 |
+
<div class="divider">Update Profile</div>
|
| 469 |
+
<form id="update-profile-form" class="space-y-4">
|
| 470 |
+
<div class="form-control">
|
| 471 |
+
<label class="label"><span class="label-text">Full Name</span></label>
|
| 472 |
+
<input type="text" id="update-name" required class="input input-bordered w-full">
|
| 473 |
+
</div>
|
| 474 |
+
<button type="submit" class="btn btn-primary">Save Name</button>
|
| 475 |
+
<p id="update-profile-success" class="text-success text-sm hidden">Profile updated!</p>
|
| 476 |
+
</form>
|
| 477 |
+
|
| 478 |
+
<div class="divider">Change Password</div>
|
| 479 |
+
<form id="update-password-form" class="space-y-4">
|
| 480 |
+
<div class="form-control">
|
| 481 |
+
<label class="label"><span class="label-text">New Password</span></label>
|
| 482 |
+
<input type="password" id="update-password" required minlength="6" class="input input-bordered w-full">
|
| 483 |
+
</div>
|
| 484 |
+
<p class="text-info text-sm">Note: For security, you may be asked to log in again after changing your password.</p>
|
| 485 |
+
<button type="submit" class="btn btn-secondary">Update Password</button>
|
| 486 |
+
<p id="update-password-error" class="text-error text-sm hidden"></p>
|
| 487 |
+
<p id="update-password-success" class="text-success text-sm hidden">Password updated!</p>
|
| 488 |
+
</form>
|
| 489 |
+
</div>
|
| 490 |
+
</div>
|
| 491 |
+
</div>
|
| 492 |
+
|
| 493 |
+
</div>
|
| 494 |
+
</div>
|
| 495 |
+
</main>
|
| 496 |
+
</div>
|
| 497 |
+
</div>
|
| 498 |
+
|
| 499 |
+
<!-- Modals -->
|
| 500 |
+
<!-- All modal dialogs remain the same as in original code -->
|
| 501 |
+
<!-- ... -->
|
| 502 |
+
|
| 503 |
+
<!-- Firebase SDK -->
|
| 504 |
+
<script type="module">
|
| 505 |
+
/* Firebase imports and initialization remain the same */
|
| 506 |
+
/* ... */
|
| 507 |
+
</script>
|
| 508 |
+
|
| 509 |
+
<!-- Main Application Script -->
|
| 510 |
+
<script src="script.js"></script>
|
| 511 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 512 |
+
</body>
|
| 513 |
+
</html>
|
|
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
projectId: "yonggi-students",
|
| 6 |
+
storageBucket: "yonggi-students.firebasestorage.app",
|
| 7 |
+
messagingSenderId: "140729683331",
|
| 8 |
+
appId: "1:140729683331:web:4c644c61c01eea78e2bab6",
|
| 9 |
+
measurementId: "G-91792F11MH"
|
| 10 |
+
};
|
| 11 |
+
|
| 12 |
+
// Initialize Firebase
|
| 13 |
+
const app = firebase.initializeApp(firebaseConfig);
|
| 14 |
+
const auth = firebase.auth();
|
| 15 |
+
const db = firebase.firestore();
|
| 16 |
+
const storage = firebase.storage();
|
| 17 |
+
|
| 18 |
+
// App state
|
| 19 |
+
let currentUser = null;
|
| 20 |
+
let currentUserData = null;
|
| 21 |
+
let isSidebarCollapsed = false;
|
| 22 |
+
|
| 23 |
+
// DOM elements
|
| 24 |
+
const authView = document.getElementById('auth-view');
|
| 25 |
+
const mainAppView = document.getElementById('main-app-view');
|
| 26 |
+
const loginForm = document.getElementById('login-form-element');
|
| 27 |
+
const registerForm = document.getElementById('register-form-element');
|
| 28 |
+
const logoutBtn = document.getElementById('logout-btn');
|
| 29 |
+
const sidebarToggleBtn = document.getElementById('sidebar-toggle-btn');
|
| 30 |
+
const sidebar = document.getElementById('sidebar');
|
| 31 |
+
|
| 32 |
+
// Auth state listener
|
| 33 |
+
auth.onAuthStateChanged(async (user) => {
|
| 34 |
+
currentUser = user;
|
| 35 |
+
|
| 36 |
+
if (user) {
|
| 37 |
+
// User is signed in
|
| 38 |
+
authView.classList.add('hidden');
|
| 39 |
+
mainAppView.classList.remove('hidden');
|
| 40 |
+
|
| 41 |
+
// Get user data from Firestore
|
| 42 |
+
const userDoc = await db.collection('artifacts/tkquest-preview/public/data/users').doc(user.uid).get();
|
| 43 |
+
if (userDoc.exists) {
|
| 44 |
+
currentUserData = userDoc.data();
|
| 45 |
+
updateUI();
|
| 46 |
+
} else {
|
| 47 |
+
// Create new user doc if doesn't exist
|
| 48 |
+
currentUserData = {
|
| 49 |
+
name: user.email.split('@')[0],
|
| 50 |
+
email: user.email,
|
| 51 |
+
role: 'student',
|
| 52 |
+
beltLevel: 'White'
|
| 53 |
+
};
|
| 54 |
+
await db.collection('artifacts/tkquest-preview/public/data/users').doc(user.uid).set(currentUserData);
|
| 55 |
+
updateUI();
|
| 56 |
+
}
|
| 57 |
+
} else {
|
| 58 |
+
// User is signed out
|
| 59 |
+
authView.classList.remove('hidden');
|
| 60 |
+
mainAppView.classList.add('hidden');
|
| 61 |
+
}
|
| 62 |
+
});
|
| 63 |
+
|
| 64 |
+
// Auth handlers
|
| 65 |
+
loginForm.addEventListener('submit', async (e) => {
|
| 66 |
+
e.preventDefault();
|
| 67 |
+
const email = document.getElementById('login-email').value;
|
| 68 |
+
const password = document.getElementById('login-password').value;
|
| 69 |
+
|
| 70 |
+
try {
|
| 71 |
+
await auth.signInWithEmailAndPassword(email, password);
|
| 72 |
+
loginForm.reset();
|
| 73 |
+
} catch (error) {
|
| 74 |
+
document.getElementById('login-error').textContent = error.message;
|
| 75 |
+
document.getElementById('login-error').classList.remove('hidden');
|
| 76 |
+
}
|
| 77 |
+
});
|
| 78 |
+
|
| 79 |
+
registerForm.addEventListener('submit', async (e) => {
|
| 80 |
+
e.preventDefault();
|
| 81 |
+
const email = document.getElementById('register-email').value;
|
| 82 |
+
const password = document.getElementById('register-password').value;
|
| 83 |
+
const name = document.getElementById('register-name').value;
|
| 84 |
+
const beltLevel = document.getElementById('register-belt').value;
|
| 85 |
+
|
| 86 |
+
try {
|
| 87 |
+
const userCredential = await auth.createUserWithEmailAndPassword(email, password);
|
| 88 |
+
const user = userCredential.user;
|
| 89 |
+
|
| 90 |
+
// Create user document
|
| 91 |
+
await db.collection('artifacts/tkquest-preview/public/data/users').doc(user.uid).set({
|
| 92 |
+
name: name,
|
| 93 |
+
email: email,
|
| 94 |
+
role: 'student',
|
| 95 |
+
beltLevel: beltLevel,
|
| 96 |
+
createdAt: firebase.firestore.FieldValue.serverTimestamp()
|
| 97 |
+
});
|
| 98 |
+
|
| 99 |
+
// Initialize progress document
|
| 100 |
+
await db.collection('artifacts/tkquest-preview/public/data/progress').doc(user.uid).set({
|
| 101 |
+
completedLessonIds: [],
|
| 102 |
+
checklistProgress: {},
|
| 103 |
+
taskProgress: {},
|
| 104 |
+
challengeProgress: {}
|
| 105 |
+
});
|
| 106 |
+
|
| 107 |
+
registerForm.reset();
|
| 108 |
+
} catch (error) {
|
| 109 |
+
document.getElementById('register-error').textContent = error.message;
|
| 110 |
+
document.getElementById('register-error').classList.remove('hidden');
|
| 111 |
+
}
|
| 112 |
+
});
|
| 113 |
+
|
| 114 |
+
logoutBtn.addEventListener('click', () => {
|
| 115 |
+
auth.signOut();
|
| 116 |
+
});
|
| 117 |
+
|
| 118 |
+
// Sidebar toggle
|
| 119 |
+
sidebarToggleBtn.addEventListener('click', () => {
|
| 120 |
+
isSidebarCollapsed = !isSidebarCollapsed;
|
| 121 |
+
if (isSidebarCollapsed) {
|
| 122 |
+
sidebar.classList.remove('w-64');
|
| 123 |
+
sidebar.classList.add('w-16');
|
| 124 |
+
document.body.classList.add('sidebar-collapsed');
|
| 125 |
+
} else {
|
| 126 |
+
sidebar.classList.remove('w-16');
|
| 127 |
+
sidebar.classList.add('w-64');
|
| 128 |
+
document.body.classList.remove('sidebar-collapsed');
|
| 129 |
+
}
|
| 130 |
+
});
|
| 131 |
+
|
| 132 |
+
// Update UI based on user data
|
| 133 |
+
function updateUI() {
|
| 134 |
+
if (!currentUser || !currentUserData) return;
|
| 135 |
+
|
| 136 |
+
// Update user display
|
| 137 |
+
document.getElementById('user-display').textContent = `Hi, ${currentUserData.name}`;
|
| 138 |
+
document.getElementById('user-id-kbd').textContent = currentUser.uid.substring(0, 8);
|
| 139 |
+
document.getElementById('update-name').value = currentUserData.name;
|
| 140 |
+
|
| 141 |
+
// Update floating user info (student only)
|
| 142 |
+
if (currentUserData.role === 'student') {
|
| 143 |
+
document.getElementById('floating-user-info').classList.remove('hidden');
|
| 144 |
+
document.getElementById('float-user-name').textContent = currentUserData.name;
|
| 145 |
+
document.getElementById('float-user-belt').textContent = currentUserData.beltLevel;
|
| 146 |
+
document.getElementById('float-user-number').textContent = currentUser.uid.substring(0, 8);
|
| 147 |
+
} else {
|
| 148 |
+
document.getElementById('floating-user-info').classList.add('hidden');
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
// Setup sidebar menu
|
| 152 |
+
setupSidebarMenu();
|
| 153 |
+
|
| 154 |
+
// Show/hide instructor UI elements
|
| 155 |
+
toggleInstructorUI(currentUserData.role === 'instructor');
|
| 156 |
+
|
| 157 |
+
// Load initial data
|
| 158 |
+
loadInitialData();
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
// Setup sidebar menu
|
| 162 |
+
function setupSidebarMenu() {
|
| 163 |
+
const menu = document.getElementById('sidebar-menu');
|
| 164 |
+
if (!menu || !currentUserData) return;
|
| 165 |
+
|
| 166 |
+
const isInstructor = currentUserData.role === 'instructor';
|
| 167 |
+
let menuItems = [
|
| 168 |
+
{ id: 'dashboard-page', icon: 'dashboard', text: 'Dashboard' },
|
| 169 |
+
{ id: 'lessons-page', icon: 'curriculum', text: 'Curriculum' },
|
| 170 |
+
];
|
| 171 |
+
|
| 172 |
+
if (isInstructor) {
|
| 173 |
+
menuItems.push(
|
| 174 |
+
{ id: 'manage-users-page', icon: 'manage-users', text: 'Manage Students' }
|
| 175 |
+
);
|
| 176 |
+
} else {
|
| 177 |
+
menuItems.push(
|
| 178 |
+
{ id: 'my-progress-page', icon: 'progress', text: 'My Progress' }
|
| 179 |
+
);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
menuItems.push(
|
| 183 |
+
{ id: 'tasks-page', icon: 'tasks', text: 'Tasks & Exercises' },
|
| 184 |
+
{ id: 'events-page', icon: 'events', text: 'Events' },
|
| 185 |
+
{ id: 'settings-page', icon: 'settings', text: 'Settings' }
|
| 186 |
+
);
|
| 187 |
+
|
| 188 |
+
menu.innerHTML = menuItems.map(item => `
|
| 189 |
+
<li>
|
| 190 |
+
<a data-page="${item.id}" class="nav-link">
|
| 191 |
+
${ICONS[item.icon] || ''}
|
| 192 |
+
<span class="sidebar-link-text">${item.text}</span>
|
| 193 |
+
</a>
|
| 194 |
+
</li>
|
| 195 |
+
`).join('');
|
| 196 |
+
|
| 197 |
+
// Add click listeners to navigation links
|
| 198 |
+
document.querySelectorAll('.nav-link').forEach(link => {
|
| 199 |
+
link.addEventListener('click', (e) => {
|
| 200 |
+
e.preventDefault();
|
| 201 |
+
showPage(link.dataset.page);
|
| 202 |
+
});
|
| 203 |
+
});
|
| 204 |
+
|
| 205 |
+
// Show dashboard by default
|
| 206 |
+
showPage('dashboard-page');
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
// Show a specific page
|
| 210 |
+
function showPage(pageId) {
|
| 211 |
+
document.querySelectorAll('.app-page').forEach(page => {
|
| 212 |
+
page.classList.add('hidden');
|
| 213 |
+
});
|
| 214 |
+
|
| 215 |
+
const pageToShow = document.getElementById(pageId);
|
| 216 |
+
if (pageToShow) {
|
| 217 |
+
pageToShow.classList.remove('hidden');
|
| 218 |
+
document.getElementById('main-header').textContent = pageHeaders[pageId] || 'Dashboard';
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
// Toggle instructor UI elements
|
| 223 |
+
function toggleInstructorUI(isInstructor) {
|
| 224 |
+
document.querySelectorAll('[id^="instructor-actions"]').forEach(el => {
|
| 225 |
+
el.style.display = isInstructor ? 'flex' : 'none';
|
| 226 |
+
});
|
| 227 |
+
document.getElementById('dashboard-progress-overview').style.display = isInstructor ? 'none' : 'block';
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
// Load initial data
|
| 231 |
+
function loadInitialData() {
|
| 232 |
+
// Implement data loading as needed
|
| 233 |
+
// This would include setting up Firestore listeners for:
|
| 234 |
+
// - Announcements
|
| 235 |
+
// - Lessons
|
| 236 |
+
// - Topics
|
| 237 |
+
// - Events
|
| 238 |
+
// - Quizzes
|
| 239 |
+
// - Tasks
|
| 240 |
+
// - Challenges
|
| 241 |
+
// - User progress
|
| 242 |
+
// - Student list (for instructors)
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
// ICONS constant (copied from original)
|
| 246 |
+
const ICONS = {
|
| 247 |
+
// ... (same as in original)
|
| 248 |
+
};
|
| 249 |
+
|
| 250 |
+
// Page headers constant
|
| 251 |
+
const pageHeaders = {
|
| 252 |
+
'dashboard-page': 'Dashboard',
|
| 253 |
+
'lessons-page': 'Curriculum',
|
| 254 |
+
'my-progress-page': 'My Progress',
|
| 255 |
+
'tasks-page': 'Tasks & Exercises',
|
| 256 |
+
'events-page': 'Events',
|
| 257 |
+
'manage-users-page': 'Manage Users',
|
| 258 |
+
'settings-page': 'Settings'
|
| 259 |
+
};
|
| 260 |
+
|
| 261 |
+
// Initialize the app
|
| 262 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 263 |
+
// Sidebar initially expanded
|
| 264 |
+
sidebar.classList.add('w-64');
|
| 265 |
+
document.body.classList.remove('sidebar-collapsed');
|
| 266 |
+
});
|