Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): Album preview overview in menu #13981

Merged
merged 50 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a738ff6
added top parameter to getAllAlbums route to query a specific amount …
TimVanOnckelen Nov 7, 2024
21ebdca
optimized api top use
TimVanOnckelen Nov 7, 2024
e32683e
styled recent albums
TimVanOnckelen Nov 7, 2024
ed1dbca
upgraded deps for svelte 5
TimVanOnckelen Nov 7, 2024
2a43e6c
optimized albums overview
TimVanOnckelen Nov 7, 2024
2d0eb89
Merge branch 'immich-app:main' into feat/album-dropdown-web
TimVanOnckelen Nov 7, 2024
0ce04d9
updated syntax to svelte 5
TimVanOnckelen Nov 7, 2024
375fcb8
migrated side-bar to svelte 5 syntax
TimVanOnckelen Nov 7, 2024
4fad2e8
prettier fix
TimVanOnckelen Nov 7, 2024
c46f2d5
removed unused imports
TimVanOnckelen Nov 7, 2024
800f09f
Merge branch 'immich-app:main' into feat/album-dropdown-web
TimVanOnckelen Nov 7, 2024
6285e7a
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Nov 7, 2024
2e56b51
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Nov 7, 2024
29b4db0
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Nov 8, 2024
f77b2e0
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Nov 8, 2024
a1aec4c
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Nov 15, 2024
b40689f
made responsive
TimVanOnckelen Nov 15, 2024
cfe0b29
removed unnes dep
TimVanOnckelen Nov 15, 2024
72d0d81
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Nov 15, 2024
fa7b91b
reset package-lock to sync with main
TimVanOnckelen Nov 22, 2024
3dd9dde
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Nov 22, 2024
b2d2f2b
removed server changes
TimVanOnckelen Nov 22, 2024
d66d1f6
Merge commit '3dd9dde0c7b89b12f232c7b0e791f00c34f265cb' into feat/alb…
TimVanOnckelen Nov 22, 2024
d3ba5b0
Update album.service.ts
TimVanOnckelen Nov 22, 2024
bfb12da
updated open api
TimVanOnckelen Nov 22, 2024
0d12f73
Merge commit 'd3ba5b01ad10c21e1db9e908a7b11bd616e4f2ab' into feat/alb…
TimVanOnckelen Nov 22, 2024
d3532c6
fixed package lock
TimVanOnckelen Nov 22, 2024
c259b3b
restored
TimVanOnckelen Nov 22, 2024
bb1ffe7
Update package-lock.json
TimVanOnckelen Nov 22, 2024
7519a59
only show first 3 albums
TimVanOnckelen Nov 22, 2024
ebc75c7
wip
TimVanOnckelen Nov 22, 2024
8e123c8
moved icon, and made html valid
TimVanOnckelen Nov 22, 2024
769cc14
added dropdown state to localstore
TimVanOnckelen Nov 22, 2024
187b2ce
fixed lint errors
TimVanOnckelen Nov 22, 2024
6c5fd82
removed if
TimVanOnckelen Nov 22, 2024
66960d0
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Nov 25, 2024
7acc496
Update web/src/lib/components/shared-components/side-bar/recent-album…
TimVanOnckelen Nov 25, 2024
e62685c
sort on most recent changed
TimVanOnckelen Nov 25, 2024
50b7bc1
fixed button in firefox
TimVanOnckelen Nov 25, 2024
aedad64
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Nov 25, 2024
5697dfc
added translations
TimVanOnckelen Nov 25, 2024
e8f01e9
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Nov 29, 2024
e98ab1e
fixed conflicts
TimVanOnckelen Nov 29, 2024
d94c739
fix linting errors
TimVanOnckelen Nov 29, 2024
ec552f0
fix
TimVanOnckelen Nov 29, 2024
bf6edf4
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Dec 1, 2024
ff7a815
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Dec 3, 2024
427d020
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Dec 3, 2024
21c1a97
chore: new icon and clean up
alextran1502 Dec 4, 2024
d781075
Merge branch 'main' into feat/album-dropdown-web
TimVanOnckelen Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@
"external": "External",
"external_libraries": "External Libraries",
"face_unassigned": "Unassigned",
"failed_to_load_assets": "Failed to load assets",
"favorite": "Favorite",
"favorite_or_unfavorite_photo": "Favorite or unfavorite photo",
"favorites": "Favorites",
Expand Down Expand Up @@ -1036,6 +1037,7 @@
"reassing_hint": "Assign selected assets to an existing person",
"recent": "Recent",
"recent_searches": "Recent searches",
"recent-albums": "Recent albums",
"refresh": "Refresh",
"refresh_encoded_videos": "Refresh encoded videos",
"refresh_faces": "Refresh faces",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<script lang="ts">
import { onMount } from 'svelte';
import { getAssetThumbnailUrl } from '$lib/utils';
import { getAllAlbums, type AlbumResponseDto } from '@immich/sdk';
import { handleError } from '$lib/utils/handle-error';
import { t } from 'svelte-i18n';

