diff --git a/src/lib/components/PhotoGrid.svelte b/src/lib/components/PhotoGrid.svelte new file mode 100644 index 0000000..da01c6a --- /dev/null +++ b/src/lib/components/PhotoGrid.svelte @@ -0,0 +1,122 @@ + + +
+ {#each photos as photo} +
+ {#if onPhotoClick} + + {:else} + + {/if} +
+ {/each} +
+ + diff --git a/src/lib/components/PhotoItem.svelte b/src/lib/components/PhotoItem.svelte index 811b3ec..a3bc512 100644 --- a/src/lib/components/PhotoItem.svelte +++ b/src/lib/components/PhotoItem.svelte @@ -26,7 +26,9 @@ } else { // Navigate to individual photo page using the media ID const mediaId = item.id.replace(/^(media|photo)-/, '') // Support both prefixes - goto(`/photos/p/${mediaId}`) + // Include the album slug as a 'from' parameter if we're in an album context + const url = albumSlug ? `/photos/p/${mediaId}?from=${albumSlug}` : `/photos/p/${mediaId}` + goto(url) } } } @@ -37,16 +39,8 @@ const photo = $derived(isAlbum(item) ? item.coverPhoto : item) const isAlbumItem = $derived(isAlbum(item)) - const placeholderStyle = $derived( - photo.dominantColor - ? `background: ${photo.dominantColor}` - : '' - ) - const aspectRatioStyle = $derived( - photo.aspectRatio - ? `aspect-ratio: ${photo.aspectRatio}` - : '' - ) + const placeholderStyle = $derived(photo.dominantColor ? `background: ${photo.dominantColor}` : '') + const aspectRatioStyle = $derived(photo.aspectRatio ? `aspect-ratio: ${photo.aspectRatio}` : '')
@@ -249,11 +243,9 @@ z-index: 1; overflow: hidden; - &.loaded { opacity: 0; pointer-events: none; } } - diff --git a/src/lib/components/PhotoMetadata.svelte b/src/lib/components/PhotoMetadata.svelte index c649fd6..35c7e7d 100644 --- a/src/lib/components/PhotoMetadata.svelte +++ b/src/lib/components/PhotoMetadata.svelte @@ -10,6 +10,7 @@ backHref?: string backLabel?: string showBackButton?: boolean + albums?: Array<{ id: number; title: string; slug: string }> class?: string } @@ -22,6 +23,7 @@ backHref, backLabel, showBackButton = false, + albums = [], class: className = '' }: Props = $props() @@ -116,6 +118,19 @@
{/if} + {#if albums && albums.length > 0} +
+

This photo appears in:

+
+ {#each albums as album} + + {album.title} + + {/each} +
+
+ {/if} + {#if showBackButton && backHref && backLabel}