From f0f308e5b0dfc5f67bc5b8cc20a94b2d267cd97d Mon Sep 17 00:00:00 2001 From: timlohse1104 Date: Mon, 16 Mar 2026 00:58:20 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Replace=20inline=20create-forms?= =?UTF-8?q?=20in=20memorandum=20and=20jokes=20with=20FAB=20+=20modal=20pat?= =?UTF-8?q?tern.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 2 + docs/features/jokes.md | 13 ++ docs/features/memorandum.md | 20 +++ .../components/jokes/CreateJokeOverlay.svelte | 108 ++++++++++++++++ .../src/lib/components/jokes/Jokes.svelte | 118 ++++-------------- .../components/memorandum/FolderArea.svelte | 43 +++---- .../memorandum/FolderOverlay.svelte | 68 +++++++--- frontend/src/lib/config/de.json | 3 + frontend/src/lib/config/en.json | 3 + frontend/src/routes/memorandum/+page.svelte | 8 +- 10 files changed, 242 insertions(+), 144 deletions(-) create mode 100644 frontend/src/lib/components/jokes/CreateJokeOverlay.svelte diff --git a/CHANGELOG.md b/CHANGELOG.md index e55d2c72..6451a773 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- [memorandum] Ordner-Erstellung über FAB + Modal statt direkter Erstellung; FAB immer sichtbar; Zero-State öffnet ebenfalls das Modal. +- [jokes] Inline-Witz-Formular durch FAB + Modal ersetzt; Seite zeigt nur noch den Zufallswitz-Bereich. - [hitstar] Remove Spotify embed (full iframe) from the reveal phase; only round tracker, abort button, flipped track card and next-round button are shown after guessing. - [hitstar] Spotify track search now uses a single random year (1955–2025) per request instead of a fixed range to improve year distribution across decades. - [hitstar] Add `genre:pop` filter to Spotify search query to increase the share of well-known tracks. diff --git a/docs/features/jokes.md b/docs/features/jokes.md index edb0596c..8c0bd07d 100644 --- a/docs/features/jokes.md +++ b/docs/features/jokes.md @@ -99,6 +99,19 @@ Keys under `jokes.*` in translation files. --- +## Frontend Components + +| Component | Description | +|-----------|-------------| +| `frontend/src/lib/components/jokes/Jokes.svelte` | Main page component — shows random joke area only | +| `frontend/src/lib/components/jokes/CreateJokeOverlay.svelte` | Carbon Modal for creating a new joke (FAB-triggered) | + +### Create Joke Pattern + +Joke creation uses a FAB (fixed primary button, bottom-right) that opens a Carbon Modal (`CreateJokeOverlay.svelte`). The modal contains a `TextArea` for the joke text and a `Select` for language (`de`/`en`). On success: `celebrate()` + `InlineNotification` + auto-close after ~1.5 s. The inline form that was previously embedded directly on the page has been removed. + +--- + ## Key Implementation Notes - `persistDailyJoke()` sets `verified: true` on all auto-fetched jokes. diff --git a/docs/features/memorandum.md b/docs/features/memorandum.md index 4185d2e5..8e9e5da0 100644 --- a/docs/features/memorandum.md +++ b/docs/features/memorandum.md @@ -91,6 +91,26 @@ Keys under `memorandum.*` in translation files. --- +## Frontend Components + +| Component | Description | +|-----------|-------------| +| `frontend/src/lib/components/memorandum/FolderArea.svelte` | Main folder grid; FAB always visible | +| `frontend/src/lib/components/memorandum/FolderOverlay.svelte` | Dual-mode Carbon Modal: **create** (FAB) and **edit** (context menu) | +| `frontend/src/lib/components/memorandum/LinkOverlay.svelte` | Modal for creating/editing links | +| `frontend/src/lib/components/memorandum/Startup.svelte` | Zero-state screen with "create folder" CTA | + +### Folder Create/Edit Pattern + +`FolderOverlay.svelte` handles both modes via `type = $derived(currentFolderId ? 'edit' : 'new')`: + +- **Create** (FAB in `FolderArea.svelte`): `bind:open={createFolderModalOpen}`, no `currentFolderId` → pre-fills default name, resets color sliders, pushes new `FolderClass` to `$localPresetStore`, calls `celebrate()`. +- **Edit** (context menu in `Folder.svelte`): `bind:open={$folderOverlayOptionsStore.showOverlay}` in `+page.svelte`, `currentFolderId` is set → loads persisted name and background color. + +The FAB is **always visible** (not gated on `Folders.length > 0`). The zero-state screen also opens the create modal via its CTA button. + +--- + ## Key Implementation Notes - Memorandum has **no dedicated MongoDB schema** — all data lives in the shared Keystore collection. diff --git a/frontend/src/lib/components/jokes/CreateJokeOverlay.svelte b/frontend/src/lib/components/jokes/CreateJokeOverlay.svelte new file mode 100644 index 00000000..30f3d4ee --- /dev/null +++ b/frontend/src/lib/components/jokes/CreateJokeOverlay.svelte @@ -0,0 +1,108 @@ + + + + {#if $initialized} +