let albums: AlbumResponseDto[] = $state([]);

onMount(async () => {
try {
const allAlbums = await getAllAlbums({});
albums = allAlbums
.sort((album1, album2) => (album1.lastModifiedAssetTimestamp! > album2.lastModifiedAssetTimestamp! ? 1 : 0))
.slice(0, 3);
} catch (error) {
handleError(error, $t('failed_to_load_assets'));
}
});
</script>

{#each albums as album}
<a
href={'/albums/' + album.id}
title={album.albumName}
class="flex w-full place-items-center justify-between gap-4 rounded-r-full py-3 transition-[padding] delay-100 duration-100 hover:cursor-pointer hover:bg-immich-gray hover:text-immich-primary dark:text-immich-dark-fg dark:hover:bg-immich-dark-gray dark:hover:text-immich-dark-primary pl-10 group-hover:sm:px-10 md:px-10"
>
<div>
<div
class="h-6 w-6 bg-cover rounded bg-gray-200 dark:bg-gray-600"
style={album.albumThumbnailAssetId
? `background-image:url('${getAssetThumbnailUrl({ id: album.albumThumbnailAssetId })}')`
: ''}
></div>
</div>
<div class="grow text-sm font-medium truncate">
{album.albumName}
</div>
</a>
{/each}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<script lang="ts">
import Icon from '$lib/components/elements/icon.svelte';
import { mdiChevronDown, mdiChevronLeft } from '@mdi/js';
import { resolveRoute } from '$app/paths';
import { page } from '$app/stores';
import type { Snippet } from 'svelte';
import { t } from 'svelte-i18n';

interface Props {
title: string;
Expand All @@ -10,6 +13,9 @@
flippedLogo?: boolean;
isSelected?: boolean;
preloadData?: boolean;
moreInformation?: Snippet;
dropDownContent?: Snippet;
dropdownOpen?: boolean;
}

let {
Expand All @@ -19,6 +25,8 @@
flippedLogo = false,
isSelected = $bindable(false),
preloadData = true,
dropDownContent: hasDropdown,
dropdownOpen = $bindable(false),
}: Props = $props();

let routePath = $derived(resolveRoute(routeId, {}));
Expand All @@ -28,21 +36,44 @@
});
</script>

