Fix delete crates haven't update the count bug

This commit is contained in:
Folyd 2021-08-04 13:41:18 +08:00
parent 64a6158a72
commit b9dfffc675
2 changed files with 4 additions and 2 deletions

View file

@ -195,7 +195,7 @@ function calendarHeatmap() {
}
dayRects.exit().remove();
const monthLabels = svg.selectAll('.month')
svg.selectAll('.month')
.data(monthRange)
.enter().append('text')
.attr('class', 'month-name')

View file

@ -4,6 +4,8 @@ function buildRemoveButton(name) {
btn.textContent = "Remove";
btn.onclick = () => {
CrateDocManager.removeCrate(name);
// Update the crate count
document.getElementById("crate-count").textContent = Object.keys(CrateDocManager.getCrates()).length || 0;
btn.parentElement.remove();
};
return btn;
@ -64,7 +66,7 @@ function refresh(orderBy = "time") {
}
let crateFilter = document.querySelector("select[name='crate-filter']");
crateFilter.onchange = function() {
crateFilter.onchange = function () {
refresh(crateFilter.value);
};