From 2d86c6d429871005170e2817184d2a587f29c2fb Mon Sep 17 00:00:00 2001 From: Till JS Date: Thu, 23 Apr 2026 00:38:14 +0200 Subject: [PATCH] refactor(picture): unify ListView for carousel + route contexts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merges the feature-rich gallery (search, tag filters, favorites toggle, view-mode toggles, detail modal) that previously lived in routes/(app)/picture/+page.svelte INTO modules/picture/ListView.svelte, and keeps the upload affordances (drag-and-drop, upload button, progress chips) from the old ListView. Route shrinks to a 3-liner: . Responsive behaviour uses CSS container queries (@container inline-size) on the ListView root. Below ~560px (carousel card width) the search bar, tag chips and view-mode toggles hide; action-strip buttons drop to icon-only. Above that breakpoint (route context, ≥~720px up to the layout's max-w-7xl) everything is visible. Drag-over handler distinguishes file drags from cross-module drag data via dataTransfer.types.includes('Files'), so the upload overlay only appears for real file drops — workbench card-to-card drags pass through to the wrapping AppPage's dropTarget. Data source changes from context-based (getContext('allImages')) to direct Dexie live-queries via ./queries, so the component works in both the carousel (no layout context) and the route (layout still provides context for /picture/archive and /picture/board). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/lib/modules/picture/ListView.svelte | 577 ++++++++++++++---- .../web/src/routes/(app)/picture/+page.svelte | 301 +-------- 2 files changed, 479 insertions(+), 399 deletions(-) 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 eceb2ed9f..9ec1b5d1f 100644 --- a/apps/mana/apps/web/src/lib/modules/picture/ListView.svelte +++ b/apps/mana/apps/web/src/lib/modules/picture/ListView.svelte @@ -1,33 +1,93 @@
{/if} - + +
+ + + + Generieren + + + + +
+ + +
+ + + +
+
+ + + + + {#if uploadFiles.length > 0}
{#each uploadFiles as uf, i (uf.preview)} @@ -213,13 +341,9 @@ > {#if uf.status === 'uploading'} -
-
-
+
{:else if uf.status === 'success'} -
- -
+
{:else if uf.status === 'error'}
{/if} - i.id} - emptyTitle="Keine Bilder" - listClass="grid grid-cols-2 sm:grid-cols-3 gap-1.5 content-start" - > - {#snippet header()} - {images.length} Bilder - {favoriteCount} Favoriten - {/snippet} - - {#snippet item(image)} -
- {#if image.publicUrl} - {image.prompt} - {:else} -
- {image.format ?? 'img'} -
- {/if} - {#if image.isFavorite} - + +
+ +{#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} + diff --git a/apps/mana/apps/web/src/routes/(app)/picture/+page.svelte b/apps/mana/apps/web/src/routes/(app)/picture/+page.svelte index 570f4e57e..c9fcae42e 100644 --- a/apps/mana/apps/web/src/routes/(app)/picture/+page.svelte +++ b/apps/mana/apps/web/src/routes/(app)/picture/+page.svelte @@ -1,301 +1,12 @@ - Galerie - Picture - Mana + Picture - Mana -
- -
-
-

Galerie

-
- -
- - - -
- - - - Generieren - -
-
- - -
-
- - -
- - - - {#each allPictureTags.value as tag (tag.id)} - - {/each} -
-
- - -
- {#if filteredImages.length === 0} -
- -

- {allImages.value.length === 0 ? 'Noch keine Bilder' : 'Keine Ergebnisse'} -

-

- {allImages.value.length === 0 - ? 'Generiere dein erstes Bild mit KI' - : 'Passe deine Filter an'} -

- {#if allImages.value.length === 0} - - Erstes Bild generieren - - {/if} -
- {:else} -
- {#each filteredImages as img (img.id)} - - {/each} -
- {/if} -
-
- - -{#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} x {selectedImage.height} -

- {/if} -

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

- -
- - -
- -
-
-
-
-{/if} + + +