<a
href={routePath}
data-sveltekit-preload-data={preloadData ? 'hover' : 'off'}
draggable="false"
aria-current={isSelected ? 'page' : undefined}
class="flex w-full place-items-center gap-4 rounded-r-full py-3 transition-[padding] delay-100 duration-100 hover:cursor-pointer hover:bg-immich-gray hover:text-immich-primary dark:text-immich-dark-fg dark:hover:bg-immich-dark-gray dark:hover:text-immich-dark-primary
<span class="relative">
{#if hasDropdown}
<span class="hidden md:block absolute left-1 z-50 h-full">
<button
TimVanOnckelen marked this conversation as resolved.
Show resolved Hide resolved
type="button"
aria-label={$t('recent-albums')}
class="relative flex cursor-default pt-4 pb-4 select-none justify-center hover:cursor-pointer hover:bg-immich-gray hover:fill-gray hover:text-immich-primary dark:text-immich-dark-fg dark:hover:bg-immich-dark-gray dark:hover:text-immich-dark-primary rounded h-fill"
onclick={() => (dropdownOpen = !dropdownOpen)}
>
<Icon
TimVanOnckelen marked this conversation as resolved.
Show resolved Hide resolved
path={dropdownOpen ? mdiChevronDown : mdiChevronLeft}
size="1em"
class="shrink-0 delay-100 duration-100 "
flipped={flippedLogo}
ariaHidden
/>
</button>
</span>
{/if}
<a
href={routePath}
data-sveltekit-preload-data={preloadData ? 'hover' : 'off'}
draggable="false"
aria-current={isSelected ? 'page' : undefined}
class="flex w-full place-items-center gap-4 rounded-r-full py-3 transition-[padding] delay-100 duration-100 hover:cursor-pointer hover:bg-immich-gray hover:text-immich-primary dark:text-immich-dark-fg dark:hover:bg-immich-dark-gray dark:hover:text-immich-dark-primary
{isSelected
? 'bg-immich-primary/10 text-immich-primary hover:bg-immich-primary/10 dark:bg-immich-dark-primary/10 dark:text-immich-dark-primary'
: ''}
? 'bg-immich-primary/10 text-immich-primary hover:bg-immich-primary/10 dark:bg-immich-dark-primary/10 dark:text-immich-dark-primary'
: ''}
pl-5 group-hover:sm:px-5 md:px-5
"
>
<div class="flex w-full place-items-center gap-4 overflow-hidden truncate">
<Icon path={icon} size="1.5em" class="shrink-0" flipped={flippedLogo} ariaHidden />
<span class="text-sm font-medium">{title}</span>
</div>
<div></div>
</a>
>
<div class="flex w-full place-items-center gap-4 overflow-hidden truncate">
<Icon path={icon} size="1.5em" class="shrink-0" flipped={flippedLogo} ariaHidden />
<span class="text-sm font-medium">{title}</span>
</div>
<div></div>
</a>
</span>
{#if hasDropdown && dropdownOpen}
{@render hasDropdown?.()}
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import { t } from 'svelte-i18n';
import BottomInfo from '$lib/components/shared-components/side-bar/bottom-info.svelte';
import { preferences } from '$lib/stores/user.store';
import { recentAlbumsDropdown } from '$lib/stores/preferences.store';
import RecentAlbums from '$lib/components/shared-components/side-bar/recent-albums.svelte';
import { fly } from 'svelte/transition';

let isArchiveSelected: boolean = $state(false);
let isFavoritesSelected: boolean = $state(false);
Expand Down Expand Up @@ -88,7 +91,19 @@
bind:isSelected={isFavoritesSelected}
></SideBarLink>

<SideBarLink title={$t('albums')} routeId="/(user)/albums" icon={mdiImageAlbum} flippedLogo></SideBarLink>
<SideBarLink
title={$t('albums')}
routeId="/(user)/albums"
icon={mdiImageAlbum}
flippedLogo
bind:dropdownOpen={$recentAlbumsDropdown}
>
{#snippet dropDownContent()}
<span in:fly={{ y: -20 }} class="hidden md:block">
<RecentAlbums />
</span>
{/snippet}
</SideBarLink>

{#if $preferences.tags.enabled && $preferences.tags.sidebarWeb}
<SideBarLink title={$t('tags')} routeId="/(user)/tags" icon={mdiTagMultipleOutline} flippedLogo />
Expand Down
2 changes: 2 additions & 0 deletions web/src/lib/stores/preferences.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,5 @@ export const alwaysLoadOriginalFile = persisted<boolean>('always-load-original-f
export const playVideoThumbnailOnHover = persisted<boolean>('play-video-thumbnail-on-hover', true, {});

export const loopVideo = persisted<boolean>('loop-video', true, {});

export const recentAlbumsDropdown = persisted<boolean>('recent-albums-open', true, {});
Loading