fix: simplify burden meter to pure inline styles
This commit is contained in:
parent
bb89aaa6bc
commit
a6e941eb01
2 changed files with 12 additions and 66 deletions
|
|
@ -1384,27 +1384,16 @@ function renderInventoryState(state) {
|
|||
const burdenDisplay = Math.floor(burdenPct);
|
||||
state.burdenLabel.textContent = `${burdenDisplay}%`;
|
||||
state.burdenLabel.title = burdenUnits > 0 && encumbranceCapacity > 0
|
||||
? `${burdenUnits}/${encumbranceCapacity}`
|
||||
? `${burdenUnits.toLocaleString()} / ${encumbranceCapacity.toLocaleString()}`
|
||||
: '';
|
||||
state.burdenLabel.style.color = '#ffffff';
|
||||
state.burdenLabel.style.zIndex = '3';
|
||||
state.burdenFill.style.height = `${Math.min(100, burdenPct)}%`;
|
||||
state.burdenFill.style.minHeight = burdenPct > 0 ? '3px' : '0';
|
||||
state.burdenFill.className = 'inv-burden-fill';
|
||||
// Fill height: map 0-200% burden onto 0-100% bar height
|
||||
state.burdenFill.style.height = `${burdenPct / 2}%`;
|
||||
// Color by threshold
|
||||
state.burdenFill.style.backgroundColor = burdenPct > 150
|
||||
? '#b7432c'
|
||||
: burdenPct > 100
|
||||
? '#d8a431'
|
||||
: '#2e8b57';
|
||||
state.burdenFill.style.opacity = '1';
|
||||
state.burdenFill.style.borderTop = '1px solid rgba(255,255,255,0.18)';
|
||||
if (burdenPct > 150) {
|
||||
state.burdenFill.classList.add('is-danger');
|
||||
} else if (burdenPct > 100) {
|
||||
state.burdenFill.classList.add('is-warning');
|
||||
} else {
|
||||
state.burdenFill.classList.add('is-safe');
|
||||
}
|
||||
|
||||
// 4. Sort containers for stable sidebar order (by unsigned item_id)
|
||||
containers.sort((a, b) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue