info- & aktionen-tab: abschnitte auf-/zuklappbar fuer besseren ueberblick
- section() rendert jetzt <details>/<summary> 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 <noreply@anthropic.com>
This commit is contained in:
@@ -2505,8 +2505,25 @@ const inProject = (p, folder) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// opts: { id } for jump targets, { right } html at the end of the heading
|
// 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 = {}) {
|
function section(icon, title, body, opts = {}) {
|
||||||
return `<div class="card-sec${opts.adv ? ' adv' : ''}"${opts.id ? ` id="${opts.id}"` : ''}><h4>${ic(icon)}${title}${opts.right ? `<span class="h4r">${opts.right}</span>` : ''}</h4>${body}</div>`
|
const key = opts.id || ('sec:' + title)
|
||||||
|
const open = sectionOpen(key, opts.open ?? !opts.adv)
|
||||||
|
return `<details class="card-sec coll${opts.adv ? ' adv' : ''}"${opts.id ? ` id="${opts.id}"` : ''} data-seckey="${escapeHtml(key)}"${open ? ' open' : ''}>` +
|
||||||
|
`<summary><h4>${ic(icon)}${title}${opts.right ? `<span class="h4r">${opts.right}</span>` : ''}</h4>${ic('chevron-down', 'sm')}</summary>` +
|
||||||
|
`<div class="secbody">${body}</div></details>`
|
||||||
|
}
|
||||||
|
// 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
|
// "→ in Aktionen": switches the tab and scrolls to the section
|
||||||
const jumpLink = (id, label = 'Aktionen') => `<a href="#" class="jump" data-jump="${id}">${label}${ic('arrow-right', 'sm')}</a>`
|
const jumpLink = (id, label = 'Aktionen') => `<a href="#" class="jump" data-jump="${id}">${label}${ic('arrow-right', 'sm')}</a>`
|
||||||
@@ -2514,7 +2531,9 @@ function bindJumps(root) {
|
|||||||
for (const a of root.querySelectorAll('.jump')) a.onclick = (e) => {
|
for (const a of root.querySelectorAll('.jump')) a.onclick = (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
setSection('actions')
|
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')) }) +
|
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')) })) +
|
(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'), `<div class="chips">${techChips(d.tech.types) || `<span class="hint">${t('info.notDetected')}</span>`}${d.tech.needsInstall ? `<span class="chip warn">${ic('download', 'sm')}${t('info.npmNeeded')}</span>` : ''}</div>`, { adv: true }) +
|
section('cpu', t('info.tech'), `<div class="chips">${techChips(d.tech.types) || `<span class="hint">${t('info.notDetected')}</span>`}${d.tech.needsInstall ? `<span class="chip warn">${ic('download', 'sm')}${t('info.npmNeeded')}</span>` : ''}</div>`, { adv: true }) +
|
||||||
`<div class="card-sec"><h4>${ic('activity')}${t('tab.activity')} <span class="hint" style="font-weight:400;margin:0 0 0 auto" id="actMiniInfo"></span></h4><div id="actMini" class="hmini"><span class="hint">${t('info.loading')}</span></div></div>` +
|
section('activity', t('tab.activity'), `<div id="actMini" class="hmini"><span class="hint">${t('info.loading')}</span></div>`, { right: `<span class="hint" style="font-weight:400" id="actMiniInfo"></span>` }) +
|
||||||
section('file-archive', t('info.releaseArchives'), arcBody, { adv: true, right: jumpLink('act-zip', t('info.makeZip')) }) +
|
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('wand-sparkles', t('info.generator'), genBody, { adv: true }) +
|
||||||
section('image', t('info.appIcon'), iconBody, { adv: true })
|
section('image', t('info.appIcon'), iconBody, { adv: true })
|
||||||
bindJumps(el)
|
bindJumps(el)
|
||||||
|
bindSections(el)
|
||||||
bindDescription(name, d, el)
|
bindDescription(name, d, el)
|
||||||
loadProjectActivity(name)
|
loadProjectActivity(name)
|
||||||
}
|
}
|
||||||
@@ -2618,6 +2638,7 @@ function bindDescription(name, d, el) {
|
|||||||
const ta = document.getElementById('fDesc')
|
const ta = document.getElementById('fDesc')
|
||||||
const link = document.getElementById('btnDescEdit')
|
const link = document.getElementById('btnDescEdit')
|
||||||
const open = (text) => {
|
const open = (text) => {
|
||||||
|
view.closest('details')?.setAttribute('open', '') // editing while the section is collapsed
|
||||||
ta.value = text
|
ta.value = text
|
||||||
view.hidden = true
|
view.hidden = true
|
||||||
edit.hidden = false
|
edit.hidden = false
|
||||||
@@ -2813,6 +2834,7 @@ function renderActions(name, d) {
|
|||||||
const file = await pickFile(t('prog.pickFor', { name }), d.path)
|
const file = await pickFile(t('prog.pickFor', { name }), d.path)
|
||||||
if (file) setProgram(name, file)
|
if (file) setProgram(name, file)
|
||||||
})
|
})
|
||||||
|
bindSections(el)
|
||||||
bindGit(name, d)
|
bindGit(name, d)
|
||||||
bindArchive(name)
|
bindArchive(name)
|
||||||
bindItch(name)
|
bindItch(name)
|
||||||
|
|||||||
@@ -283,6 +283,17 @@
|
|||||||
.card-sec h4 .i { color: var(--accent); }
|
.card-sec h4 .i { color: var(--accent); }
|
||||||
.dangerzone { border-color: var(--red); background: var(--red-soft); }
|
.dangerzone { border-color: var(--red); background: var(--red-soft); }
|
||||||
.dangerzone .hint { color: var(--red); opacity: .95; }
|
.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 */
|
/* README card: collapsible, with rendered-markdown typography */
|
||||||
.mdcard { padding: 0; }
|
.mdcard { padding: 0; }
|
||||||
.mdcard > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 7px; padding: 12px 14px; }
|
.mdcard > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 7px; padding: 12px 14px; }
|
||||||
|
|||||||
Reference in New Issue
Block a user