From 96023394b5d8771d3360a87d821ee7a4126e973d Mon Sep 17 00:00:00 2001 From: Till JS Date: Wed, 8 Apr 2026 23:02:09 +0200 Subject: [PATCH] refactor(mana/web): extract QuickActionsList molecule shared by both widget variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two QuickActionsWidget files lived in parallel under different widget systems — `dashboard/widgets/` (the user-customizable dashboard, i18n keys, 3 actions: credits/feedback/profile) and `core/widgets/` (the mana home screen, hardcoded German strings, 5 actions: todo/calendar/ contacts/context/times). The two rendered the same shape character- for-character: optional emoji-prefixed title + a list of rounded-card links each with icon + label + description. Only the data and a slightly different padding/icon sizing differed. Extract in $lib/components that takes the actions array directly (consumers resolve i18n before passing in). Both widget files become thin wrappers — the dashboard one resolves $_(...) keys and passes the result, the core one passes its hardcoded data with `compact` set. LOC: 110 → 102 across the 3 files (-8 net, plus the shared 70-LOC molecule). Small numerically, but the bigger win is that future changes to the link layout (hover state, padding, icon style) happen once instead of twice — and the two widget files no longer accidentally drift in sizing/spacing. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../lib/components/QuickActionsList.svelte | 75 +++++++++++++++++++ .../widgets/QuickActionsWidget.svelte | 41 +++++----- .../core/widgets/QuickActionsWidget.svelte | 23 +----- 3 files changed, 97 insertions(+), 42 deletions(-) create mode 100644 apps/mana/apps/web/src/lib/components/QuickActionsList.svelte diff --git a/apps/mana/apps/web/src/lib/components/QuickActionsList.svelte b/apps/mana/apps/web/src/lib/components/QuickActionsList.svelte new file mode 100644 index 000000000..a6e696338 --- /dev/null +++ b/apps/mana/apps/web/src/lib/components/QuickActionsList.svelte @@ -0,0 +1,75 @@ + + + +
+ {#if title} +
+

+ {#if titleIcon}{@html titleIcon}{/if} + {title} +

+
+ {/if} + + +
diff --git a/apps/mana/apps/web/src/lib/components/dashboard/widgets/QuickActionsWidget.svelte b/apps/mana/apps/web/src/lib/components/dashboard/widgets/QuickActionsWidget.svelte index c8aaeeefc..53e87710a 100644 --- a/apps/mana/apps/web/src/lib/components/dashboard/widgets/QuickActionsWidget.svelte +++ b/apps/mana/apps/web/src/lib/components/dashboard/widgets/QuickActionsWidget.svelte @@ -1,9 +1,12 @@ -
-

- - {$_('dashboard.widgets.quick_actions.title')} -

- - -
+ diff --git a/apps/mana/apps/web/src/lib/modules/core/widgets/QuickActionsWidget.svelte b/apps/mana/apps/web/src/lib/modules/core/widgets/QuickActionsWidget.svelte index cad049539..dd66d7bbd 100644 --- a/apps/mana/apps/web/src/lib/modules/core/widgets/QuickActionsWidget.svelte +++ b/apps/mana/apps/web/src/lib/modules/core/widgets/QuickActionsWidget.svelte @@ -3,7 +3,9 @@ * QuickActionsWidget — Schnellzugriff-Buttons für häufige Aktionen. * * Navigiert direkt zu den jeweiligen App-Routen innerhalb der Unified App. + * Thin wrapper around in compact mode. */ + import QuickActionsList from '$lib/components/QuickActionsList.svelte'; const actions = [ { @@ -39,23 +41,4 @@ ]; -
-
-

Schnellzugriff

-
- - -
+