2022-07-15 23:18:17 -05:00
|
|
|
<script lang="ts">
|
2025-05-12 23:17:01 +02:00
|
|
|
import { shortcut } from '$lib/actions/shortcut';
|
2025-05-29 22:13:44 +08:00
|
|
|
import CastButton from '$lib/cast/cast-button.svelte';
|
2025-05-12 23:17:01 +02:00
|
|
|
import AlbumMap from '$lib/components/album-page/album-map.svelte';
|
2025-09-16 13:37:01 -04:00
|
|
|
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
|
|
|
|
|
import SelectAllAssets from '$lib/components/timeline/actions/SelectAllAction.svelte';
|
|
|
|
|
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
|
2025-09-16 13:05:09 -04:00
|
|
|
import Timeline from '$lib/components/timeline/Timeline.svelte';
|
2025-06-10 10:30:13 -04:00
|
|
|
import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte';
|
2025-05-12 23:17:01 +02:00
|
|
|
import { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
2023-08-11 12:00:51 -04:00
|
|
|
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
|
2023-07-01 00:50:47 -04:00
|
|
|
import { dragAndDropFilesStore } from '$lib/stores/drag-and-drop-files.store';
|
2025-05-29 22:13:44 +08:00
|
|
|
import { featureFlags } from '$lib/stores/server-config.store';
|
2025-05-12 23:17:01 +02:00
|
|
|
import { handlePromiseError } from '$lib/utils';
|
|
|
|
|
import { cancelMultiselect, downloadAlbum } from '$lib/utils/asset-utils';
|
2023-07-01 00:50:47 -04:00
|
|
|
import { fileUploadHandler, openFileUploadDialog } from '$lib/utils/file-uploader';
|
2024-02-14 06:38:57 -08:00
|
|
|
import type { AlbumResponseDto, SharedLinkResponseDto, UserResponseDto } from '@immich/sdk';
|
2025-06-10 10:30:13 -04:00
|
|
|
import { IconButton } from '@immich/ui';
|
2025-08-10 22:23:21 -04:00
|
|
|
import { mdiDownload, mdiFileImagePlusOutline } from '@mdi/js';
|
2025-05-12 23:17:01 +02:00
|
|
|
import { onDestroy } from 'svelte';
|
|
|
|
|
import { t } from 'svelte-i18n';
|
2023-07-01 00:50:47 -04:00
|
|
|
import ControlAppBar from '../shared-components/control-app-bar.svelte';
|
2024-05-27 21:10:53 -05:00
|
|
|
import ImmichLogoSmallLink from '../shared-components/immich-logo-small-link.svelte';
|
2023-07-01 00:50:47 -04:00
|
|
|
import ThemeButton from '../shared-components/theme-button.svelte';
|
2024-03-08 20:03:37 +01:00
|
|
|
import AlbumSummary from './album-summary.svelte';
|
2023-07-01 00:50:47 -04:00
|
|
|
|
2024-11-14 08:43:25 -06:00
|
|
|
interface Props {
|
|
|
|
|
sharedLink: SharedLinkResponseDto;
|
|
|
|
|
user?: UserResponseDto | undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let { sharedLink, user = undefined }: Props = $props();
|
2023-07-01 00:50:47 -04:00
|
|
|
|
2023-08-18 23:19:42 -04:00
|
|
|
const album = sharedLink.album as AlbumResponseDto;
|
|
|
|
|
|
2023-08-01 04:27:56 +03:00
|
|
|
let { isViewing: showAssetViewer } = assetViewingStore;
|
|
|
|
|
|
2025-06-10 10:30:13 -04:00
|
|
|
const timelineManager = new TimelineManager();
|
|
|
|
|
$effect(() => void timelineManager.updateOptions({ albumId: album.id, order: album.order }));
|
|
|
|
|
onDestroy(() => timelineManager.destroy());
|
2025-03-18 10:14:46 -04:00
|
|
|
|
2024-12-14 19:30:33 +01:00
|
|
|
const assetInteraction = new AssetInteraction();
|
2023-08-18 23:19:42 -04:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
dragAndDropFilesStore.subscribe((value) => {
|
|
|
|
|
if (value.isDragging && value.files.length > 0) {
|
2025-06-02 04:45:39 +02:00
|
|
|
handlePromiseError(fileUploadHandler({ files: value.files, albumId: album.id }));
|
2023-07-01 00:50:47 -04:00
|
|
|
dragAndDropFilesStore.set({ isDragging: false, files: [] });
|
|
|
|
|
}
|
|
|
|
|
});
|
2022-07-15 23:18:17 -05:00
|
|
|
</script>
|
|
|
|
|
|
2025-05-21 18:12:00 +02:00
|
|
|
<svelte:document
|
2024-03-15 00:16:55 +01:00
|
|
|
use:shortcut={{
|
|
|
|
|
shortcut: { key: 'Escape' },
|
|
|
|
|
onShortcut: () => {
|
2024-12-14 19:30:33 +01:00
|
|
|
if (!$showAssetViewer && assetInteraction.selectionActive) {
|
|
|
|
|
cancelMultiselect(assetInteraction);
|
2024-03-15 00:16:55 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
2025-05-18 15:51:33 +02:00
|
|
|
<main class="relative h-dvh overflow-hidden px-2 md:px-6 max-md:pt-(--navbar-height-md) pt-(--navbar-height)">
|
2025-09-16 13:05:09 -04:00
|
|
|
<Timeline enableRouting={true} {album} {timelineManager} {assetInteraction}>
|
2025-05-13 16:10:05 +02:00
|
|
|
<section class="pt-8 md:pt-24 px-2 md:px-0">
|
|
|
|
|
<!-- ALBUM TITLE -->
|
|
|
|
|
<h1
|
|
|
|
|
class="text-2xl md:text-4xl lg:text-6xl text-immich-primary outline-none transition-all dark:text-immich-dark-primary"
|
|
|
|
|
>
|
|
|
|
|
{album.albumName}
|
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
|
|
{#if album.assetCount > 0}
|
|
|
|
|
<AlbumSummary {album} />
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<!-- ALBUM DESCRIPTION -->
|
|
|
|
|
{#if album.description}
|
|
|
|
|
<p
|
|
|
|
|
class="whitespace-pre-line mb-12 mt-6 w-full pb-2 text-start font-medium text-base text-black dark:text-gray-300"
|
|
|
|
|
>
|
|
|
|
|
{album.description}
|
|
|
|
|
</p>
|
|
|
|
|
{/if}
|
|
|
|
|
</section>
|
2025-09-16 13:05:09 -04:00
|
|
|
</Timeline>
|
2025-05-13 16:10:05 +02:00
|
|
|
</main>
|
|
|
|
|
|
2023-08-18 23:19:42 -04:00
|
|
|
<header>
|
2024-12-14 19:30:33 +01:00
|
|
|
{#if assetInteraction.selectionActive}
|
2023-11-11 15:06:19 -06:00
|
|
|
<AssetSelectControlBar
|
2024-02-19 23:39:49 -05:00
|
|
|
ownerId={user?.id}
|
2024-12-14 19:30:33 +01:00
|
|
|
assets={assetInteraction.selectedAssets}
|
|
|
|
|
clearSelect={() => assetInteraction.clearMultiselect()}
|
2023-11-11 15:06:19 -06:00
|
|
|
>
|
2025-06-10 10:30:13 -04:00
|
|
|
<SelectAllAssets {timelineManager} {assetInteraction} />
|
2023-08-11 12:00:51 -04:00
|
|
|
{#if sharedLink.allowDownload}
|
2023-08-25 00:03:28 -04:00
|
|
|
<DownloadAction filename="{album.albumName}.zip" />
|
2023-07-01 00:50:47 -04:00
|
|
|
{/if}
|
|
|
|
|
</AssetSelectControlBar>
|
2023-08-11 12:00:51 -04:00
|
|
|
{:else}
|
|
|
|
|
<ControlAppBar showBackButton={false}>
|
2024-11-14 08:43:25 -06:00
|
|
|
{#snippet leading()}
|
2025-03-24 17:36:36 -04:00
|
|
|
<ImmichLogoSmallLink />
|
2024-11-14 08:43:25 -06:00
|
|
|
{/snippet}
|
2023-07-01 00:50:47 -04:00
|
|
|
|
2024-11-14 08:43:25 -06:00
|
|
|
{#snippet trailing()}
|
2025-06-02 09:47:23 -05:00
|
|
|
<CastButton />
|
2025-05-20 16:08:23 -05:00
|
|
|
|
2023-08-11 12:00:51 -04:00
|
|
|
{#if sharedLink.allowUpload}
|
2025-06-02 09:47:23 -05:00
|
|
|
<IconButton
|
|
|
|
|
shape="round"
|
|
|
|
|
color="secondary"
|
|
|
|
|
variant="ghost"
|
|
|
|
|
aria-label={$t('add_photos')}
|
2024-11-14 08:43:25 -06:00
|
|
|
onclick={() => openFileUploadDialog({ albumId: album.id })}
|
2023-10-25 09:48:25 -04:00
|
|
|
icon={mdiFileImagePlusOutline}
|
2023-08-11 12:00:51 -04:00
|
|
|
/>
|
2023-07-01 00:50:47 -04:00
|
|
|
{/if}
|
|
|
|
|
|
2023-08-11 12:00:51 -04:00
|
|
|
{#if album.assetCount > 0 && sharedLink.allowDownload}
|
2025-06-02 09:47:23 -05:00
|
|
|
<IconButton
|
|
|
|
|
shape="round"
|
|
|
|
|
color="secondary"
|
|
|
|
|
variant="ghost"
|
|
|
|
|
aria-label={$t('download')}
|
2024-11-14 08:43:25 -06:00
|
|
|
onclick={() => downloadAlbum(album)}
|
2025-08-10 22:23:21 -04:00
|
|
|
icon={mdiDownload}
|
2024-06-04 21:53:00 +02:00
|
|
|
/>
|
2023-07-01 00:50:47 -04:00
|
|
|
{/if}
|
2025-05-29 22:13:44 +08:00
|
|
|
{#if sharedLink.showMetadata && $featureFlags.loaded && $featureFlags.map}
|
2025-05-05 04:58:44 +02:00
|
|
|
<AlbumMap {album} />
|
|
|
|
|
{/if}
|
2023-08-11 12:00:51 -04:00
|
|
|
<ThemeButton />
|
2024-11-14 08:43:25 -06:00
|
|
|
{/snippet}
|
2023-07-01 00:50:47 -04:00
|
|
|
</ControlAppBar>
|
|
|
|
|
{/if}
|
2023-08-18 23:19:42 -04:00
|
|
|
</header>
|