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 <noreply@anthropic.com>
This commit is contained in:
@@ -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 `<span class="heldot ${cls}" title="${window.I18N.t('attention.h.' + cls)}"></span>`
|
||||
}
|
||||
|
||||
/* ── 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 ? `<button type="button" class="tchip" data-q="${q}">${ic(icon, 'sm')}<b>${n}</b> ${label}</button>` : ''
|
||||
const nav = (icon, inner, view) => `<button type="button" class="tchip" data-view="${view}">${ic(icon, 'sm')}${inner}</button>`
|
||||
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', `<b>${openTasks}</b> ${t('today.openTasks')}`, 'tasks') : '')
|
||||
+ (cleanMB >= 1 ? nav('brush-cleaning', `<b>${fmtMB(cleanMB)}</b> ${t('today.cleanable')}`, 'storage') : '')
|
||||
const cards = recent.map((p) => `<div class="tcard" data-open="${escapeHtml(p.name)}" role="button" tabindex="0">
|
||||
${avatar(p)}<span class="tc-main"><span class="tc-name">${escapeHtml(p.name)}</span><span class="tc-sub">${statusHtml(p.status)}<span class="hint">· ${timeAgo(lastActivity(p))}</span></span></span>${qsGroup(p, true, false)}</div>`).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 ? `<div class="attention ${attnOpen ? '' : 'closed'}">
|
||||
<div class="att-head">
|
||||
<div class="att-title">${ic('shield-alert', 'sm')}${t('attention.title', { n: attn.length })}</div>
|
||||
<button type="button" class="today-toggle att-toggle" title="${t('today.toggle')}">${ic('chevron-down', 'sm')}</button>
|
||||
</div>
|
||||
<div class="att-body">${attnShown.map((p) => `<div class="atrow" data-open="${escapeHtml(p.name)}" role="button" tabindex="0">
|
||||
${healthDot(p)}${avatar(p)}<span class="at-name">${escapeHtml(p.name)}</span>
|
||||
<span class="at-issues">${attentionOf(p).map((i) => `<span class="chip warn">${ic(i.icon, 'sm')}${escapeHtml(i.label)}</span>`).join('')}</span></div>`).join('')}
|
||||
${attn.length > attnShown.length ? `<div class="hint att-more">${t('attention.more', { n: attn.length - attnShown.length })}</div>` : ''}</div>
|
||||
</div>` : ''
|
||||
|
||||
band.innerHTML = `<div class="today ${todayOpen ? '' : 'closed'}">
|
||||
<div class="today-head">
|
||||
<div><div class="today-greet">${greet}</div><div class="today-date">${dateStr}</div></div>
|
||||
@@ -1812,15 +1854,20 @@ function renderToday() {
|
||||
<button type="button" class="today-toggle" title="${t('today.toggle')}">${ic('chevron-down', 'sm')}</button>
|
||||
</div>
|
||||
<div class="today-body">${cards}${recent.length ? `<a href="#" class="jump today-act">${ic('activity', 'sm')}${t('today.activity')}</a>` : ''}</div>
|
||||
</div>`
|
||||
</div>${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 `<div class="clgroup"><div class="clg-head">${escapeHtml(name)}<span class="hint">${fmtMB1(sub)}</span></div>
|
||||
${rs.map((r) => `<label class="clrow"><input type="checkbox" data-k="${escapeHtml(cleanKey(r))}" ${cleanSel.has(cleanKey(r)) ? 'checked' : ''}>
|
||||
<span class="cl-path">${escapeHtml(inProject(r.path, r.p.folder))}</span>
|
||||
<span class="sttier" title="${r.tier ? tierHint(r.tier) : ''}"><i style="background:${tierVar(r.tier)}"></i>${TIER_SHORT[r.tier]}</span>
|
||||
<span class="cl-mb">${fmtMB1(r.mb)}</span></label>`).join('')}</div>`
|
||||
}).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')}`
|
||||
|
||||
@@ -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 @@
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<dialog id="cleanDlg" class="dlg wide">
|
||||
<div class="ihead">
|
||||
<h3><svg class="i lg"><use href="/icons.svg#brush-cleaning"/></svg><span data-i18n="clean.dlg.title">Delete these folders?</span></h3>
|
||||
<span class="sp"></span>
|
||||
<button class="iconbtn" type="button" id="cleanDlgClose" data-i18n-title="common.closeEsc" title="Close (Esc)"><svg class="i"><use href="/icons.svg#x"/></svg></button>
|
||||
</div>
|
||||
<div id="cleanDlgBody"></div>
|
||||
<div class="nestfoot">
|
||||
<span class="hint" data-i18n="st.regenHint">These folders are regenerated on the next build / run.</span>
|
||||
<span class="sp"></span>
|
||||
<button class="btn" type="button" id="cleanDlgCancel" data-i18n="common.cancel">Cancel</button>
|
||||
<button class="btn danger" type="button" id="cleanDlgOk"></button>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<dialog id="helpDlg" class="dlg wide">
|
||||
<div class="ihead">
|
||||
<h3><svg class="i lg"><use href="/icons.svg#life-buoy"/></svg><span data-i18n="help.title">Help & overview</span></h3>
|
||||
|
||||
@@ -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': '<b>Welcome!</b> 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': '<b>1 · Project folders</b> – 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': '<b>Willkommen!</b> Wir richten das Dashboard in drei kurzen Schritten ein: Projektordner, Backup (optional) und Allgemein. Klick auf „Weiter“, wenn du bereit bist.',
|
||||
'tour.setup.folders': '<b>1 · Projektordner</b> – trag den Ordner ein, in dem deine Projekte liegen (oder „Durchsuchen…“). Jeder Unterordner wird ein Projekt. Mehrere sind möglich.',
|
||||
|
||||
Reference in New Issue
Block a user