Spaces:
Running
Running
Make a cool website to keep track of your tests and also when to start studying for them - Initial Deployment
Browse files- README.md +7 -5
- index.html +740 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 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: test-tracker
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,740 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ExamTrack - Test Tracker</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<script>
|
| 10 |
+
tailwind.config = {
|
| 11 |
+
theme: {
|
| 12 |
+
extend: {
|
| 13 |
+
colors: {
|
| 14 |
+
primary: '#4F46E5',
|
| 15 |
+
secondary: '#10B981',
|
| 16 |
+
danger: '#EF4444',
|
| 17 |
+
warning: '#F59E0B'
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
</script>
|
| 23 |
+
<style>
|
| 24 |
+
.gradient-bg {
|
| 25 |
+
background: linear-gradient(135deg, #4F46E5 0%, #10B981 100%);
|
| 26 |
+
}
|
| 27 |
+
.progress-bar {
|
| 28 |
+
transition: width 0.5s ease-in-out;
|
| 29 |
+
}
|
| 30 |
+
.fade-in {
|
| 31 |
+
animation: fadeIn 0.3s ease-in-out;
|
| 32 |
+
}
|
| 33 |
+
@keyframes fadeIn {
|
| 34 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 35 |
+
to { opacity: 1; transform: translateY(0); }
|
| 36 |
+
}
|
| 37 |
+
.card-hover:hover {
|
| 38 |
+
transform: translateY(-5px);
|
| 39 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
| 40 |
+
}
|
| 41 |
+
</style>
|
| 42 |
+
</head>
|
| 43 |
+
<body class="bg-gray-50 min-h-screen">
|
| 44 |
+
<!-- Header -->
|
| 45 |
+
<header class="gradient-bg text-white shadow-lg">
|
| 46 |
+
<div class="container mx-auto px-4 py-6">
|
| 47 |
+
<div class="flex justify-between items-center">
|
| 48 |
+
<div class="flex items-center space-x-2">
|
| 49 |
+
<i class="fas fa-book-open text-2xl"></i>
|
| 50 |
+
<h1 class="text-2xl font-bold">ExamTrack</h1>
|
| 51 |
+
</div>
|
| 52 |
+
<div class="flex items-center space-x-4">
|
| 53 |
+
<button id="theme-toggle" class="p-2 rounded-full bg-white bg-opacity-10 hover:bg-opacity-20 transition">
|
| 54 |
+
<i class="fas fa-moon"></i>
|
| 55 |
+
</button>
|
| 56 |
+
<div class="relative">
|
| 57 |
+
<img src="https://ui-avatars.com/api/?name=User&background=random" alt="User" class="w-10 h-10 rounded-full cursor-pointer">
|
| 58 |
+
</div>
|
| 59 |
+
</div>
|
| 60 |
+
</div>
|
| 61 |
+
</div>
|
| 62 |
+
</header>
|
| 63 |
+
|
| 64 |
+
<!-- Main Content -->
|
| 65 |
+
<main class="container mx-auto px-4 py-8">
|
| 66 |
+
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
| 67 |
+
<!-- Left Column -->
|
| 68 |
+
<div class="lg:col-span-2 space-y-6">
|
| 69 |
+
<!-- Add Test Form -->
|
| 70 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden transition-all duration-300 card-hover">
|
| 71 |
+
<div class="p-6">
|
| 72 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Add New Test</h2>
|
| 73 |
+
<form id="add-test-form" class="space-y-4">
|
| 74 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 75 |
+
<div>
|
| 76 |
+
<label for="test-name" class="block text-sm font-medium text-gray-700 mb-1">Test Name</label>
|
| 77 |
+
<input type="text" id="test-name" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="e.g. Biology Midterm" required>
|
| 78 |
+
</div>
|
| 79 |
+
<div>
|
| 80 |
+
<label for="test-subject" class="block text-sm font-medium text-gray-700 mb-1">Subject</label>
|
| 81 |
+
<input type="text" id="test-subject" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="e.g. Biology" required>
|
| 82 |
+
</div>
|
| 83 |
+
</div>
|
| 84 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 85 |
+
<div>
|
| 86 |
+
<label for="test-date" class="block text-sm font-medium text-gray-700 mb-1">Test Date</label>
|
| 87 |
+
<input type="date" id="test-date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" required>
|
| 88 |
+
</div>
|
| 89 |
+
<div>
|
| 90 |
+
<label for="study-days" class="block text-sm font-medium text-gray-700 mb-1">Days Needed to Study</label>
|
| 91 |
+
<input type="number" id="study-days" min="1" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="e.g. 14" required>
|
| 92 |
+
</div>
|
| 93 |
+
</div>
|
| 94 |
+
<div>
|
| 95 |
+
<label for="test-notes" class="block text-sm font-medium text-gray-700 mb-1">Notes</label>
|
| 96 |
+
<textarea id="test-notes" rows="2" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="Any important details..."></textarea>
|
| 97 |
+
</div>
|
| 98 |
+
<div class="flex justify-end">
|
| 99 |
+
<button type="submit" class="px-6 py-2 bg-primary text-white font-medium rounded-lg hover:bg-opacity-90 transition flex items-center space-x-2">
|
| 100 |
+
<i class="fas fa-plus"></i>
|
| 101 |
+
<span>Add Test</span>
|
| 102 |
+
</button>
|
| 103 |
+
</div>
|
| 104 |
+
</form>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
<!-- Upcoming Tests -->
|
| 109 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden transition-all duration-300 card-hover">
|
| 110 |
+
<div class="p-6">
|
| 111 |
+
<div class="flex justify-between items-center mb-4">
|
| 112 |
+
<h2 class="text-xl font-semibold text-gray-800">Upcoming Tests</h2>
|
| 113 |
+
<div class="flex space-x-2">
|
| 114 |
+
<button id="sort-date" class="px-3 py-1 text-sm bg-gray-100 rounded-lg hover:bg-gray-200 transition">Sort by Date</button>
|
| 115 |
+
<button id="sort-priority" class="px-3 py-1 text-sm bg-gray-100 rounded-lg hover:bg-gray-200 transition">Sort by Priority</button>
|
| 116 |
+
</div>
|
| 117 |
+
</div>
|
| 118 |
+
<div id="upcoming-tests" class="space-y-4">
|
| 119 |
+
<!-- Test items will be added here dynamically -->
|
| 120 |
+
<div class="text-center py-8 text-gray-500" id="no-tests-message">
|
| 121 |
+
<i class="fas fa-calendar-check text-4xl mb-3"></i>
|
| 122 |
+
<p>No upcoming tests. Add a test to get started!</p>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
</div>
|
| 126 |
+
</div>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<!-- Right Column -->
|
| 130 |
+
<div class="space-y-6">
|
| 131 |
+
<!-- Study Timeline -->
|
| 132 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden transition-all duration-300 card-hover">
|
| 133 |
+
<div class="p-6">
|
| 134 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Study Timeline</h2>
|
| 135 |
+
<div id="study-timeline" class="space-y-4">
|
| 136 |
+
<div class="text-center py-8 text-gray-500">
|
| 137 |
+
<i class="fas fa-clock text-4xl mb-3"></i>
|
| 138 |
+
<p>Add a test to see your study timeline</p>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
|
| 144 |
+
<!-- Progress Stats -->
|
| 145 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden transition-all duration-300 card-hover">
|
| 146 |
+
<div class="p-6">
|
| 147 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Your Progress</h2>
|
| 148 |
+
<div class="space-y-4">
|
| 149 |
+
<div>
|
| 150 |
+
<div class="flex justify-between mb-1">
|
| 151 |
+
<span class="text-sm font-medium text-gray-700">Tests Completed</span>
|
| 152 |
+
<span class="text-sm font-medium text-gray-700" id="completed-count">0</span>
|
| 153 |
+
</div>
|
| 154 |
+
<div class="w-full bg-gray-200 rounded-full h-2.5">
|
| 155 |
+
<div id="completed-bar" class="bg-secondary h-2.5 rounded-full progress-bar" style="width: 0%"></div>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
<div>
|
| 159 |
+
<div class="flex justify-between mb-1">
|
| 160 |
+
<span class="text-sm font-medium text-gray-700">Tests Pending</span>
|
| 161 |
+
<span class="text-sm font-medium text-gray-700" id="pending-count">0</span>
|
| 162 |
+
</div>
|
| 163 |
+
<div class="w-full bg-gray-200 rounded-full h-2.5">
|
| 164 |
+
<div id="pending-bar" class="bg-warning h-2.5 rounded-full progress-bar" style="width: 0%"></div>
|
| 165 |
+
</div>
|
| 166 |
+
</div>
|
| 167 |
+
<div>
|
| 168 |
+
<div class="flex justify-between mb-1">
|
| 169 |
+
<span class="text-sm font-medium text-gray-700">Study Days Remaining</span>
|
| 170 |
+
<span class="text-sm font-medium text-gray-700" id="study-days-remaining">0</span>
|
| 171 |
+
</div>
|
| 172 |
+
<div class="w-full bg-gray-200 rounded-full h-2.5">
|
| 173 |
+
<div id="study-days-bar" class="bg-primary h-2.5 rounded-full progress-bar" style="width: 0%"></div>
|
| 174 |
+
</div>
|
| 175 |
+
</div>
|
| 176 |
+
</div>
|
| 177 |
+
</div>
|
| 178 |
+
</div>
|
| 179 |
+
|
| 180 |
+
<!-- Quick Actions -->
|
| 181 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden transition-all duration-300 card-hover">
|
| 182 |
+
<div class="p-6">
|
| 183 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Quick Actions</h2>
|
| 184 |
+
<div class="grid grid-cols-2 gap-3">
|
| 185 |
+
<button id="mark-completed" class="p-3 bg-green-50 text-green-700 rounded-lg hover:bg-green-100 transition flex flex-col items-center">
|
| 186 |
+
<i class="fas fa-check-circle text-2xl mb-1"></i>
|
| 187 |
+
<span class="text-sm">Mark Completed</span>
|
| 188 |
+
</button>
|
| 189 |
+
<button id="add-reminder" class="p-3 bg-blue-50 text-blue-700 rounded-lg hover:bg-blue-100 transition flex flex-col items-center">
|
| 190 |
+
<i class="fas fa-bell text-2xl mb-1"></i>
|
| 191 |
+
<span class="text-sm">Add Reminder</span>
|
| 192 |
+
</button>
|
| 193 |
+
<button id="export-data" class="p-3 bg-purple-50 text-purple-700 rounded-lg hover:bg-purple-100 transition flex flex-col items-center">
|
| 194 |
+
<i class="fas fa-file-export text-2xl mb-1"></i>
|
| 195 |
+
<span class="text-sm">Export Data</span>
|
| 196 |
+
</button>
|
| 197 |
+
<button id="import-data" class="p-3 bg-yellow-50 text-yellow-700 rounded-lg hover:bg-yellow-100 transition flex flex-col items-center">
|
| 198 |
+
<i class="fas fa-file-import text-2xl mb-1"></i>
|
| 199 |
+
<span class="text-sm">Import Data</span>
|
| 200 |
+
</button>
|
| 201 |
+
</div>
|
| 202 |
+
</div>
|
| 203 |
+
</div>
|
| 204 |
+
</div>
|
| 205 |
+
</div>
|
| 206 |
+
</main>
|
| 207 |
+
|
| 208 |
+
<!-- Modal -->
|
| 209 |
+
<div id="test-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
|
| 210 |
+
<div class="bg-white rounded-xl shadow-xl w-full max-w-md mx-4 fade-in">
|
| 211 |
+
<div class="p-6">
|
| 212 |
+
<div class="flex justify-between items-center mb-4">
|
| 213 |
+
<h3 id="modal-title" class="text-xl font-semibold text-gray-800">Test Details</h3>
|
| 214 |
+
<button id="close-modal" class="text-gray-500 hover:text-gray-700">
|
| 215 |
+
<i class="fas fa-times"></i>
|
| 216 |
+
</button>
|
| 217 |
+
</div>
|
| 218 |
+
<div id="modal-content" class="space-y-4">
|
| 219 |
+
<!-- Content will be filled dynamically -->
|
| 220 |
+
</div>
|
| 221 |
+
</div>
|
| 222 |
+
</div>
|
| 223 |
+
</div>
|
| 224 |
+
|
| 225 |
+
<script>
|
| 226 |
+
// Sample data structure
|
| 227 |
+
let tests = JSON.parse(localStorage.getItem('tests')) || [];
|
| 228 |
+
let completedTests = JSON.parse(localStorage.getItem('completedTests')) || [];
|
| 229 |
+
|
| 230 |
+
// DOM Elements
|
| 231 |
+
const addTestForm = document.getElementById('add-test-form');
|
| 232 |
+
const upcomingTestsContainer = document.getElementById('upcoming-tests');
|
| 233 |
+
const noTestsMessage = document.getElementById('no-tests-message');
|
| 234 |
+
const studyTimelineContainer = document.getElementById('study-timeline');
|
| 235 |
+
const completedCount = document.getElementById('completed-count');
|
| 236 |
+
const pendingCount = document.getElementById('pending-count');
|
| 237 |
+
const studyDaysRemaining = document.getElementById('study-days-remaining');
|
| 238 |
+
const completedBar = document.getElementById('completed-bar');
|
| 239 |
+
const pendingBar = document.getElementById('pending-bar');
|
| 240 |
+
const studyDaysBar = document.getElementById('study-days-bar');
|
| 241 |
+
const testModal = document.getElementById('test-modal');
|
| 242 |
+
const closeModal = document.getElementById('close-modal');
|
| 243 |
+
const modalTitle = document.getElementById('modal-title');
|
| 244 |
+
const modalContent = document.getElementById('modal-content');
|
| 245 |
+
const themeToggle = document.getElementById('theme-toggle');
|
| 246 |
+
const sortDateBtn = document.getElementById('sort-date');
|
| 247 |
+
const sortPriorityBtn = document.getElementById('sort-priority');
|
| 248 |
+
|
| 249 |
+
// Initialize the app
|
| 250 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 251 |
+
renderTests();
|
| 252 |
+
updateStats();
|
| 253 |
+
checkDarkModePreference();
|
| 254 |
+
|
| 255 |
+
// Set minimum date to today
|
| 256 |
+
const today = new Date().toISOString().split('T')[0];
|
| 257 |
+
document.getElementById('test-date').min = today;
|
| 258 |
+
});
|
| 259 |
+
|
| 260 |
+
// Event Listeners
|
| 261 |
+
addTestForm.addEventListener('submit', handleAddTest);
|
| 262 |
+
closeModal.addEventListener('click', () => testModal.classList.add('hidden'));
|
| 263 |
+
themeToggle.addEventListener('click', toggleDarkMode);
|
| 264 |
+
sortDateBtn.addEventListener('click', () => sortTests('date'));
|
| 265 |
+
sortPriorityBtn.addEventListener('click', () => sortTests('priority'));
|
| 266 |
+
|
| 267 |
+
// Functions
|
| 268 |
+
function handleAddTest(e) {
|
| 269 |
+
e.preventDefault();
|
| 270 |
+
|
| 271 |
+
const testName = document.getElementById('test-name').value;
|
| 272 |
+
const testSubject = document.getElementById('test-subject').value;
|
| 273 |
+
const testDate = document.getElementById('test-date').value;
|
| 274 |
+
const studyDays = parseInt(document.getElementById('study-days').value);
|
| 275 |
+
const testNotes = document.getElementById('test-notes').value;
|
| 276 |
+
|
| 277 |
+
const studyStartDate = calculateStudyStartDate(testDate, studyDays);
|
| 278 |
+
|
| 279 |
+
const newTest = {
|
| 280 |
+
id: Date.now(),
|
| 281 |
+
name: testName,
|
| 282 |
+
subject: testSubject,
|
| 283 |
+
date: testDate,
|
| 284 |
+
studyDays: studyDays,
|
| 285 |
+
studyStartDate: studyStartDate,
|
| 286 |
+
notes: testNotes,
|
| 287 |
+
priority: calculatePriority(testDate, studyDays),
|
| 288 |
+
completed: false
|
| 289 |
+
};
|
| 290 |
+
|
| 291 |
+
tests.push(newTest);
|
| 292 |
+
saveTests();
|
| 293 |
+
renderTests();
|
| 294 |
+
updateStats();
|
| 295 |
+
|
| 296 |
+
// Reset form
|
| 297 |
+
addTestForm.reset();
|
| 298 |
+
|
| 299 |
+
// Show success message
|
| 300 |
+
showToast('Test added successfully!', 'success');
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
function calculateStudyStartDate(testDate, studyDays) {
|
| 304 |
+
const date = new Date(testDate);
|
| 305 |
+
date.setDate(date.getDate() - studyDays);
|
| 306 |
+
return date.toISOString().split('T')[0];
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
function calculatePriority(testDate, studyDays) {
|
| 310 |
+
const today = new Date();
|
| 311 |
+
const testDateObj = new Date(testDate);
|
| 312 |
+
const daysUntilTest = Math.ceil((testDateObj - today) / (1000 * 60 * 60 * 24));
|
| 313 |
+
|
| 314 |
+
if (daysUntilTest <= studyDays) {
|
| 315 |
+
return 'high'; // Should have started studying already
|
| 316 |
+
} else if (daysUntilTest <= studyDays + 7) {
|
| 317 |
+
return 'medium'; // Should start studying soon
|
| 318 |
+
} else {
|
| 319 |
+
return 'low'; // Plenty of time
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
function renderTests() {
|
| 324 |
+
if (tests.length === 0) {
|
| 325 |
+
noTestsMessage.classList.remove('hidden');
|
| 326 |
+
upcomingTestsContainer.innerHTML = '';
|
| 327 |
+
upcomingTestsContainer.appendChild(noTestsMessage);
|
| 328 |
+
renderStudyTimeline();
|
| 329 |
+
return;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
noTestsMessage.classList.add('hidden');
|
| 333 |
+
upcomingTestsContainer.innerHTML = '';
|
| 334 |
+
|
| 335 |
+
// Sort tests by date (soonest first)
|
| 336 |
+
const sortedTests = [...tests].sort((a, b) => new Date(a.date) - new Date(b.date));
|
| 337 |
+
|
| 338 |
+
sortedTests.forEach(test => {
|
| 339 |
+
const testElement = createTestElement(test);
|
| 340 |
+
upcomingTestsContainer.appendChild(testElement);
|
| 341 |
+
});
|
| 342 |
+
|
| 343 |
+
renderStudyTimeline();
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
function createTestElement(test) {
|
| 347 |
+
const today = new Date();
|
| 348 |
+
const testDate = new Date(test.date);
|
| 349 |
+
const daysUntilTest = Math.ceil((testDate - today) / (1000 * 60 * 60 * 24));
|
| 350 |
+
const studyStartDate = new Date(test.studyStartDate);
|
| 351 |
+
const daysUntilStudy = Math.ceil((studyStartDate - today) / (1000 * 60 * 60 * 24));
|
| 352 |
+
|
| 353 |
+
const testElement = document.createElement('div');
|
| 354 |
+
testElement.className = 'bg-gray-50 rounded-lg p-4 border border-gray-200 fade-in';
|
| 355 |
+
testElement.dataset.id = test.id;
|
| 356 |
+
|
| 357 |
+
let priorityBadge = '';
|
| 358 |
+
if (test.priority === 'high') {
|
| 359 |
+
priorityBadge = '<span class="px-2 py-1 text-xs font-semibold bg-danger text-white rounded-full">High Priority</span>';
|
| 360 |
+
} else if (test.priority === 'medium') {
|
| 361 |
+
priorityBadge = '<span class="px-2 py-1 text-xs font-semibold bg-warning text-white rounded-full">Medium Priority</span>';
|
| 362 |
+
} else {
|
| 363 |
+
priorityBadge = '<span class="px-2 py-1 text-xs font-semibold bg-secondary text-white rounded-full">Low Priority</span>';
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
testElement.innerHTML = `
|
| 367 |
+
<div class="flex justify-between items-start mb-2">
|
| 368 |
+
<h3 class="font-semibold text-gray-800">${test.name}</h3>
|
| 369 |
+
${priorityBadge}
|
| 370 |
+
</div>
|
| 371 |
+
<div class="flex items-center text-sm text-gray-600 mb-2">
|
| 372 |
+
<i class="fas fa-book mr-2"></i>
|
| 373 |
+
<span>${test.subject}</span>
|
| 374 |
+
</div>
|
| 375 |
+
<div class="flex items-center text-sm text-gray-600 mb-3">
|
| 376 |
+
<i class="fas fa-calendar-day mr-2"></i>
|
| 377 |
+
<span>${formatDate(test.date)} (${daysUntilTest} ${daysUntilTest === 1 ? 'day' : 'days'} away)</span>
|
| 378 |
+
</div>
|
| 379 |
+
<div class="flex justify-between items-center">
|
| 380 |
+
<button class="view-details px-3 py-1 text-sm bg-primary text-white rounded-lg hover:bg-opacity-90 transition">
|
| 381 |
+
View Details
|
| 382 |
+
</button>
|
| 383 |
+
<div class="flex space-x-2">
|
| 384 |
+
<button class="edit-test p-2 text-gray-500 hover:text-primary transition">
|
| 385 |
+
<i class="fas fa-edit"></i>
|
| 386 |
+
</button>
|
| 387 |
+
<button class="delete-test p-2 text-gray-500 hover:text-danger transition">
|
| 388 |
+
<i class="fas fa-trash-alt"></i>
|
| 389 |
+
</button>
|
| 390 |
+
</div>
|
| 391 |
+
</div>
|
| 392 |
+
`;
|
| 393 |
+
|
| 394 |
+
// Add event listeners to buttons
|
| 395 |
+
testElement.querySelector('.view-details').addEventListener('click', () => showTestDetails(test));
|
| 396 |
+
testElement.querySelector('.edit-test').addEventListener('click', (e) => {
|
| 397 |
+
e.stopPropagation();
|
| 398 |
+
editTest(test.id);
|
| 399 |
+
});
|
| 400 |
+
testElement.querySelector('.delete-test').addEventListener('click', (e) => {
|
| 401 |
+
e.stopPropagation();
|
| 402 |
+
deleteTest(test.id);
|
| 403 |
+
});
|
| 404 |
+
|
| 405 |
+
return testElement;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
function renderStudyTimeline() {
|
| 409 |
+
if (tests.length === 0) {
|
| 410 |
+
studyTimelineContainer.innerHTML = `
|
| 411 |
+
<div class="text-center py-8 text-gray-500">
|
| 412 |
+
<i class="fas fa-clock text-4xl mb-3"></i>
|
| 413 |
+
<p>Add a test to see your study timeline</p>
|
| 414 |
+
</div>
|
| 415 |
+
`;
|
| 416 |
+
return;
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
// Sort tests by study start date (earliest first)
|
| 420 |
+
const sortedTests = [...tests].sort((a, b) => new Date(a.studyStartDate) - new Date(b.studyStartDate));
|
| 421 |
+
|
| 422 |
+
studyTimelineContainer.innerHTML = '';
|
| 423 |
+
|
| 424 |
+
sortedTests.forEach(test => {
|
| 425 |
+
const today = new Date();
|
| 426 |
+
const studyStartDate = new Date(test.studyStartDate);
|
| 427 |
+
const daysUntilStudy = Math.ceil((studyStartDate - today) / (1000 * 60 * 60 * 24));
|
| 428 |
+
|
| 429 |
+
const timelineItem = document.createElement('div');
|
| 430 |
+
timelineItem.className = 'fade-in';
|
| 431 |
+
|
| 432 |
+
timelineItem.innerHTML = `
|
| 433 |
+
<div class="flex items-start">
|
| 434 |
+
<div class="flex flex-col items-center mr-3">
|
| 435 |
+
<div class="w-8 h-8 rounded-full bg-primary flex items-center justify-center text-white">
|
| 436 |
+
<i class="fas fa-book text-sm"></i>
|
| 437 |
+
</div>
|
| 438 |
+
<div class="w-0.5 h-12 bg-gray-200 mt-1"></div>
|
| 439 |
+
</div>
|
| 440 |
+
<div class="flex-1 pt-1">
|
| 441 |
+
<h4 class="font-medium text-gray-800">${test.name}</h4>
|
| 442 |
+
<p class="text-sm text-gray-600 mb-1">${test.subject}</p>
|
| 443 |
+
<div class="flex items-center text-sm ${daysUntilStudy <= 0 ? 'text-danger' : 'text-gray-500'}">
|
| 444 |
+
<i class="fas fa-calendar-day mr-1"></i>
|
| 445 |
+
<span>Start studying ${formatDate(test.studyStartDate)} (${daysUntilStudy <= 0 ? 'Start now!' : daysUntilStudy + ' days'})</span>
|
| 446 |
+
</div>
|
| 447 |
+
</div>
|
| 448 |
+
</div>
|
| 449 |
+
`;
|
| 450 |
+
|
| 451 |
+
studyTimelineContainer.appendChild(timelineItem);
|
| 452 |
+
});
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
function showTestDetails(test) {
|
| 456 |
+
const today = new Date();
|
| 457 |
+
const testDate = new Date(test.date);
|
| 458 |
+
const daysUntilTest = Math.ceil((testDate - today) / (1000 * 60 * 60 * 24));
|
| 459 |
+
const studyStartDate = new Date(test.studyStartDate);
|
| 460 |
+
const daysUntilStudy = Math.ceil((studyStartDate - today) / (1000 * 60 * 60 * 24));
|
| 461 |
+
|
| 462 |
+
modalTitle.textContent = test.name;
|
| 463 |
+
|
| 464 |
+
let priorityText = '';
|
| 465 |
+
if (test.priority === 'high') {
|
| 466 |
+
priorityText = 'High Priority - Start studying now!';
|
| 467 |
+
} else if (test.priority === 'medium') {
|
| 468 |
+
priorityText = 'Medium Priority - Start studying soon';
|
| 469 |
+
} else {
|
| 470 |
+
priorityText = 'Low Priority - You have plenty of time';
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
modalContent.innerHTML = `
|
| 474 |
+
<div class="space-y-4">
|
| 475 |
+
<div class="flex items-center text-gray-700">
|
| 476 |
+
<i class="fas fa-book mr-3 w-5 text-center"></i>
|
| 477 |
+
<span>Subject: ${test.subject}</span>
|
| 478 |
+
</div>
|
| 479 |
+
<div class="flex items-center text-gray-700">
|
| 480 |
+
<i class="fas fa-calendar-day mr-3 w-5 text-center"></i>
|
| 481 |
+
<span>Test Date: ${formatDate(test.date)} (${daysUntilTest} ${daysUntilTest === 1 ? 'day' : 'days'} away)</span>
|
| 482 |
+
</div>
|
| 483 |
+
<div class="flex items-center text-gray-700">
|
| 484 |
+
<i class="fas fa-clock mr-3 w-5 text-center"></i>
|
| 485 |
+
<span>Study Days Needed: ${test.studyDays}</span>
|
| 486 |
+
</div>
|
| 487 |
+
<div class="flex items-center ${test.priority === 'high' ? 'text-danger' : test.priority === 'medium' ? 'text-warning' : 'text-secondary'}">
|
| 488 |
+
<i class="fas fa-exclamation-circle mr-3 w-5 text-center"></i>
|
| 489 |
+
<span>${priorityText}</span>
|
| 490 |
+
</div>
|
| 491 |
+
<div class="flex items-center text-gray-700">
|
| 492 |
+
<i class="fas fa-calendar-check mr-3 w-5 text-center"></i>
|
| 493 |
+
<span>Start Studying: ${formatDate(test.studyStartDate)} (${daysUntilStudy <= 0 ? 'Start now!' : daysUntilStudy + ' days'})</span>
|
| 494 |
+
</div>
|
| 495 |
+
${test.notes ? `
|
| 496 |
+
<div>
|
| 497 |
+
<h4 class="font-medium text-gray-800 mb-1">Notes:</h4>
|
| 498 |
+
<p class="text-gray-700 bg-gray-50 p-3 rounded-lg">${test.notes}</p>
|
| 499 |
+
</div>
|
| 500 |
+
` : ''}
|
| 501 |
+
<div class="pt-4 flex justify-between">
|
| 502 |
+
<button id="mark-as-completed" class="px-4 py-2 bg-secondary text-white rounded-lg hover:bg-opacity-90 transition">
|
| 503 |
+
Mark as Completed
|
| 504 |
+
</button>
|
| 505 |
+
<button id="add-reminder-btn" class="px-4 py-2 bg-primary text-white rounded-lg hover:bg-opacity-90 transition">
|
| 506 |
+
<i class="fas fa-bell mr-1"></i> Add Reminder
|
| 507 |
+
</button>
|
| 508 |
+
</div>
|
| 509 |
+
</div>
|
| 510 |
+
`;
|
| 511 |
+
|
| 512 |
+
// Add event listeners to modal buttons
|
| 513 |
+
document.getElementById('mark-as-completed').addEventListener('click', () => {
|
| 514 |
+
markTestAsCompleted(test.id);
|
| 515 |
+
testModal.classList.add('hidden');
|
| 516 |
+
});
|
| 517 |
+
|
| 518 |
+
document.getElementById('add-reminder-btn').addEventListener('click', () => {
|
| 519 |
+
addReminderForTest(test);
|
| 520 |
+
testModal.classList.add('hidden');
|
| 521 |
+
});
|
| 522 |
+
|
| 523 |
+
testModal.classList.remove('hidden');
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
function editTest(testId) {
|
| 527 |
+
const test = tests.find(t => t.id === testId);
|
| 528 |
+
if (!test) return;
|
| 529 |
+
|
| 530 |
+
modalTitle.textContent = `Edit ${test.name}`;
|
| 531 |
+
|
| 532 |
+
modalContent.innerHTML = `
|
| 533 |
+
<form id="edit-test-form" class="space-y-4">
|
| 534 |
+
<div>
|
| 535 |
+
<label for="edit-test-name" class="block text-sm font-medium text-gray-700 mb-1">Test Name</label>
|
| 536 |
+
<input type="text" id="edit-test-name" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" value="${test.name}" required>
|
| 537 |
+
</div>
|
| 538 |
+
<div>
|
| 539 |
+
<label for="edit-test-subject" class="block text-sm font-medium text-gray-700 mb-1">Subject</label>
|
| 540 |
+
<input type="text" id="edit-test-subject" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" value="${test.subject}" required>
|
| 541 |
+
</div>
|
| 542 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 543 |
+
<div>
|
| 544 |
+
<label for="edit-test-date" class="block text-sm font-medium text-gray-700 mb-1">Test Date</label>
|
| 545 |
+
<input type="date" id="edit-test-date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" value="${test.date}" required>
|
| 546 |
+
</div>
|
| 547 |
+
<div>
|
| 548 |
+
<label for="edit-study-days" class="block text-sm font-medium text-gray-700 mb-1">Days Needed to Study</label>
|
| 549 |
+
<input type="number" id="edit-study-days" min="1" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" value="${test.studyDays}" required>
|
| 550 |
+
</div>
|
| 551 |
+
</div>
|
| 552 |
+
<div>
|
| 553 |
+
<label for="edit-test-notes" class="block text-sm font-medium text-gray-700 mb-1">Notes</label>
|
| 554 |
+
<textarea id="edit-test-notes" rows="3" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent">${test.notes || ''}</textarea>
|
| 555 |
+
</div>
|
| 556 |
+
<div class="flex justify-between pt-2">
|
| 557 |
+
<button type="button" id="cancel-edit" class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-100 transition">
|
| 558 |
+
Cancel
|
| 559 |
+
</button>
|
| 560 |
+
<button type="submit" class="px-6 py-2 bg-primary text-white font-medium rounded-lg hover:bg-opacity-90 transition">
|
| 561 |
+
Save Changes
|
| 562 |
+
</button>
|
| 563 |
+
</div>
|
| 564 |
+
</form>
|
| 565 |
+
`;
|
| 566 |
+
|
| 567 |
+
const editForm = document.getElementById('edit-test-form');
|
| 568 |
+
const cancelEdit = document.getElementById('cancel-edit');
|
| 569 |
+
|
| 570 |
+
editForm.addEventListener('submit', (e) => {
|
| 571 |
+
e.preventDefault();
|
| 572 |
+
|
| 573 |
+
test.name = document.getElementById('edit-test-name').value;
|
| 574 |
+
test.subject = document.getElementById('edit-test-subject').value;
|
| 575 |
+
test.date = document.getElementById('edit-test-date').value;
|
| 576 |
+
test.studyDays = parseInt(document.getElementById('edit-study-days').value);
|
| 577 |
+
test.notes = document.getElementById('edit-test-notes').value;
|
| 578 |
+
test.studyStartDate = calculateStudyStartDate(test.date, test.studyDays);
|
| 579 |
+
test.priority = calculatePriority(test.date, test.studyDays);
|
| 580 |
+
|
| 581 |
+
saveTests();
|
| 582 |
+
renderTests();
|
| 583 |
+
updateStats();
|
| 584 |
+
testModal.classList.add('hidden');
|
| 585 |
+
|
| 586 |
+
showToast('Test updated successfully!', 'success');
|
| 587 |
+
});
|
| 588 |
+
|
| 589 |
+
cancelEdit.addEventListener('click', () => {
|
| 590 |
+
testModal.classList.add('hidden');
|
| 591 |
+
});
|
| 592 |
+
|
| 593 |
+
testModal.classList.remove('hidden');
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
function deleteTest(testId) {
|
| 597 |
+
if (confirm('Are you sure you want to delete this test?')) {
|
| 598 |
+
tests = tests.filter(test => test.id !== testId);
|
| 599 |
+
saveTests();
|
| 600 |
+
renderTests();
|
| 601 |
+
updateStats();
|
| 602 |
+
showToast('Test deleted successfully!', 'success');
|
| 603 |
+
}
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
function markTestAsCompleted(testId) {
|
| 607 |
+
const testIndex = tests.findIndex(t => t.id === testId);
|
| 608 |
+
if (testIndex === -1) return;
|
| 609 |
+
|
| 610 |
+
const completedTest = tests[testIndex];
|
| 611 |
+
completedTest.completed = true;
|
| 612 |
+
completedTest.completedDate = new Date().toISOString().split('T')[0];
|
| 613 |
+
|
| 614 |
+
tests.splice(testIndex, 1);
|
| 615 |
+
completedTests.push(completedTest);
|
| 616 |
+
|
| 617 |
+
saveTests();
|
| 618 |
+
saveCompletedTests();
|
| 619 |
+
renderTests();
|
| 620 |
+
updateStats();
|
| 621 |
+
|
| 622 |
+
showToast('Test marked as completed!', 'success');
|
| 623 |
+
}
|
| 624 |
+
|
| 625 |
+
function addReminderForTest(test) {
|
| 626 |
+
// In a real app, this would integrate with a calendar API
|
| 627 |
+
alert(`Reminder added for ${test.name} on ${formatDate(test.studyStartDate)}`);
|
| 628 |
+
showToast('Reminder added to your calendar!', 'success');
|
| 629 |
+
}
|
| 630 |
+
|
| 631 |
+
function sortTests(criteria) {
|
| 632 |
+
if (criteria === 'date') {
|
| 633 |
+
tests.sort((a, b) => new Date(a.date) - new Date(b.date));
|
| 634 |
+
showToast('Tests sorted by date', 'info');
|
| 635 |
+
} else if (criteria === 'priority') {
|
| 636 |
+
const priorityOrder = { 'high': 1, 'medium': 2, 'low': 3 };
|
| 637 |
+
tests.sort((a, b) => priorityOrder[a.priority] - priorityOrder[b.priority]);
|
| 638 |
+
showToast('Tests sorted by priority', 'info');
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
renderTests();
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
function updateStats() {
|
| 645 |
+
const totalTests = tests.length + completedTests.length;
|
| 646 |
+
const completedPercentage = totalTests > 0 ? Math.round((completedTests.length / totalTests) * 100) : 0;
|
| 647 |
+
const pendingPercentage = totalTests > 0 ? Math.round((tests.length / totalTests) * 100) : 0;
|
| 648 |
+
|
| 649 |
+
// Calculate total study days remaining across all tests
|
| 650 |
+
const today = new Date();
|
| 651 |
+
let totalStudyDaysRemaining = 0;
|
| 652 |
+
let activeStudyDays = 0;
|
| 653 |
+
|
| 654 |
+
tests.forEach(test => {
|
| 655 |
+
const studyStartDate = new Date(test.studyStartDate);
|
| 656 |
+
const daysUntilStudy = Math.ceil((studyStartDate - today) / (1000 * 60 * 60 * 24));
|
| 657 |
+
|
| 658 |
+
if (daysUntilStudy <= 0) {
|
| 659 |
+
activeStudyDays += test.studyDays;
|
| 660 |
+
} else {
|
| 661 |
+
totalStudyDaysRemaining += daysUntilStudy;
|
| 662 |
+
}
|
| 663 |
+
});
|
| 664 |
+
|
| 665 |
+
// Calculate a progress percentage for study days
|
| 666 |
+
const totalStudyDays = activeStudyDays + totalStudyDaysRemaining;
|
| 667 |
+
const studyDaysPercentage = totalStudyDays > 0 ? Math.round((activeStudyDays / totalStudyDays) * 100) : 0;
|
| 668 |
+
|
| 669 |
+
// Update DOM
|
| 670 |
+
completedCount.textContent = `${completedTests.length} / ${totalTests}`;
|
| 671 |
+
pendingCount.textContent = `${tests.length} / ${totalTests}`;
|
| 672 |
+
studyDaysRemaining.textContent = `${totalStudyDaysRemaining} days`;
|
| 673 |
+
|
| 674 |
+
// Animate progress bars
|
| 675 |
+
setTimeout(() => {
|
| 676 |
+
completedBar.style.width = `${completedPercentage}%`;
|
| 677 |
+
pendingBar.style.width = `${pendingPercentage}%`;
|
| 678 |
+
studyDaysBar.style.width = `${studyDaysPercentage}%`;
|
| 679 |
+
}, 100);
|
| 680 |
+
}
|
| 681 |
+
|
| 682 |
+
function saveTests() {
|
| 683 |
+
localStorage.setItem('tests', JSON.stringify(tests));
|
| 684 |
+
}
|
| 685 |
+
|
| 686 |
+
function saveCompletedTests() {
|
| 687 |
+
localStorage.setItem('completedTests', JSON.stringify(completedTests));
|
| 688 |
+
}
|
| 689 |
+
|
| 690 |
+
function formatDate(dateString) {
|
| 691 |
+
const options = { year: 'numeric', month: 'short', day: 'numeric' };
|
| 692 |
+
return new Date(dateString).toLocaleDateString(undefined, options);
|
| 693 |
+
}
|
| 694 |
+
|
| 695 |
+
function showToast(message, type) {
|
| 696 |
+
const toast = document.createElement('div');
|
| 697 |
+
toast.className = `fixed bottom-4 right-4 px-6 py-3 rounded-lg shadow-lg text-white font-medium flex items-center space-x-2 fade-in ${
|
| 698 |
+
type === 'success' ? 'bg-secondary' :
|
| 699 |
+
type === 'error' ? 'bg-danger' :
|
| 700 |
+
'bg-primary'
|
| 701 |
+
}`;
|
| 702 |
+
|
| 703 |
+
toast.innerHTML = `
|
| 704 |
+
<i class="fas ${type === 'success' ? 'fa-check-circle' : type === 'error' ? 'fa-exclamation-circle' : 'fa-info-circle'}"></i>
|
| 705 |
+
<span>${message}</span>
|
| 706 |
+
`;
|
| 707 |
+
|
| 708 |
+
document.body.appendChild(toast);
|
| 709 |
+
|
| 710 |
+
setTimeout(() => {
|
| 711 |
+
toast.classList.add('opacity-0', 'transition-opacity', 'duration-300');
|
| 712 |
+
setTimeout(() => toast.remove(), 300);
|
| 713 |
+
}, 3000);
|
| 714 |
+
}
|
| 715 |
+
|
| 716 |
+
function toggleDarkMode() {
|
| 717 |
+
const html = document.documentElement;
|
| 718 |
+
const isDark = html.classList.toggle('dark');
|
| 719 |
+
|
| 720 |
+
localStorage.setItem('darkMode', isDark);
|
| 721 |
+
|
| 722 |
+
if (isDark) {
|
| 723 |
+
themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
|
| 724 |
+
} else {
|
| 725 |
+
themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
|
| 726 |
+
}
|
| 727 |
+
}
|
| 728 |
+
|
| 729 |
+
function checkDarkModePreference() {
|
| 730 |
+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
| 731 |
+
const storedPreference = localStorage.getItem('darkMode');
|
| 732 |
+
|
| 733 |
+
if (storedPreference === 'true' || (storedPreference === null && prefersDark)) {
|
| 734 |
+
document.documentElement.classList.add('dark');
|
| 735 |
+
themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
|
| 736 |
+
}
|
| 737 |
+
}
|
| 738 |
+
</script>
|
| 739 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Administrator4321/test-tracker" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 740 |
+
</html>
|