add sorting to MAM board

This commit is contained in:
QuickMythril 2025-01-28 04:30:31 -05:00
parent 9b088fa588
commit 25c94b3ea7

View File

@ -59,6 +59,13 @@ const loadAddRemoveAdminPage = async () => {
<div id="existing-proposals-section" class="proposals-section" style="margin-top: 3em; display: flex; flex-direction: column; justify-content: center; align-items: center;">
<h3 style="color: #ddd;">Existing Promotion/Demotion Proposals</h3>
<button id="refresh-cards-button" class="refresh-cards-button" style="padding: 10px;">Refresh Proposal Cards</button>
<select id="sort-select" style="margin-left: 10px; padding: 5px;">
<option value="newest" selected>Sort by Date</option>
<option value="name">Sort by Name</option>
<option value="recent-comments">Newest Comments</option>
<option value="least-votes">Least Votes</option>
<option value="most-votes">Most Votes</option>
</select>
<select id="time-range-select" style="margin-left: 10px; padding: 5px;">
<option value="0">Show All</option>
<option value="1">Last 1 day</option>
@ -98,6 +105,14 @@ const loadAddRemoveAdminPage = async () => {
await loadCards(addRemoveIdentifierPrefix)
})
document.getElementById("sort-select").addEventListener("change", async () => {
// Optionally clear or show a message while loading
const cardsContainer = document.getElementById("cards-container")
cardsContainer.innerHTML = "<p>Refreshing cards...</p>"
// Re-load the cards using the same function that handles sorting logic
await loadCards(addRemoveIdentifierPrefix)
})
document.getElementById("cancel-publish-button").addEventListener("click", async () => {
// const cardsContainer = document.getElementById("existing-proposals-section")
// cardsContainer.style.display = "flex" // Restore visibility