let currentMinterToolPage = 'overview'; // Track the current page const loadMinterAdminToolsPage = async () => { // Remove all body content except for menu elements const bodyChildren = document.body.children; for (let i = bodyChildren.length - 1; i >= 0; i--) { const child = bodyChildren[i]; if (!child.classList.contains('menu')) { child.remove() } } const avatarUrl = `/arbitrary/THUMBNAIL/${userState.accountName}/qortal_avatar` // Set the background image directly from a file const mainContent = document.createElement('div') // In your 'AdminTools' code mainContent.innerHTML = `

Admin Tools

Welcome to Admin Tools

On this page you will find admin functionality for the Q-Mintership App. Including the 'blockList' for blocking comments from certain names, and manual creation of invite transactions.

More features will be added as time goes on. This is the start of the functionality here.

` document.body.appendChild(mainContent) addToolsPageEventListeners() } function addToolsPageEventListeners() { document.getElementById("toggle-blocklist-button").addEventListener("click", async () => { const container = document.getElementById("blocklist-container") // toggle show/hide container.style.display = (container.style.display === "none" ? "flex" : "none") // if showing, load the block list if (container.style.display === "flex") { const currentBlockList = await fetchBlockList() displayBlockList(currentBlockList) } }) document.getElementById("blocklist-add-button").addEventListener("click", async () => { const blocklistInput = document.getElementById("blocklist-input") const nameToAdd = blocklistInput.value.trim() if (!nameToAdd) return // fetch existing const currentBlockList = await fetchBlockList() // add if not already in list if (!currentBlockList.includes(nameToAdd)) { currentBlockList.push(nameToAdd) } // publish updated await publishBlockList(currentBlockList) displayBlockList(currentBlockList) blocklistInput.value = "" alert(`"${nameToAdd}" added to the block list!`) }) // Remove document.getElementById("blocklist-remove-button").addEventListener("click", async () => { const blocklistInput = document.getElementById("blocklist-input") const nameToRemove = blocklistInput.value.trim() if (!nameToRemove) return // fetch existing let currentBlockList = await fetchBlockList() // remove if present currentBlockList = currentBlockList.filter(name => name !== nameToRemove) // publish updated await publishBlockList(currentBlockList) displayBlockList(currentBlockList) blocklistInput.value = "" alert(`"${nameToRemove}" removed from the block list (if it was present).`) }) } const displayBlockList = (blockedNames) => { const blocklistDisplay = document.getElementById("blocklist-display") if (!blockedNames || blockedNames.length === 0) { blocklistDisplay.innerHTML = "

No blocked users currently.

" return } blocklistDisplay.innerHTML = ` ` }