";
+
+ // Update the resource list with filtered resources
+ document.getElementById("resources-list").innerHTML = html;
+}
+
+// Generate filter checkboxes based on unique tag headers
+function generateFilterCheckboxes(data) {
+ const tagHeaders = Object.keys(data[0]).filter(key => !["Name", "Link", "Description"].includes(key));
+
+ console.log("Tag Headers:", tagHeaders); // Debugging line
+
+ let filterHTML = "";
+ tagHeaders.forEach(tag => {
+ filterHTML += `
+
+
+
`;
+ });
+
+ document.getElementById("filter-controls").innerHTML = filterHTML;
+}
+
+// Attach event listeners to checkboxes
+function attachFilterListeners(data) {
+ const checkboxes = document.querySelectorAll(".tag-filter input");
+ checkboxes.forEach(checkbox => {
+ checkbox.addEventListener("change", () => updateResourceList(data));
+ });
+
+ const exclusiveToggle = document.getElementById("exclusive-filter-toggle");
+ exclusiveToggle.addEventListener("change", () => updateResourceList(data));
+
+ const selectAllButton = document.getElementById("select-all-btn");
+ selectAllButton.addEventListener("click", () => {
+ // Check all checkboxes
+ checkboxes.forEach(checkbox => checkbox.checked = true);
+
+ // Update the resource list after selecting all
+ updateResourceList(data);
+ });
+
+ const deselectAllButton = document.getElementById("deselect-all-btn");
+ deselectAllButton.addEventListener("click", () => {
+ // Uncheck all checkboxes
+ checkboxes.forEach(checkbox => checkbox.checked = false);
+
+ // Update the resource list after deselecting all
+ updateResourceList(data);
+ });
+}
+
+// Load data and initialize filters
+d3.csv("resources/resources.csv").then(function (data) {
+ // If no data, show an empty state message
+ if (!data || data.length === 0) {
+ document.getElementById("resources-list").innerHTML = "No resources listed yet.";
+ return;
+ }
+
+ // Generate and populate filters
+ generateFilterCheckboxes(data);
+
+ // Populate initial resource list
+ updateResourceList(data);
+
+ // Attach filter listeners
+ attachFilterListeners(data);
+}).catch(function (error) {
+ console.error("Error loading resources:", error);
+ document.getElementById("resources-list").innerHTML = "Could not load resources list.";
+});
diff --git a/resources.html b/resources.html
index 04fd619..e2ca47c 100644
--- a/resources.html
+++ b/resources.html
@@ -6,7 +6,8 @@
Interactive Blueprint
-
+
+
@@ -23,18 +24,25 @@
Resources
-
Here you will find a list of resources that are relevant to each of the components of Blueprint.
+
Here you will find a list of resources that are relevant to each of the components of Blueprint. Check each box to display resources associated with a specific Blueprint component.