filter-chips: nie gequetscht, passen sich der breite an

Die Schnellfilter brachen bei schmalem Fenster um ("Ohne / Remote") und
wurden rechts abgeschnitten – vor allem auf Deutsch (längere Namen).
Jetzt schrumpfen Chips nicht mehr; reicht der Platz nicht, zeigen sie nur
Icon + Zahl (Name im Tooltip), notfalls scrollt die Reihe seitlich mit
Ausblendung am Rand. Gemessen statt fester Breite, also sprachunabhängig.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 22:09:42 +01:00
parent 0883c8cfff
commit 76aad18646
2 changed files with 20 additions and 2 deletions

View File

@@ -1381,7 +1381,19 @@ function renderQuickFilters() {
return `<button class="fchip ${quickFilter === q.key ? 'active' : ''}" data-q="${q.key}" title="${t(q.label)}">${ic(q.icon, 'sm')}<span class="fl">${t(q.label)}</span><span class="n">${n}</span></button>`
}).join('')
for (const b of document.querySelectorAll('.fchip')) b.onclick = () => { quickFilter = b.dataset.q; render() }
requestAnimationFrame(fitChips) // after the rest of the toolbar (sort, board mode) has its final size
}
// Measured, not a fixed breakpoint (labels differ per language): too wide → icon + count only,
// still too wide → the row scrolls sideways with a fade at the edge.
function fitChips() {
const el = document.getElementById('chipfilters')
if (!el) return
el.classList.remove('compact', 'more')
if (el.scrollWidth > el.clientWidth + 1) el.classList.add('compact')
if (el.scrollWidth > el.clientWidth + 1) el.classList.add('more')
}
// the toolbar's width, not the chips' (fitChips changes those itself – that would loop)
new ResizeObserver(() => fitChips()).observe(document.querySelector('.toolbar'))
function render() {
document.getElementById('count').textContent = noneShown ? t('count.none') : !rootDir ? t('count.noFolder')
@@ -1401,6 +1413,7 @@ function updateToolbarForView() {
document.getElementById('selStatusWrap').style.display = activeView === 'board' ? 'none' : ''
document.getElementById('selSortWrap').style.display = activeView === 'tasks' ? 'none' : ''
document.getElementById('boardMode').style.display = activeView === 'board' ? '' : 'none'
requestAnimationFrame(fitChips) // the space left for the filter chips changed
}
/* ── scan ─────────────────────────────────────────────────────────────── */