hilfe-dialog: schließen-fix, zentriert, kompakter, blättern

- Fix: display:flex nur für #helpDlg[open] (vorher überschrieb es das
  display:none des geschlossenen <dialog> → ließ sich nicht schließen).
- Dialog zentriert und schmaler, kompaktere Abstände.
- Blätter-Funktion: ein Themenblock pro Seite, klickbare Titel-Chips
  (Ansichten, Finden, …), Zurück/Weiter, Punkt-Indikator, Pfeiltasten.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 16:28:30 +01:00
parent e7d42a3320
commit 53f9a51486
3 changed files with 56 additions and 40 deletions

View File

@@ -966,9 +966,34 @@ document.getElementById('fAddTarget').onclick = () => {
}
document.getElementById('btnSettings').onclick = () => openSettings(false)
document.getElementById('btnCloseSettings').onclick = closeSettings
// help / overview dialog (native <dialog>: Esc closes it)
document.getElementById('btnHelp').onclick = () => document.getElementById('helpDlg').showModal()
/* help / overview dialog – paged, one topic group per page (native <dialog>: Esc closes it) */
const HELP_PAGES = [
{ t: 'help.g.views', rows: [['kanban', 'help.board'], ['layout-grid', 'help.gallery'], ['list', 'help.list'], ['list-checks', 'help.tasks'], ['activity', 'help.activity'], ['hard-drive', 'help.storage']] },
{ t: 'help.g.find', rows: [['sliders-horizontal', 'help.mode'], ['search', 'help.search'], ['funnel', 'help.filters']] },
{ t: 'help.g.project', rows: [['pencil', 'help.edit'], ['info', 'help.info'], ['play', 'help.actions'], ['folder-open', 'help.quick']] },
{ t: 'help.g.backup', rows: [['hard-drive-upload', 'help.backup'], ['clock-alert', 'help.due']] },
{ t: 'help.g.misc', rows: [['folders', 'help.folders'], ['languages', 'help.lang'], ['keyboard', 'help.keys']] },
]
let helpPage = 0
function renderHelp() {
helpPage = Math.max(0, Math.min(HELP_PAGES.length - 1, helpPage))
document.getElementById('helpNav').innerHTML = HELP_PAGES.map((p, i) => `<button type="button" class="hnav ${i === helpPage ? 'active' : ''}" data-hp="${i}">${t(p.t)}</button>`).join('')
document.getElementById('helpBody').innerHTML = HELP_PAGES[helpPage].rows.map(([icon, k]) => `<div class="helprow"><span class="hc">${ic(icon)}</span><div>${t(k)}</div></div>`).join('')
document.getElementById('helpDots').innerHTML = HELP_PAGES.map((_, i) => `<i class="${i === helpPage ? 'on' : ''}"></i>`).join('')
document.getElementById('helpPrev').disabled = helpPage === 0
document.getElementById('helpNext').disabled = helpPage === HELP_PAGES.length - 1
document.getElementById('helpBody').scrollTop = 0
}
const gotoHelp = (i) => { helpPage = i; renderHelp() }
document.getElementById('btnHelp').onclick = () => { helpPage = 0; renderHelp(); document.getElementById('helpDlg').showModal() }
document.getElementById('helpClose').onclick = () => document.getElementById('helpDlg').close()
document.getElementById('helpNav').onclick = (e) => { const b = e.target.closest('[data-hp]'); if (b) gotoHelp(+b.dataset.hp) }
document.getElementById('helpPrev').onclick = () => gotoHelp(helpPage - 1)
document.getElementById('helpNext').onclick = () => gotoHelp(helpPage + 1)
document.getElementById('helpDlg').addEventListener('keydown', (e) => {
if (e.key === 'ArrowRight' && helpPage < HELP_PAGES.length - 1) gotoHelp(helpPage + 1)
if (e.key === 'ArrowLeft' && helpPage > 0) gotoHelp(helpPage - 1)
})
document.getElementById('spCancel').onclick = closeSettings
document.getElementById('spSave').onclick = saveSettings
@@ -3190,6 +3215,7 @@ function initLang() {
if (editing) try { openEditor(editing) } catch {}
const sp = document.getElementById('spanel')
if (sp.classList.contains('open')) { I18N.apply(sp); try { renderAutoStatus() } catch {} }
try { if (document.getElementById('helpDlg').open) renderHelp() } catch {}
})
}