From b0ecd5424340178a0c5d5f7bfbf6243681c8bdb2 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Thu, 19 Jun 2025 01:55:32 +0100 Subject: [PATCH] Enhance photos page with multiple view modes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add support for masonry, single, two-column, and horizontal view modes - Implement wide width mode (1100px) for more columns - Add padding adjustments for horizontal scroll mode - Load all photos automatically in horizontal mode - Preserve scroll position on navigation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/routes/photos/+page.svelte | 229 +++++++++++++++++++++++++++------ 1 file changed, 189 insertions(+), 40 deletions(-) diff --git a/src/routes/photos/+page.svelte b/src/routes/photos/+page.svelte index c9acee5..0461b68 100644 --- a/src/routes/photos/+page.svelte +++ b/src/routes/photos/+page.svelte @@ -1,12 +1,19 @@ @@ -102,7 +200,11 @@ -
+
{#if error}
@@ -118,48 +220,68 @@
{:else} - containerWidth = width} + onModeChange={handleViewModeChange} + onWidthChange={(width) => (containerWidth = width)} /> - - - -
+
+ {#if viewMode === 'masonry'} + + {:else if viewMode === 'single'} + + {:else if viewMode === 'two-column'} + + {:else if viewMode === 'horizontal'} + + {#if isLoadingAll} +
+ +
+ {/if} + {/if} +
- {#snippet loading()} -
- -
- {/snippet} + {#if viewMode !== 'horizontal'} + + +
- {#snippet error()} -
-

{lastError || 'Failed to load photos'}

- -
- {/snippet} + {#snippet loading()} +
+ +
+ {/snippet} - {#snippet noData()} -
-

You've reached the end

-
- {/snippet} -
+ {#snippet error()} +
+

{lastError || 'Failed to load photos'}

+ +
+ {/snippet} + + {#snippet noData()} +
+

You've reached the end

+
+ {/snippet} +
+ {/if} {/if}
@@ -172,7 +294,23 @@ transition: max-width 0.3s ease; &.wide { - max-width: 900px; + max-width: 1100px; + } + + &.horizontal-mode { + max-width: none; + padding-left: 0; + padding-right: 0; + + :global(.view-mode-selector) { + max-width: 700px; + margin-left: auto; + margin-right: auto; + } + + &.wide :global(.view-mode-selector) { + max-width: 1100px; + } } :global(.view-mode-selector) { @@ -229,6 +367,17 @@ margin-top: $unit-4x; } + .loading-more-indicator { + position: fixed; + bottom: $unit-3x; + right: $unit-3x; + background: $grey-100; + padding: $unit-2x $unit-3x; + border-radius: $corner-radius-lg; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + z-index: 20; + } + .end-message { text-align: center; padding: $unit-6x 0;