add filtering and sorting features; enhance events and articles pages with URL state persistence

This commit is contained in:
ImBenji
2026-04-23 23:03:11 +01:00
parent bec6763191
commit 194442ec4c
8 changed files with 274 additions and 16 deletions
+25
View File
@@ -86,6 +86,14 @@ let graphSearchTerm = "";
let graphSelectedId = null;
function syncGraphUrl() {
queryWrite({
q: graphSearchTerm,
type: graphFilterType && graphFilterType !== "all" ? graphFilterType : "",
});
}
async function loadIntelGraph() {
const data = await api("/admin/api/intelligence/graph");
@@ -547,8 +555,24 @@ async function toggleEvidenceRow(row) {
document.addEventListener("DOMContentLoaded", async () => {
// restore search/type from url
const urlSearch = queryGet("q");
const urlType = queryGet("type") || "all";
if (urlSearch) {
document.getElementById("graph-search").value = urlSearch;
graphSearchTerm = urlSearch.toLowerCase();
}
if (urlType && urlType !== "all") {
graphFilterType = urlType;
document.querySelectorAll(".graph-chip").forEach(c =>
c.classList.toggle("active", c.dataset.type === urlType)
);
}
document.getElementById("graph-search").addEventListener("input", ev => {
graphSearchTerm = ev.target.value.trim().toLowerCase();
syncGraphUrl();
applyGraphFilters();
});
@@ -558,6 +582,7 @@ document.addEventListener("DOMContentLoaded", async () => {
document.querySelectorAll(".graph-chip").forEach(c => c.classList.remove("active"));
btn.classList.add("active");
graphFilterType = btn.dataset.type;
syncGraphUrl();
applyGraphFilters();
});