-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): Album preview overview in menu (#13981)
- Loading branch information
1 parent
292182f
commit 5060ee9
Showing
5 changed files
with
106 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
web/src/lib/components/shared-components/side-bar/recent-albums.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters