From 429c4c85eccb39e97562527934fb7447085eb905 Mon Sep 17 00:00:00 2001 From: Michi Date: Thu, 26 Nov 2026 20:45:07 +0100 Subject: [PATCH] info- & aktionen-tab: abschnitte auf-/zuklappbar fuer besseren ueberblick - section() rendert jetzt
/ mit Chevron - Zustand (offen/zu) pro Abschnitt gemerkt (localStorage dash.secOpen) - Standard: primaere Abschnitte offen, erweiterte eingeklappt - Jump-Links ("-> in Aktionen") klappen das Ziel automatisch auf - Beschreibung bearbeiten klappt den Abschnitt bei Bedarf auf Co-Authored-By: Claude Opus 4.8 --- public/app.js | 28 +++++++++++++++++++++++++--- public/index.html | 11 +++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/public/app.js b/public/app.js index 5a19fa5..b5bed10 100644 --- a/public/app.js +++ b/public/app.js @@ -2505,8 +2505,25 @@ const inProject = (p, folder) => { } // opts: { id } for jump targets, { right } html at the end of the heading +// collapsible panel sections: state (open/closed) is remembered per section across projects. +// default open for primary sections, collapsed for advanced ones (opts.adv) for a calmer overview. +let secOpenMap = (() => { try { return JSON.parse(localStorage.getItem('dash.secOpen') || '{}') } catch { return {} } })() +function sectionOpen(key, def) { return key in secOpenMap ? !!secOpenMap[key] : def } function section(icon, title, body, opts = {}) { - return `

${ic(icon)}${title}${opts.right ? `${opts.right}` : ''}

${body}
` + const key = opts.id || ('sec:' + title) + const open = sectionOpen(key, opts.open ?? !opts.adv) + return `
` + + `

${ic(icon)}${title}${opts.right ? `${opts.right}` : ''}

${ic('chevron-down', 'sm')}
` + + `
${body}
` +} +// persist open/closed when the user toggles a section +function bindSections(root) { + for (const d of root.querySelectorAll('details.coll[data-seckey]')) { + d.addEventListener('toggle', () => { + secOpenMap[d.dataset.seckey] = d.open + try { localStorage.setItem('dash.secOpen', JSON.stringify(secOpenMap)) } catch {} + }) + } } // "→ in Aktionen": switches the tab and scrolls to the section const jumpLink = (id, label = 'Aktionen') => `${label}${ic('arrow-right', 'sm')}` @@ -2514,7 +2531,9 @@ function bindJumps(root) { for (const a of root.querySelectorAll('.jump')) a.onclick = (e) => { e.preventDefault() setSection('actions') - document.getElementById(a.dataset.jump)?.scrollIntoView({ behavior: 'smooth', block: 'start' }) + const tgt = document.getElementById(a.dataset.jump) + if (tgt?.tagName === 'DETAILS') tgt.open = true // expand the section we jump to + tgt?.scrollIntoView({ behavior: 'smooth', block: 'start' }) } } @@ -2603,11 +2622,12 @@ function renderInfo(name, d) { section('git-branch', 'Git', gitBody, { adv: true, right: jumpLink('act-git', g.isRepo ? t('info.pushRemote') : t('set.setup')) }) + (name === '_Tools' || !itchOn() ? '' : section('rocket', 'itch.io', itchBody, { adv: true, right: jumpLink('act-itch', ip.exists ? t('info.view') : t('info.generate')) })) + section('cpu', t('info.tech'), `
${techChips(d.tech.types) || `${t('info.notDetected')}`}${d.tech.needsInstall ? `${ic('download', 'sm')}${t('info.npmNeeded')}` : ''}
`, { adv: true }) + - `

${ic('activity')}${t('tab.activity')}

${t('info.loading')}
` + + section('activity', t('tab.activity'), `
${t('info.loading')}
`, { right: `` }) + section('file-archive', t('info.releaseArchives'), arcBody, { adv: true, right: jumpLink('act-zip', t('info.makeZip')) }) + section('wand-sparkles', t('info.generator'), genBody, { adv: true }) + section('image', t('info.appIcon'), iconBody, { adv: true }) bindJumps(el) + bindSections(el) bindDescription(name, d, el) loadProjectActivity(name) } @@ -2618,6 +2638,7 @@ function bindDescription(name, d, el) { const ta = document.getElementById('fDesc') const link = document.getElementById('btnDescEdit') const open = (text) => { + view.closest('details')?.setAttribute('open', '') // editing while the section is collapsed ta.value = text view.hidden = true edit.hidden = false @@ -2813,6 +2834,7 @@ function renderActions(name, d) { const file = await pickFile(t('prog.pickFor', { name }), d.path) if (file) setProgram(name, file) }) + bindSections(el) bindGit(name, d) bindArchive(name) bindItch(name) diff --git a/public/index.html b/public/index.html index ffc7531..b4bf419 100644 --- a/public/index.html +++ b/public/index.html @@ -283,6 +283,17 @@ .card-sec h4 .i { color: var(--accent); } .dangerzone { border-color: var(--red); background: var(--red-soft); } .dangerzone .hint { color: var(--red); opacity: .95; } + /* collapsible panel sections (Info & Actions): click the header to fold/unfold */ + .card-sec.coll { padding: 0; } + .card-sec.coll > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 7px; padding: 12px 14px; } + .card-sec.coll > summary::-webkit-details-marker { display: none; } + .card-sec.coll > summary:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 12px; } + .card-sec.coll > summary > h4 { margin: 0; flex: 1; min-width: 0; } + .card-sec.coll > summary > .i { color: var(--muted); flex: 0 0 auto; transition: transform .18s; } + .card-sec.coll[open] > summary > .i { transform: rotate(180deg); } + .card-sec.coll > summary > h4 .h4r { margin-bottom: 0; } + .card-sec.coll > .secbody { padding: 0 14px 13px; } + .card-sec.coll[open] > summary { padding-bottom: 8px; } /* README card: collapsible, with rendered-markdown typography */ .mdcard { padding: 0; } .mdcard > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 7px; padding: 12px 14px; }