Added basic sesh list rendering to PM panel UX

This commit is contained in:
rainbow napkin 2025-09-30 05:03:36 -04:00
parent a681bddbf7
commit f109314163
3 changed files with 66 additions and 2 deletions

View file

@ -26,13 +26,26 @@ class pmPanel extends panelObj{
*/
constructor(client, panelDocument){
super(client, "Private Messaging", "/panel/pm", panelDocument);
this.defineListeners();
}
closer(){
}
docSwitch(){
this.seshList = this.panelDocument.querySelector('#pm-panel-sesh-list');
this.setupInput();
this.renderSeshList();
}
/**
* Defines network related event listeners
*/
defineListeners(){
}
/**
@ -40,4 +53,36 @@ class pmPanel extends panelObj{
*/
setupInput(){
}
/**
* Render out current sesh array to sesh list UI
*/
renderSeshList(){
//For each session tracked by the pmHandler
for(const sesh of this.client.pmHandler.seshList){
this.renderSeshListEntry(sesh);
}
}
/**
* Renders out a given messaging sesh to the sesh list UI
*/
renderSeshListEntry(sesh){
//Create container div
const entryDiv = document.createElement('div');
//Set conatiner div classes
entryDiv.classList.add('pm-panel-sesh-list-entry','interactive');
//Create sesh label
const seshLabel = document.createElement('p');
//Create human-readable label out of members array
seshLabel.textContent = utils.unescapeEntities(sesh.recipients.sort().join(', '));
//append sesh label to entry div
entryDiv.appendChild(seshLabel);
//Append entry div to sesh list
this.seshList.appendChild(entryDiv);
}
}