Add authentication #17

Manually merged
Webmaster merged 225 commits from auth into main 2025-03-08 10:37:06 +00:00
Showing only changes of commit 6748434fd7 - Show all commits

View file

@ -1187,27 +1187,22 @@ declare global {
fetchEvents(); fetchEvents();
}); });
// Search input with optimized debounce // Search input with instant search (no debounce needed for cached data)
let searchTimeout: number | undefined;
const searchInput = document.getElementById("searchInput"); const searchInput = document.getElementById("searchInput");
if (searchInput) { if (searchInput) {
// Add input event // Add input event for instant search
searchInput.addEventListener("input", (e) => { searchInput.addEventListener("input", (e) => {
const target = e.target as HTMLInputElement; const target = e.target as HTMLInputElement;
clearTimeout(searchTimeout); searchQuery = target.value.trim();
searchTimeout = window.setTimeout(() => { currentPage = 1;
searchQuery = target.value.trim(); fetchEvents();
currentPage = 1;
fetchEvents();
}, 150); // Reduced to 150ms for faster response
}); });
// Add keydown event for Enter key // Clear search on Escape key
searchInput.addEventListener("keydown", (e) => { searchInput.addEventListener("keydown", (e) => {
if (e.key === "Enter") { if (e.key === "Escape") {
clearTimeout(searchTimeout); (e.target as HTMLInputElement).value = "";
const target = e.target as HTMLInputElement; searchQuery = "";
searchQuery = target.value.trim();
currentPage = 1; currentPage = 1;
fetchEvents(); fetchEvents();
} }