From c1d643ffb5f4ee06aab9569c088d966fce17442e Mon Sep 17 00:00:00 2001 From: Till JS Date: Fri, 24 Apr 2026 17:15:25 +0200 Subject: [PATCH] feat(writing): register Writing as a Workbench card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Writing is now pickable from the Workbench AppPagePicker and can run side-by-side with the other module cards. Previously only reachable via direct navigation to /writing. - app-registry: registerApp({ id: 'writing', icon: NotePencil, color: '#0ea5e9', list: ListView }) with a "Neuer Draft" context-menu action that dispatches mana:quick-action (same convention as library/notes/ quiz — the event channel is the standard cross-card hook). - writing ListView: onMount listener for the mana:quick-action event flips showCreate=true when { app:'writing', action:'new' } fires, so the kebab menu → "Neuer Draft" opens the inline BriefingForm instead of being a no-op. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../apps/web/src/lib/app-registry/apps.ts | 29 +++++++++++++++++-- .../lib/modules/writing/views/ListView.svelte | 16 ++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/apps/mana/apps/web/src/lib/app-registry/apps.ts b/apps/mana/apps/web/src/lib/app-registry/apps.ts index f1e687683..6caf33f68 100644 --- a/apps/mana/apps/web/src/lib/app-registry/apps.ts +++ b/apps/mana/apps/web/src/lib/app-registry/apps.ts @@ -1,3 +1,4 @@ +import { formatDate } from '$lib/i18n/format'; /** * Unified App Registrations — All app descriptors in one file. * @@ -79,6 +80,7 @@ import { Exam, Globe, CoatHanger, + NotePencil, } from '@mana/shared-icons'; // ── Apps with entity capabilities ─────────────────────────── @@ -119,7 +121,7 @@ registerApp({ }, getDisplayData: (item) => ({ title: (item.title as string) || 'Aufgabe', - subtitle: item.dueDate ? new Date(item.dueDate as string).toLocaleDateString('de') : undefined, + subtitle: item.dueDate ? formatDate(new Date(item.dueDate as string)) : undefined, }), createItem: async (data) => { const { tasksStore } = await import('$lib/modules/todo/stores/tasks.svelte'); @@ -180,7 +182,7 @@ registerApp({ getDisplayData: (item) => ({ title: (item.title as string) || 'Termin', subtitle: item.startDate - ? new Date(item.startDate as string).toLocaleDateString('de', { + ? formatDate(new Date(item.startDate as string), { day: '2-digit', month: '2-digit', hour: '2-digit', @@ -1330,6 +1332,29 @@ registerApp({ ], }); +registerApp({ + id: 'writing', + name: 'Writing', + color: '#0ea5e9', + icon: NotePencil, + views: { + // Detail view (/writing/draft/[id]) uses goto() from the list view, + // same pattern as library. Workbench detail-slot not wired yet. + list: { load: () => import('$lib/modules/writing/ListView.svelte') }, + }, + contextMenuActions: [ + { + id: 'new-draft', + label: 'Neuer Draft', + icon: Plus, + action: () => + window.dispatchEvent( + new CustomEvent('mana:quick-action', { detail: { app: 'writing', action: 'new' } }) + ), + }, + ], +}); + registerApp({ id: 'spaces', name: 'Spaces', diff --git a/apps/mana/apps/web/src/lib/modules/writing/views/ListView.svelte b/apps/mana/apps/web/src/lib/modules/writing/views/ListView.svelte index 20adfee7c..d605054b6 100644 --- a/apps/mana/apps/web/src/lib/modules/writing/views/ListView.svelte +++ b/apps/mana/apps/web/src/lib/modules/writing/views/ListView.svelte @@ -6,6 +6,7 @@ unstarted draft. -->