From 7f4848342d1be9daea0ddee24b9bdc3136711e13 Mon Sep 17 00:00:00 2001 From: crowetic Date: Wed, 15 Jan 2025 19:14:16 -0800 Subject: [PATCH] added filter for kicked/banned cards on AdminBoard, and added check for PENDING transactions --- assets/js/AdminBoard.js | 178 ++++++++++++++++++++++++++++++-------- assets/js/MinterBoard.js | 1 + assets/js/Q-Mintership.js | 2 +- 3 files changed, 145 insertions(+), 36 deletions(-) diff --git a/assets/js/AdminBoard.js b/assets/js/AdminBoard.js index 4dc000d..5c0afe9 100644 --- a/assets/js/AdminBoard.js +++ b/assets/js/AdminBoard.js @@ -12,12 +12,54 @@ let adminMemberCount = 0 let adminPublicKeys = [] let kickTransactions = [] let banTransactions = [] +let adminBoardState = { + kickedCards: new Set(), // store identifiers or addresses + bannedCards: new Set(), // likewise + hiddenList: new Set(), // user-hidden + // ... we can add other things to state if needed... +} + +const loadAdminBoardState = () => { + // Load from localStorage if available + const rawState = localStorage.getItem('adminBoardState') + if (rawState) { + try { + const parsed = JSON.parse(rawState); + // Make sure bannedCards and kickedCards are sets + return { + bannedCards: new Set(parsed.bannedCards ?? []), + kickedCards: new Set(parsed.kickedCards ?? []), + hiddenList: new Set(parsed.hiddenList ?? []), + // ... any other fields + }; + } catch (e) { + console.warn("Failed to parse adminBoardState from storage:", e) + } + } + // If nothing found or parse error, return a default + return { + bannedCards: new Set(), + kickedCards: new Set(), + hiddenList: new Set(), + } +} + +// Saving the state back into localStorage as needed: +const saveAdminBoardState = () => { + const stateToSave = { + bannedCards: Array.from(adminBoardState.bannedCards), + kickedCards: Array.from(adminBoardState.kickedCards), + hiddenList: Array.from(adminBoardState.hiddenList), + } + localStorage.setItem('adminBoardState', JSON.stringify(stateToSave)) +} console.log("Attempting to load AdminBoard.js") const loadAdminBoardPage = async () => { // Clear existing content on the page - const bodyChildren = document.body.children; + const bodyChildren = document.body.children + for (let i = bodyChildren.length - 1; i >= 0; i--) { const child = bodyChildren[i]; if (!child.classList.contains("menu")) { @@ -34,6 +76,12 @@ const loadAdminBoardPage = async () => {

More functionality will be added over time. One of the first features will be the ability to output the existing card data 'decisions', to a json formatted list in order to allow crowetic to run his script easily until the final Mintership proposal changes are completed, and the MINTER group is transferred to 'null'.

+
+ + + + +