From b7d37ee22bb8c875effb5abc5ecdb552ce2ef301 Mon Sep 17 00:00:00 2001 From: Michi Date: Thu, 26 Nov 2026 23:50:29 +0100 Subject: [PATCH] home-ueberblick: 'braucht aufmerksamkeit' + cleanup-dialog + tasks/speicher-chips - Home-Panel 'Braucht Aufmerksamkeit': Projekte mit offenen Punkten (kein Remote, Backup faellig, uncommitted, aufraeumbar, npm install, kein Icon), Health-Punkt je Zeile, einklappbar, Klick oeffnet Projekt - Heute-Band: klickbare Chips 'N offene Aufgaben' -> Tasks-Ansicht und 'X GB freiraeumbar' -> Speicher-Ansicht (auch im Einfach-Modus auffindbar) - Speicher-Loeschen: statt Browser-confirm ein In-App-Dialog, der genau auflistet was geloescht wird (je Projekt gruppiert, Haken pro Eintrag, Live-Gesamtgroesse), bestehende Loeschlogik dahinter Co-Authored-By: Claude Opus 4.8 --- public/app.js | 96 ++++++++++++++++++++++++++++++++++++++++++++--- public/index.html | 48 ++++++++++++++++++++++++ public/lang.js | 20 ++++++++++ 3 files changed, 159 insertions(+), 5 deletions(-) diff --git a/public/app.js b/public/app.js index b5bed10..8f0f67e 100644 --- a/public/app.js +++ b/public/app.js @@ -272,6 +272,26 @@ function warnChips(p) { return b.join('') } +// Things a project could use a hand with, reusing the quick-filter signals. sev: 3 high, 2 medium, 1 low. +function attentionOf(p) { + const T = window.I18N.t + const out = [] + if (p.git?.level === 'red') out.push({ icon: 'cloud-off', label: T('quick.nobackup'), sev: 3 }) + if (backupDue(p)) out.push({ icon: 'clock-alert', label: T('quick.due'), sev: 3 }) + if (p.git?.level === 'yellow') out.push({ icon: 'cloud-upload', label: T('quick.unsaved'), sev: 2 }) + if (deletableMB(p) >= 100) out.push({ icon: 'brush-cleaning', label: fmtMB(deletableMB(p)), sev: 2 }) + if (p.tech?.needsInstall) out.push({ icon: 'download', label: 'npm install', sev: 2 }) + if (!p.hasIcon) out.push({ icon: 'image-off', label: T('warn.noIcon'), sev: 1 }) + return out +} +const attnSeverity = (p) => attentionOf(p).reduce((m, i) => Math.max(m, i.sev), 0) +// small green/yellow/red health dot (highest severity wins) +function healthDot(p) { + const s = attnSeverity(p) + const cls = s >= 3 ? 'red' : s === 2 ? 'yellow' : s === 1 ? 'low' : 'ok' + return `` +} + /* ── data ─────────────────────────────────────────────────────────────── */ let rootDir = '' // first shown projects folder @@ -1789,6 +1809,7 @@ const HL_SORT = [{ k: 'mtime', key: 'flt.sort.mtime' }, { k: 'name', key: 'flt.s // "Today" band on the home page: greeting, continue-where-you-left-off, quick stats. From the loaded // projects only (no extra request). Shown on the default home (no filter, no search). let todayOpen = (() => { try { return localStorage.getItem('dash.todayOpen') !== '0' } catch { return true } })() +let attnOpen = (() => { try { return localStorage.getItem('dash.attnOpen') !== '0' } catch { return true } })() function renderToday() { const band = document.getElementById('todayBand') if (!band) return @@ -1801,10 +1822,31 @@ function renderToday() { const h = new Date().getHours() const greet = t(h < 5 ? 'today.night' : h < 11 ? 'today.morning' : h < 17 ? 'today.day' : h < 22 ? 'today.evening' : 'today.night') const dateStr = new Date().toLocaleDateString(I18N.locale(), { weekday: 'long', day: 'numeric', month: 'long' }) + const openTasks = projects.reduce((n, p) => n + (p.tasks ?? []).filter((x) => !x.done).length, 0) + const cleanMB = totals?.scanned ? totals.allMB : 0 const chip = (icon, n, label, q) => n ? `` : '' + const nav = (icon, inner, view) => `` const stats = chip('file-pen', changed, t('today.changed'), 'all') + chip('clock-alert', due, t('today.due'), 'due') + chip('rocket', active, t('today.active'), 'active') + + (openTasks ? nav('list-checks', `${openTasks} ${t('today.openTasks')}`, 'tasks') : '') + + (cleanMB >= 1 ? nav('brush-cleaning', `${fmtMB(cleanMB)} ${t('today.cleanable')}`, 'storage') : '') const cards = recent.map((p) => `
${avatar(p)}${escapeHtml(p.name)}${statusHtml(p.status)}· ${timeAgo(lastActivity(p))}${qsGroup(p, true, false)}
`).join('') + + // "needs attention": projects with open issues, highest severity first + const attn = live.filter((p) => p.name !== '_Tools' && attentionOf(p).length) + .sort((a, b) => attnSeverity(b) - attnSeverity(a) || a.name.localeCompare(b.name, 'de')) + const attnShown = attn.slice(0, 6) + const attnHtml = attn.length ? `
+
+
${ic('shield-alert', 'sm')}${t('attention.title', { n: attn.length })}
+ +
+
${attnShown.map((p) => `
+ ${healthDot(p)}${avatar(p)}${escapeHtml(p.name)} + ${attentionOf(p).map((i) => `${ic(i.icon, 'sm')}${escapeHtml(i.label)}`).join('')}
`).join('')} + ${attn.length > attnShown.length ? `
${t('attention.more', { n: attn.length - attnShown.length })}
` : ''}
+
` : '' + band.innerHTML = `
${greet}
${dateStr}
@@ -1812,15 +1854,20 @@ function renderToday() {
${cards}${recent.length ? `${ic('activity', 'sm')}${t('today.activity')}` : ''}
-
` + ${attnHtml}` band.querySelector('.today-toggle').onclick = () => { todayOpen = !todayOpen; try { localStorage.setItem('dash.todayOpen', todayOpen ? '1' : '0') } catch {}; band.querySelector('.today').classList.toggle('closed', !todayOpen) } - for (const b of band.querySelectorAll('.tchip')) b.onclick = () => { homeStatus = b.dataset.q; renderHome() } + band.querySelector('.att-toggle')?.addEventListener('click', (e) => { e.stopPropagation(); attnOpen = !attnOpen; try { localStorage.setItem('dash.attnOpen', attnOpen ? '1' : '0') } catch {}; band.querySelector('.attention').classList.toggle('closed', !attnOpen) }) + for (const b of band.querySelectorAll('.tchip')) b.onclick = () => { if (b.dataset.view) setView(b.dataset.view); else { homeStatus = b.dataset.q; renderHome() } } band.querySelector('.today-act')?.addEventListener('click', (e) => { e.preventDefault(); setView('activity') }) for (const b of band.querySelectorAll('.tcard')) { const p = projects.find((x) => x.name === b.dataset.open) b.onclick = (e) => { if (!e.target.closest('.qsg')) openEditor(p) } wireQuickStart(b, p) } + for (const r of band.querySelectorAll('.atrow')) { + const p = projects.find((x) => x.name === r.dataset.open) + r.onclick = () => openEditor(p) + } } function renderHome() { @@ -2336,11 +2383,50 @@ document.getElementById('stHogs').addEventListener('click', (e) => { if (cb.checked) stSelected.add(tr.dataset.k); else stSelected.delete(tr.dataset.k) updateHogSel() }) -document.getElementById('stDelete').onclick = async () => { - const sel = (renderHogs.rows ?? []).filter((r) => stSelected.has(`${r.p.name}|${r.path}`)) +// Cleanup confirmation: a proper in-app dialog that lists exactly what gets deleted, grouped by project, +// with per-item checkboxes and a live total, instead of a bare browser confirm(). +let cleanRows = [] // snapshot shown in the dialog +let cleanSel = new Set() // keys still ticked inside the dialog +const cleanKey = (r) => `${r.p.name}|${r.path}` +document.getElementById('stDelete').onclick = () => { + cleanRows = (renderHogs.rows ?? []).filter((r) => stSelected.has(cleanKey(r))) + if (!cleanRows.length) return + cleanSel = new Set(cleanRows.map(cleanKey)) + renderCleanDialog() + document.getElementById('cleanDlg').showModal() +} +function updateCleanOk() { + const mb = cleanRows.filter((r) => cleanSel.has(cleanKey(r))).reduce((s, r) => s + r.mb, 0) + const btn = document.getElementById('cleanDlgOk') + btn.disabled = !cleanSel.size + btn.innerHTML = `${ic('trash')}${window.I18N.t('clean.dlg.ok', { size: fmtMB1(mb) })}` +} +function renderCleanDialog() { + const byProj = new Map() + for (const r of cleanRows) byProj.set(r.p.name, [...(byProj.get(r.p.name) ?? []), r]) + const body = document.getElementById('cleanDlgBody') + body.innerHTML = [...byProj].map(([name, rs]) => { + const sub = rs.reduce((s, r) => s + r.mb, 0) + return `
${escapeHtml(name)}${fmtMB1(sub)}
+ ${rs.map((r) => ``).join('')}
` + }).join('') + for (const cb of body.querySelectorAll('input[data-k]')) cb.onchange = () => { + if (cb.checked) cleanSel.add(cb.dataset.k); else cleanSel.delete(cb.dataset.k) + updateCleanOk() + } + updateCleanOk() +} +const closeCleanDlg = () => document.getElementById('cleanDlg').close() +document.getElementById('cleanDlgClose').onclick = closeCleanDlg +document.getElementById('cleanDlgCancel').onclick = closeCleanDlg +document.getElementById('cleanDlgOk').onclick = async () => { + const sel = cleanRows.filter((r) => cleanSel.has(cleanKey(r))) if (!sel.length) return + closeCleanDlg() const mb = sel.reduce((s, r) => s + r.mb, 0) - if (!confirm(t('st.confirmDelete', { n: sel.length, size: fmtMB1(mb) }) + '\n\n' + sel.map((r) => `${r.p.name}: ${inProject(r.path, r.p.folder)}`).join('\n') + '\n\n' + t('st.regenHint'))) return const btn = document.getElementById('stDelete') btn.disabled = true btn.innerHTML = `${ic('loader')}${t('st.deleting')}` diff --git a/public/index.html b/public/index.html index b4bf419..02b332e 100644 --- a/public/index.html +++ b/public/index.html @@ -375,6 +375,26 @@ .tcard .tc-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; min-width: 0; } .tcard .qsg { margin-left: auto; } .today-act { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--accent-text); font-weight: 600; text-decoration: none; width: max-content; } + /* "Needs attention" panel on the home page */ + .attention { border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(120deg, color-mix(in srgb, var(--yellow) 12%, transparent), transparent 70%), var(--surface); padding: 12px 16px; margin-bottom: 14px; } + .att-head { display: flex; align-items: center; gap: 10px; } + .att-title { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; } + .att-title .i { color: var(--yellow); } + .att-head .today-toggle { margin-left: auto; } + .attention.closed .today-toggle .i { transform: rotate(-90deg); } + .att-body { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; } + .attention.closed .att-body { display: none; } + .atrow { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); cursor: pointer; transition: border-color .12s, transform .12s; } + .atrow:hover { border-color: var(--accent); transform: translateX(2px); } + .atrow .avatar { width: 30px; height: 30px; flex: 0 0 30px; } + .atrow .at-name { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; } + .atrow .at-issues { display: flex; gap: 5px; flex-wrap: wrap; margin-left: auto; justify-content: flex-end; } + .att-more { margin-top: 2px; } + .heldot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--hc) 22%, transparent); background: var(--hc); --hc: var(--green); } + .heldot.red { --hc: var(--red); } + .heldot.yellow { --hc: var(--yellow); } + .heldot.low { --hc: var(--muted); } + .heldot.ok { --hc: var(--green); } /* activity page */ #activity.active { overflow-y: auto; overflow-x: hidden; padding-right: 4px; } .heatscroll { overflow-x: auto; padding-bottom: 4px; } @@ -775,6 +795,19 @@ .dlg.wide .ihead { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; } .dlg.wide .ihead h3 { margin: 0; display: flex; gap: 8px; align-items: center; font-size: 16px; } .dlg.wide .ihead .sp { flex: 1; } + /* cleanup confirm dialog: scrollable grouped checklist */ + #cleanDlg { width: 620px; margin: auto; } + #cleanDlg[open] { display: flex; flex-direction: column; } + #cleanDlgBody { overflow: auto; padding: 6px 20px 2px; } + .clgroup { margin-top: 12px; } + .clgroup:first-child { margin-top: 4px; } + .clg-head { display: flex; align-items: baseline; gap: 8px; font-weight: 700; font-size: 13px; margin-bottom: 3px; } + .clg-head .hint { margin-left: auto; font-weight: 400; } + .clrow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; } + .clrow:hover { background: var(--surface-2); } + .clrow .cl-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); } + .clrow .cl-mb { font-variant-numeric: tabular-nums; } + #cleanDlg .nestfoot .danger { font-weight: 600; } /* only style the OPEN dialog as flex – otherwise this overrides the UA display:none and it can never close */ #helpDlg { width: 560px; max-height: calc(100vh - 80px); margin: auto; } #helpDlg[open] { display: flex; flex-direction: column; } @@ -1482,6 +1515,21 @@ + +
+

Delete these folders?

+ + +
+
+
+ These folders are regenerated on the next build / run. + + + +
+
+

Help & overview

diff --git a/public/lang.js b/public/lang.js index 530f0c8..2c5ad00 100644 --- a/public/lang.js +++ b/public/lang.js @@ -103,6 +103,8 @@ window.LANG = { 'st.hogs': 'Biggest space hogs', 'st.hogs.hint': '– folders that can be regenerated', 'st.deleteSelected': 'Delete selected', + 'clean.dlg.title': 'These folders will be deleted', + 'clean.dlg.ok': 'Delete {size}', /* tasks view */ 'task.open': 'Open', @@ -785,6 +787,14 @@ window.LANG = { 'today.active': 'active', 'today.toggle': 'Collapse / expand', 'today.activity': 'See full activity', + 'today.openTasks': 'open tasks', + 'today.cleanable': 'cleanable', + 'attention.title': 'Needs attention: {n}', + 'attention.more': '+{n} more', + 'attention.h.red': 'Needs attention', + 'attention.h.yellow': 'Could use a tidy-up', + 'attention.h.low': 'Minor polish', + 'attention.h.ok': 'All good', 'help.g.setup': 'Setup', 'tour.setup.welcome': 'Welcome! Let’s set up the dashboard in three short steps: project folders, backup (optional) and general settings. Use “Next” whenever you’re ready.', 'tour.setup.folders': '1 · Project folders – enter the folder that holds your projects (or “Browse…”). Every subfolder becomes a project. You can add several.', @@ -897,6 +907,8 @@ window.LANG = { 'st.hogs': 'Größte Speicherfresser', 'st.hogs.hint': '– Ordner, die sich neu erzeugen lassen', 'st.deleteSelected': 'Ausgewählte löschen', + 'clean.dlg.title': 'Diese Ordner werden gelöscht', + 'clean.dlg.ok': '{size} löschen', /* tasks view */ 'task.open': 'Offen', @@ -1579,6 +1591,14 @@ window.LANG = { 'today.active': 'aktiv', 'today.toggle': 'Ein-/ausklappen', 'today.activity': 'Volle Aktivität ansehen', + 'today.openTasks': 'offene Aufgaben', + 'today.cleanable': 'freiräumbar', + 'attention.title': 'Braucht Aufmerksamkeit: {n}', + 'attention.more': '+{n} weitere', + 'attention.h.red': 'Braucht Aufmerksamkeit', + 'attention.h.yellow': 'Könnte aufgeräumt werden', + 'attention.h.low': 'Kleiner Feinschliff', + 'attention.h.ok': 'Alles gut', 'help.g.setup': 'Einrichten', 'tour.setup.welcome': 'Willkommen! Wir richten das Dashboard in drei kurzen Schritten ein: Projektordner, Backup (optional) und Allgemein. Klick auf „Weiter“, wenn du bereit bist.', 'tour.setup.folders': '1 · Projektordner – trag den Ordner ein, in dem deine Projekte liegen (oder „Durchsuchen…“). Jeder Unterordner wird ein Projekt. Mehrere sind möglich.',