add filtering and sorting features; enhance events and articles pages with URL state persistence
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user