This commit is contained in:
2026-03-06 21:27:16 -05:00
parent 1fdfbb1b4f
commit 41ebd4ac62
21 changed files with 1018 additions and 43 deletions
+35
View File
@@ -0,0 +1,35 @@
import { students } from "./data.js";
import { calculateOverallStatistics } from "./analytics.js";
import { getTopThree, uniqueCourses } from "./utils.js";
import { renderTable, renderSummary } from "./ui.js";
import { toggleTheme, loadTheme } from "./theme.js";
let filteredStudents = [...students];
const nameSearchInput = document.getElementById("nameSearch");
const minGradeInput = document.getElementById("minimumGrade");
const minGradeValue = document.getElementById("gradeValue");
const applyFilters = () => {
const nameFilter = nameSearchInput.value.toLowerCase();
const minGrade = parseInt(minGradeInput.value);
filteredStudents = students.filter((student) => student.name.toLowerCase().includes(nameFilter) && student.grade >= minGrade);
const topThree = getTopThree(filteredStudents);
renderTable(filteredStudents, topThree);
const stats = calculateOverallStatistics(filteredStudents);
renderSummary(stats, uniqueCourses(filteredStudents).length);
};
nameSearchInput.addEventListener("input", applyFilters);
minGradeInput.addEventListener("input", () => {
minGradeValue.textContent = minGradeInput.value;
applyFilters();
});
document.getElementById("themeToggle").addEventListener("click", toggleTheme);
loadTheme();
applyFilters();