-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Copy path+page.svelte
58 lines (52 loc) · 2.03 KB
/
+page.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<script lang="ts">
import type { PageData } from './$types';
import { scrollMemory } from '$lib/actions/scroll-memory';
import { AlbumFilter, albumViewSettings } from '$lib/stores/preferences.store';
import { createAlbumAndRedirect } from '$lib/utils/album-utils';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import AlbumsControls from '$lib/components/album-page/albums-controls.svelte';
import Albums from '$lib/components/album-page/albums-list.svelte';
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
import GroupTab from '$lib/components/elements/group-tab.svelte';
import SearchBar from '$lib/components/elements/search-bar.svelte';
import { AppRoute } from '$lib/constants';
import { t } from 'svelte-i18n';
interface Props {
data: PageData;
}
let { data }: Props = $props();
let searchQuery = $state('');
let albumGroups: string[] = $state([]);
</script>
<UserPageLayout title={data.meta.title} use={[[scrollMemory, { routeStartsWith: AppRoute.ALBUMS }]]}>
{#snippet buttons()}
<div class="flex place-items-center gap-2">
<AlbumsControls {albumGroups} bind:searchQuery />
</div>
{/snippet}
<div class="xl:hidden flex gap-2">
<div class="w-fit h-14 dark:text-immich-dark-fg py-2">
<GroupTab
label={$t('show_albums')}
filters={Object.keys(AlbumFilter)}
selected={$albumViewSettings.filter}
onSelect={(selected) => ($albumViewSettings.filter = selected)}
/>
</div>
<div class="w-fit h-14 py-2">
<SearchBar placeholder={$t('search_albums')} bind:name={searchQuery} showLoadingSpinner={false} />
</div>
</div>
<Albums
ownedAlbums={data.albums}
sharedAlbums={data.sharedAlbums}
userSettings={$albumViewSettings}
allowEdit
{searchQuery}
bind:albumGroupIds={albumGroups}
>
{#snippet empty()}
<EmptyPlaceholder text={$t('no_albums_message')} onClick={() => createAlbumAndRedirect()} />
{/snippet}
</Albums>
</UserPageLayout>