widget icon rework, widget grouping rework

This commit is contained in:
Matthias Hochmeister
2026-04-14 10:53:03 +02:00
parent 4fbea8af81
commit 588d8e81db
22 changed files with 245 additions and 327 deletions

View File

@@ -74,7 +74,7 @@ import type {
Kategorie,
Transaktion, TransaktionFormData, TransaktionFilters,
TransaktionTyp,
TransaktionStatus,
AusgabenTyp,
WiederkehrendBuchung, WiederkehrendFormData,
WiederkehrendIntervall,
@@ -83,14 +83,11 @@ import type {
TransferFormData,
} from '../types/buchhaltung.types';
import {
TRANSAKTION_STATUS_LABELS,
TRANSAKTION_STATUS_COLORS,
TRANSAKTION_TYP_LABELS,
INTERVALL_LABELS,
KONTO_ART_LABELS,
} from '../types/buchhaltung.types';
import { StatusChip } from '../components/templates';
// ─── helpers ───────────────────────────────────────────────────────────────────

View File

@@ -181,12 +181,21 @@ function Dashboard() {
for (const k of (groupKeys as string[])) allSavedKeys.add(k);
}
// Widgets in custom groups take priority — don't let built-in groups claim them
const customGroupKeys = new Set<string>();
if (preferences.customGroups) {
for (const cg of preferences.customGroups as { name: string; title: string }[]) {
const cgOrder = preferences.widgetOrder[cg.name] as string[] | undefined;
if (cgOrder) { for (const k of cgOrder) customGroupKeys.add(k); }
}
}
for (const group of Object.keys(DEFAULT_ORDER)) {
if (preferences.widgetOrder[group]) {
// Merge: saved order first, then any new widgets not in saved order
// Merge: saved order first (excluding custom-group widgets), then new widgets
const saved = preferences.widgetOrder[group] as string[];
const allKeys = DEFAULT_ORDER[group];
const ordered = saved.filter((k: string) => allKeys.includes(k));
const ordered = saved.filter((k: string) => allKeys.includes(k) && !customGroupKeys.has(k));
const remaining = allKeys.filter((k) => !allSavedKeys.has(k));
merged[group] = [...ordered, ...remaining];
}
@@ -377,7 +386,9 @@ function Dashboard() {
if (keys.includes(widgetKey)) { targetGroup = group; break; }
}
if (!updatedOrder[targetGroup]) updatedOrder[targetGroup] = [];
updatedOrder[targetGroup].push(widgetKey);
if (!updatedOrder[targetGroup].includes(widgetKey)) {
updatedOrder[targetGroup].push(widgetKey);
}
}
const updatedCustomGroups = localCustomGroups.filter((g) => g.name !== groupName);