feat: Only add cost ticks if the cost is greater than zero

This commit is contained in:
Paul Gauthier (aider) 2025-04-12 23:32:01 -07:00
parent 0f8d196741
commit 3e27c1bb17

View file

@ -220,6 +220,12 @@ document.addEventListener('DOMContentLoaded', function() {
// Add tick divs to each cost cell
costCells.forEach(cell => {
const costBar = cell.querySelector('.cost-bar');
// Use optional chaining and provide '0' as fallback if costBar or dataset.cost is missing
const cost = parseFloat(costBar?.dataset?.cost || '0');
// Only add ticks if the cost is actually greater than 0
if (cost > 0) {
// Clear existing ticks if any (e.g., during updates, though not strictly needed here)
// cell.querySelectorAll('.cost-tick').forEach(t => t.remove());
@ -232,6 +238,7 @@ document.addEventListener('DOMContentLoaded', function() {
cell.appendChild(tick);
}
});
}
});
}
}