i18n (en/de), simple-ansicht, settings-politur, projekt-löschen

- Sprachsystem: public/i18n.js + public/lang.js (en Default, de), Sprach-Dropdown
  in Einstellungen → Allgemein; komplette UI zweisprachig (HTML + app.js),
  Datum/Zahlen locale-abhängig. Server-Fehlermeldungen bleiben deutsch.
- Einfache Ansicht: Scroll-Fix, Layout-Umschalter (Kacheln/Kompakt/Liste),
  Sortierung, Backup-fällig-Pille.
- Credits: © Michael Media + Discord (Einstellungen → Über, README).
- Settings poliert: Icon-Chip-Überschriften + dezente Unterabschnitte,
  kompaktere Abstände, General sinnvoll geordnet.
- Projekt löschen: Button in Aktionen (Danger Zone) + Endpoint
  POST /api/projects/:name/delete mit Guards (nur echter Unterordner,
  nie _Tools/Root, blockiert bei Scan/Backup), doppelte Bestätigung.
  Backup bleibt unberührt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 16:06:09 +01:00
parent f2d0cd1df9
commit 1cc49ec8d4
7 changed files with 2453 additions and 624 deletions

View File

@@ -128,6 +128,7 @@ function load() {
current = withActive({
roots,
activeRoots: Array.isArray(saved?.activeRoots) ? saved.activeRoots : [saved?.activeRoot],
noneShown: saved?.noneShown === true,
itchProfile: typeof saved?.itchProfile === 'string' ? saved.itchProfile : d.itchProfile,
features: featuresFrom(saved?.features, typeof saved?.itchProfile === 'string' ? saved.itchProfile : d.itchProfile),
backup,
@@ -140,7 +141,9 @@ function load() {
function withActive(s) {
const want = new Set((s.activeRoots ?? [s.activeRoot]).filter(Boolean))
let active = s.roots.filter((r) => want.has(r.id))
if (!active.length && s.roots[0]) active = [s.roots[0]]
// noneShown: deliberately no folder shown (empty dashboard); else at least the first
if (s.noneShown) active = []
else if (!active.length && s.roots[0]) active = [s.roots[0]]
const { activeRoot: _, ...rest } = s
return { ...rest, activeRoots: active.map((r) => r.id), activeRoot: active[0]?.id ?? '', projectsRoot: active[0]?.path ?? '' }
}
@@ -224,8 +227,10 @@ function save(input) {
activeRoots = [roots[i].id]
}
}
const sel = withActive({ roots, activeRoots })
const projectsRoot = sel.projectsRoot
// "no folder shown" stays until a folder is chosen again
const noneShown = !!s.noneShown && !(Array.isArray(input.activeRoots) && input.activeRoots.length)
const sel = withActive({ roots, activeRoots, noneShown })
const projectsRoot = sel.projectsRoot || (noneShown ? roots[0]?.path : '')
if (!projectsRoot || !isDir(projectsRoot)) throw new Error('Der Projektordner existiert nicht.')
let targets = s.backup.targets
if (Array.isArray(input.targets)) {
@@ -265,6 +270,7 @@ function save(input) {
const next = withActive({
roots,
activeRoots: sel.activeRoots,
noneShown,
itchProfile,
features: { ...(s.features ?? featuresFrom(null, itchProfile)), ...(typeof input.features?.itch === 'boolean' ? { itch: input.features.itch } : {}) },
backup: {
@@ -292,10 +298,16 @@ function setActive(ids) {
const s = get()
const list = (Array.isArray(ids) ? ids : [ids]).map(String)
const sel = s.roots.filter((x) => list.includes(x.id))
// [] = show no folder at all (empty dashboard, chosen in the dropdown)
if (!list.filter(Boolean).length) {
current = withActive({ ...s, activeRoots: [], noneShown: true })
persist(current)
return current
}
if (!sel.length) throw new Error('Projektordner nicht gefunden.')
const gone = sel.find((r) => !isDir(r.path))
if (gone) throw new Error(`Projektordner nicht erreichbar: ${gone.path}`)
current = withActive({ ...s, activeRoots: sel.map((r) => r.id) })
current = withActive({ ...s, activeRoots: sel.map((r) => r.id), noneShown: false })
persist(current)
return current
}