Finishing porting admin panel improvements to channel settings

This commit is contained in:
rainbow napkin 2026-10-28 22:44:33 -04:00
parent b83ad40490
commit 7660db75e7
5 changed files with 36 additions and 44 deletions

View file

@ -207,7 +207,7 @@ class chanInfo{
class rankList{
constructor(channel){
this.channel = channel
this.table = document.querySelector(".admin-list-table");
this.tbody = document.querySelector("#admin-rank-list-table tbody");
this.userPrompt = document.querySelector("#new-rank-input");
this.rankSelect = document.querySelector("#new-rank-select");
@ -262,7 +262,7 @@ class rankList{
const rankEnum = await utils.ajax.getRankEnum();
//clear the table
this.clearTable();
this.tbody.innerHTML = "";
//For each user in the list
Object.entries(data).forEach((userAr) => {
@ -296,7 +296,7 @@ class rankList{
}
//Generate row and append to table
this.table.appendChild(utils.ux.newTableRow([
this.tbody.appendChild(utils.ux.newTableRow([
imgNode,
user.id,
user.user,
@ -304,23 +304,12 @@ class rankList{
]));
});
}
clearTable(){
//get all non-title table rows
const rows = this.table.querySelectorAll("tr.gen-row");
//for each row
rows.forEach((row) => {
//The Lord Yeeteth, and The Lord Yoinketh away...
row.remove();
});
}
}
class banList{
constructor(channel){
this.channel = channel;
this.table = document.querySelector("#admin-ban-list-table");
this.tbody = document.querySelector("#admin-ban-list-table tbody");
this.banPrompt = document.querySelector("#new-ban-input");
this.banButton = document.querySelector("#new-ban-button");
@ -337,13 +326,6 @@ class banList{
this.updateList(data);
}
clearList(){
const oldRows = this.table.querySelectorAll('tr.gen-row');
oldRows.forEach((row) => {
row.remove();
});
}
async ban(event){
new chanBanUserPopup(this.channel, this.banPrompt.value, this.updateList.bind(this));
}
@ -360,7 +342,8 @@ class banList{
updateList(bans){
//for each ban listed
this.clearList();
this.tbody.innerHTML = "";
bans.forEach((ban)=>{
//Create IMG node
const imgNode = document.createElement('img');
@ -382,7 +365,7 @@ class banList{
const expirationString = ban.expirationDays < 0 ? "Never" : `${new Date(ban.expirationDate).toDateString()}<br>(${ban.daysUntilExpiration} day(s) left)`;
//Generate row and append to table
this.table.appendChild(utils.ux.newTableRow([
this.tbody.appendChild(utils.ux.newTableRow([
imgNode,
ban.user.id,
ban.user.user,