mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
feat: Only add cost ticks if the cost is greater than zero
This commit is contained in:
parent
0f8d196741
commit
3e27c1bb17
1 changed files with 18 additions and 11 deletions
|
@ -220,18 +220,25 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|
||||||
// Add tick divs to each cost cell
|
// Add tick divs to each cost cell
|
||||||
costCells.forEach(cell => {
|
costCells.forEach(cell => {
|
||||||
// Clear existing ticks if any (e.g., during updates, though not strictly needed here)
|
const costBar = cell.querySelector('.cost-bar');
|
||||||
// cell.querySelectorAll('.cost-tick').forEach(t => t.remove());
|
// Use optional chaining and provide '0' as fallback if costBar or dataset.cost is missing
|
||||||
|
const cost = parseFloat(costBar?.dataset?.cost || '0');
|
||||||
|
|
||||||
tickPercentages.forEach(percent => {
|
// Only add ticks if the cost is actually greater than 0
|
||||||
// Ensure percentage is within valid range
|
if (cost > 0) {
|
||||||
if (percent >= 0 && percent <= 100) {
|
// Clear existing ticks if any (e.g., during updates, though not strictly needed here)
|
||||||
const tick = document.createElement('div');
|
// cell.querySelectorAll('.cost-tick').forEach(t => t.remove());
|
||||||
tick.className = 'cost-tick';
|
|
||||||
tick.style.left = `${percent}%`;
|
tickPercentages.forEach(percent => {
|
||||||
cell.appendChild(tick);
|
// Ensure percentage is within valid range
|
||||||
}
|
if (percent >= 0 && percent <= 100) {
|
||||||
});
|
const tick = document.createElement('div');
|
||||||
|
tick.className = 'cost-tick';
|
||||||
|
tick.style.left = `${percent}%`;
|
||||||
|
cell.appendChild(tick);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue