Merge pull request #58 from ulsklyc/fix/56

fix: anchor overdue badge to icon via runtime wrapper
This commit is contained in:
ulsklyc
2026-04-19 18:06:57 +02:00
committed by GitHub
2 changed files with 23 additions and 5 deletions
+14 -2
View File
@@ -827,11 +827,23 @@ function updateOverdueBadge() {
document.querySelectorAll('[data-route="/tasks"] .nav-badge').forEach((el) => el.remove()); document.querySelectorAll('[data-route="/tasks"] .nav-badge').forEach((el) => el.remove());
if (overdue > 0) { if (overdue > 0) {
document.querySelectorAll('[data-route="/tasks"]').forEach((el) => { document.querySelectorAll('[data-route="/tasks"]').forEach((navItem) => {
let anchor = navItem.querySelector('.nav-item__icon-wrap');
if (!anchor) {
const icon = navItem.querySelector('.nav-item__icon');
anchor = document.createElement('span');
anchor.className = 'nav-item__icon-wrap';
if (icon) {
icon.replaceWith(anchor);
anchor.appendChild(icon);
} else {
navItem.prepend(anchor);
}
}
const badge = document.createElement('span'); const badge = document.createElement('span');
badge.className = 'nav-badge'; badge.className = 'nav-badge';
badge.textContent = String(overdue); badge.textContent = String(overdue);
el.appendChild(badge); anchor.appendChild(badge);
}); });
} }
} }
Regular → Executable
+9 -3
View File
@@ -196,10 +196,16 @@
position: relative; position: relative;
} }
.nav-item .nav-badge { .nav-item__icon-wrap {
position: relative;
display: inline-flex;
flex-shrink: 0;
}
.nav-item__icon-wrap .nav-badge {
position: absolute; position: absolute;
top: var(--space-1); top: calc(-1 * var(--space-1));
right: var(--space-1); right: calc(-1 * var(--space-1));
margin-left: 0; margin-left: 0;
} }