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:
@@ -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>`
|
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('')
|
}).join('')
|
||||||
for (const b of document.querySelectorAll('.fchip')) b.onclick = () => { quickFilter = b.dataset.q; render() }
|
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() {
|
function render() {
|
||||||
document.getElementById('count').textContent = noneShown ? t('count.none') : !rootDir ? t('count.noFolder')
|
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('selStatusWrap').style.display = activeView === 'board' ? 'none' : ''
|
||||||
document.getElementById('selSortWrap').style.display = activeView === 'tasks' ? 'none' : ''
|
document.getElementById('selSortWrap').style.display = activeView === 'tasks' ? 'none' : ''
|
||||||
document.getElementById('boardMode').style.display = activeView === 'board' ? '' : 'none'
|
document.getElementById('boardMode').style.display = activeView === 'board' ? '' : 'none'
|
||||||
|
requestAnimationFrame(fitChips) // the space left for the filter chips changed
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── scan ─────────────────────────────────────────────────────────────── */
|
/* ── scan ─────────────────────────────────────────────────────────────── */
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
.toolbar select { border: none; background: transparent; padding: 7px 4px; font-size: 13px; outline: none; color: var(--text); cursor: pointer; }
|
.toolbar select { border: none; background: transparent; padding: 7px 4px; font-size: 13px; outline: none; color: var(--text); cursor: pointer; }
|
||||||
.toolbar select option { background: var(--surface); }
|
.toolbar select option { background: var(--surface); }
|
||||||
.chipfilters { display: flex; gap: 6px; flex-wrap: wrap; }
|
.chipfilters { display: flex; gap: 6px; flex-wrap: wrap; }
|
||||||
.fchip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
|
.fchip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); flex: 0 0 auto; white-space: nowrap; }
|
||||||
.fchip:hover { color: var(--text); }
|
.fchip:hover { color: var(--text); }
|
||||||
.fchip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
|
.fchip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
|
||||||
.fchip .n { font-size: 11px; opacity: .8; }
|
.fchip .n { font-size: 11px; opacity: .8; }
|
||||||
@@ -395,7 +395,12 @@
|
|||||||
|
|
||||||
/* toolbar stays one row: chips drop their labels first */
|
/* toolbar stays one row: chips drop their labels first */
|
||||||
.toolbar { flex-wrap: nowrap; container-type: inline-size; container-name: toolbar; }
|
.toolbar { flex-wrap: nowrap; container-type: inline-size; container-name: toolbar; }
|
||||||
.chipfilters { flex-wrap: nowrap; min-width: 0; overflow: hidden; }
|
/* chips never squeeze: too many for the width → labels hide (fitChips in app.js), then the row scrolls sideways */
|
||||||
|
.chipfilters { flex-wrap: nowrap; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
|
||||||
|
.chipfilters::-webkit-scrollbar { display: none; }
|
||||||
|
.chipfilters.compact .fchip:not(.active) .fl { display: none; }
|
||||||
|
.chipfilters.compact .fchip { padding: 5px 9px; }
|
||||||
|
.chipfilters.more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
|
||||||
.toolbar .sel { flex: 0 0 auto; }
|
.toolbar .sel { flex: 0 0 auto; }
|
||||||
@container toolbar (max-width: 1050px) { .fchip:not(.active) .fl { display: none; } .fchip { padding: 5px 9px; } }
|
@container toolbar (max-width: 1050px) { .fchip:not(.active) .fl { display: none; } .fchip { padding: 5px 9px; } }
|
||||||
@container toolbar (max-width: 700px) { .fchip .fl { display: none; } }
|
@container toolbar (max-width: 700px) { .fchip .fl { display: none; } }
|
||||||
|
|||||||
Reference in New Issue
Block a user