Updated scheduler to display schedule archives upon request.

This commit is contained in:
rainbow napkin 2026-10-12 01:10:34 -04:00
parent baf8255b2c
commit 50b1e15a6c
3 changed files with 61 additions and 1 deletions

View file

@ -142,7 +142,8 @@ class queuePanel extends panelObj{
defineListeners(){
//Render queue when we receive a new copy of the queue data from the server
//Render queue should be called within an arrow function so that it's called with default parameters, and not handed an event as a date
this.client.queueBroadcastSocket.on("queue", () => {this.renderQueue();});
this.client.queueBroadcastSocket.on("queue", this.renderQueue.bind(this));
this.client.socket.on("archive", this.renderQueue.bind(this));
this.client.socket.on("start", this.handleStart.bind(this));
this.client.socket.on("end", this.handleEnd.bind(this));
this.client.socket.on("lock", this.handleScheduleLock.bind(this));
@ -491,6 +492,20 @@ class queuePanel extends panelObj{
//Re-render/hide the time marker
this.renderTimeMarker();
//If we're not looking at today
if(!utils.isSameDate(date, new Date())){
//Clone given epoch twice
const dayBefore = new Date(date.getTime());
const dayAfter = new Date(date.getTime());
//Make it a day before/after
dayBefore.setDate(dayBefore.getDate() - 1);
dayAfter.setDate(dayAfter.getDate() + 1);
//Request the archives from that day
this.client.socket.emit("getArchive", {startDate: dayBefore.getTime(), endDate: dayAfter.getTime()});
}
//If autoscroll is enabled
if(this.autoscroll){
//Simulate a button click to un/re-light the button and trigger a scroll when the date is set to today