zmiany w ux
This commit is contained in:
@@ -26,15 +26,20 @@
|
||||
const val = clamp(Number(input.value));
|
||||
const p = Math.max(0, Math.min(100, pct(val)));
|
||||
|
||||
if (previewPct) previewPct.textContent = pct(val).toFixed(1);
|
||||
if (previewBar) previewBar.style.setProperty('--progress-width', p + '%');
|
||||
if (previewPct) previewPct.textContent = p.toFixed(1);
|
||||
|
||||
if (previewBar) {
|
||||
previewBar.style.width = p + '%';
|
||||
previewBar.setAttribute('aria-valuenow', p.toFixed(2));
|
||||
}
|
||||
|
||||
if (previewNote) {
|
||||
if (cel > 0) {
|
||||
const diff = cel - val;
|
||||
if (diff > 0) {
|
||||
const isZero = Math.abs(diff) < 0.005; // float-safe
|
||||
if (diff > 0 && !isZero) {
|
||||
previewNote.textContent = 'Do celu brakuje: ' + diff.toFixed(2) + ' PLN';
|
||||
} else if (diff === 0) {
|
||||
} else if (isZero) {
|
||||
previewNote.textContent = 'Cel osiągnięty.';
|
||||
} else {
|
||||
previewNote.textContent = 'Przekroczono cel o: ' + Math.abs(diff).toFixed(2) + ' PLN';
|
||||
@@ -45,6 +50,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Zmiana ręczna
|
||||
if (input) {
|
||||
input.addEventListener('input', updatePreview);
|
||||
|
Reference in New Issue
Block a user