From 800fc9ae5aad142078eaf65ba5c25952fbac529a Mon Sep 17 00:00:00 2001 From: Till JS Date: Fri, 24 Apr 2026 14:37:58 +0200 Subject: [PATCH] refactor(picture,wardrobe): extract ImageLightbox, use in garment detail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Picture.ListView's full-screen image modal (~70 lines of inline markup) grew a second caller: the new Anproben-Strip on the wardrobe garment detail page. Linking to `target="_blank"` was a placeholder — the user expects the same inline viewer Picture uses. Extract the lightbox into $lib/modules/picture/components/ImageLightbox.svelte. Picture keeps ownership because the component speaks prompt/model/dims vocabulary against `picture.types.Image`. Module-specific controls go through an `actions` snippet so each caller wires only what makes sense: - Picture ListView renders Favorit + Archivieren in its action slot (unchanged behaviour, shorter file). - Wardrobe DetailGarmentView renders a single "In Picture öffnen" deep-link — Wardrobe doesn't own Favorit/Archiv semantics, the user navigates to Picture for those. Keeps the back-ref clean: every generated image lives in Picture, Wardrobe just previews. Base lightbox handles: - Fixed overlay with backdrop click-to-close - Escape key to close - Image + prompt + model + dimensions + date - Default Schließen button - Fallback icon when publicUrl is missing No logic change for existing users of Picture; one fewer dead target="_blank" tab for Wardrobe. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/lib/modules/picture/ListView.svelte | 99 +++++---------- .../picture/components/ImageLightbox.svelte | 115 ++++++++++++++++++ .../wardrobe/views/DetailGarmentView.svelte | 34 ++++-- 3 files changed, 169 insertions(+), 79 deletions(-) create mode 100644 apps/mana/apps/web/src/lib/modules/picture/components/ImageLightbox.svelte diff --git a/apps/mana/apps/web/src/lib/modules/picture/ListView.svelte b/apps/mana/apps/web/src/lib/modules/picture/ListView.svelte index e3053c11f..90bafde0c 100644 --- a/apps/mana/apps/web/src/lib/modules/picture/ListView.svelte +++ b/apps/mana/apps/web/src/lib/modules/picture/ListView.svelte @@ -25,6 +25,7 @@ } from '@mana/shared-icons'; import { imagesStore } from './stores/images.svelte'; import { pictureViewStore } from './stores/view.svelte'; + import ImageLightbox from './components/ImageLightbox.svelte'; import { useAllImages, useAllImageTags, @@ -393,75 +394,35 @@ - -{#if selectedImage} -
-
-
- {#if selectedImage.publicUrl} - {selectedImage.prompt} - {:else} -
- -
- {/if} -
- -
-

{selectedImage.prompt}

- {#if selectedImage.model} -

Modell: {selectedImage.model}

- {/if} - {#if selectedImage.width && selectedImage.height} -

- {selectedImage.width} × {selectedImage.height} -

- {/if} -

- {new Date(selectedImage.createdAt).toLocaleDateString('de-DE', { - day: 'numeric', - month: 'long', - year: 'numeric', - })} -

- -
- - -
- -
-
-
-
-{/if} + + (selectedImage = null)}> + {#snippet actions()} + {#if selectedImage} + + + {/if} + {/snippet} +