Added operation counts to categories and ops list with option to hide by default for categories.

This commit is contained in:
n1474335 2024-05-13 17:48:09 +01:00
parent bbebba6481
commit 57c8c6dbc6
No known key found for this signature in database
GPG key ID: D15457B7B4AF3F37
8 changed files with 45 additions and 2 deletions

View file

@ -168,6 +168,10 @@ class OperationsWaiter {
*/
opListCreate(e) {
this.manager.recipe.createSortableSeedList(e.target);
// Populate ops total
document.querySelector("#operations .title .op-count").innerText = Object.keys(this.app.operations).length;
this.enableOpsListPopovers(e.target);
}
@ -293,6 +297,18 @@ class OperationsWaiter {
this.app.resetFavourites();
}
/**
* Sets whether operation counts are displayed next to a category title
*/
setCatCount() {
if (this.app.options.showCatCount) {
document.querySelectorAll(".category-title .op-count").forEach(el => el.classList.remove("hidden"));
} else {
document.querySelectorAll(".category-title .op-count").forEach(el => el.classList.add("hidden"));
}
}
}
export default OperationsWaiter;