Highlight travel log tabs when selected

This commit is contained in:
Jordan Irwin 2023-12-21 23:54:21 -08:00
parent 93178b8f09
commit 47cc43572f
No known key found for this signature in database
GPG key ID: E3E358C2F44C290A
2 changed files with 14 additions and 0 deletions

View file

@ -38,12 +38,14 @@ export class ProgressStatusEvent extends RPEvent {
travelLogDialog = new TravelLogDialog(dataItems);
new FloatingWindow("Travel Log", travelLogDialog, dstate.x, dstate.y).setId("travellog");
}
travelLogDialog.updateTabs();
return;
}
if (!travelLogDialog) {
return;
}
travelLogDialog.updateTabs();
if (!this["item"]) {
if (progressType === "repeatable") {

View file

@ -67,12 +67,24 @@ export class TravelLogDialog extends DialogContentComponent {
});
}
public updateTabs() {
document.querySelectorAll(".progressTypeButton").forEach((tab) => {
const element = document.getElementById(tab.id)! as HTMLElement;
if (element.id == this.currentProgressType) {
// highlight selected tab
element.style.setProperty("background-color", "#b3b3b3");
} else {
element.style.removeProperty("background-color");
}
});
}
private onProgressTypeButtonClick(event: Event) {
// clear details when changing category
this.refreshDetails();
this.currentProgressType = (event.target as HTMLElement).id;
this.updateTabs();
var action = {
"type": "progressstatus",
"progress_type": this.currentProgressType