From ce84f9c755a6a98aea0382e7b33383a13c8e1a4d Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 17 Aug 2023 15:46:39 +0200 Subject: [PATCH] feat(web): album list options (#3667) * Album view option for cover or list view * Dropdown can now receive list of icons to display with selected option * Formatting * Use table element with formatting similar to other pages * Make table rows clickable with hover styling * Also make row navigateable using keyboard without mouse * Formatting * Define DropdownOption interface * Album view mode type definition for typescript support in if statements * format * fix typing --------- Co-authored-by: Alex Tran --- .../lib/components/elements/dropdown.svelte | 17 ++++- web/src/lib/stores/preferences.store.ts | 7 ++ web/src/routes/(user)/albums/+page.svelte | 74 +++++++++++++++++-- 3 files changed, 87 insertions(+), 11 deletions(-) diff --git a/web/src/lib/components/elements/dropdown.svelte b/web/src/lib/components/elements/dropdown.svelte index 5955a43a40..b0d5646cde 100644 --- a/web/src/lib/components/elements/dropdown.svelte +++ b/web/src/lib/components/elements/dropdown.svelte @@ -1,12 +1,18 @@ - + + -
- {#each $albums as album (album.id)} - - showAlbumContextMenu(e.detail, album)} user={data.user} /> - - {/each} -
+ {#if $albumViewSettings.view === AlbumViewMode.Cover} +
+ {#each $albums as album (album.id)} + + showAlbumContextMenu(e.detail, album)} user={data.user} /> + + {/each} +
+ {:else if $albumViewSettings.view === AlbumViewMode.List} + + + + + + + + + + + {#each $albums as album (album.id)} + goto(`albums/${album.id}`)} + on:keydown={(event) => event.key === 'Enter' && goto(`albums/${album.id}`)} + tabindex="0" + > + + + + + + {/each} + +
Album titleAssetsUpdated dateCreated date
{album.albumName} + {album.assetCount} + {album.assetCount == 1 ? `item` : `items`} + {dateLocaleString(album.updatedAt)}{dateLocaleString(album.createdAt)}
+ {/if} {#if $albums.length === 0}