2022-07-15 23:18:17 -05:00
|
|
|
<script lang="ts">
|
2023-08-18 23:19:42 -04:00
|
|
|
import SelectAllAssets from '$lib/components/photos-page/actions/select-all-assets.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';
|
|
|
|
|
import { fileUploadHandler, openFileUploadDialog } from '$lib/utils/file-uploader';
|
2024-02-14 06:38:57 -08:00
|
|
|
import type { AlbumResponseDto, SharedLinkResponseDto, UserResponseDto } from '@immich/sdk';
|
2024-05-27 21:10:53 -05:00
|
|
|
import { createAssetInteractionStore } from '$lib/stores/asset-interaction.store';
|
|
|
|
|
import { AssetStore } from '$lib/stores/assets.store';
|
|
|
|
|
import { downloadAlbum } from '$lib/utils/asset-utils';
|
2023-07-01 00:50:47 -04:00
|
|
|
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
|
|
|
|
import DownloadAction from '../photos-page/actions/download-action.svelte';
|
2023-08-18 23:19:42 -04:00
|
|
|
import AssetGrid from '../photos-page/asset-grid.svelte';
|
2023-07-01 00:50:47 -04:00
|
|
|
import AssetSelectControlBar from '../photos-page/asset-select-control-bar.svelte';
|
|
|
|
|
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-05-23 19:56:48 +02:00
|
|
|
import { shortcut } from '$lib/actions/shortcut';
|
2023-10-25 09:48:25 -04:00
|
|
|
import { mdiFileImagePlusOutline, mdiFolderDownloadOutline } from '@mdi/js';
|
2024-02-27 08:37:37 -08:00
|
|
|
import { handlePromiseError } from '$lib/utils';
|
2024-03-08 20:03:37 +01:00
|
|
|
import AlbumSummary from './album-summary.svelte';
|
2024-06-04 21:53:00 +02:00
|
|
|
import { t } from 'svelte-i18n';
|
feat(web): Scroll to asset in gridview; increase gridview perf; reduce memory; scrollbar ticks in fixed position (#10646)
* Squashed
* Change strategy - now pre-measure buckets offscreen, so don't need to worry about sub-bucket scroll preservation
* Reduce jank on scroll, delay DOM updates until after scroll
* css opt, log measure time
* Trickle out queue while scrolling, flush when stopped
* yay
* Cleanup cleanup...
* everybody...
* everywhere...
* Clean up cleanup!
* Everybody do their share
* CLEANUP!
* package-lock ?
* dynamic measure, todo
* Fix web test
* type lint
* fix e2e
* e2e test
* Better scrollbar
* Tuning, and more tunables
* Tunable tweaks, more tunables
* Scrollbar dots and viewport events
* lint
* Tweaked tunnables, use requestIdleCallback for garbage tasks, bug fixes
* New tunables, and don't update url by default
* Bug fixes
* Bug fix, with debug
* Fix flickr, fix graybox bug, reduced debug
* Refactor/cleanup
* Fix
* naming
* Final cleanup
* review comment
* Forgot to update this after naming change
* scrubber works, with debug
* cleanup
* Rename scrollbar to scrubber
* rename to
* left over rename and change to previous album bar
* bugfix addassets, comments
* missing destroy(), cleanup
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
2024-08-21 22:15:21 -04:00
|
|
|
import { onDestroy } from 'svelte';
|
2023-07-01 00:50:47 -04:00
|
|
|
|
2023-08-11 12:00:51 -04:00
|
|
|
export let sharedLink: SharedLinkResponseDto;
|
2023-11-01 04:13:34 +01:00
|
|
|
export let user: UserResponseDto | undefined = undefined;
|
2023-07-01 00:50:47 -04:00
|
|
|
|
2023-08-18 23:19:42 -04:00
|
|
|
const album = sharedLink.album as AlbumResponseDto;
|
2024-05-09 09:21:45 -05:00
|
|
|
let innerWidth: number;
|
2023-08-18 23:19:42 -04:00
|
|
|
|
2023-08-01 04:27:56 +03:00
|
|
|
let { isViewing: showAssetViewer } = assetViewingStore;
|
|
|
|
|
|
2024-06-21 16:14:30 +01:00
|
|
|
const assetStore = new AssetStore({ albumId: album.id, order: album.order });
|
2023-08-18 23:19:42 -04:00
|
|
|
const assetInteractionStore = createAssetInteractionStore();
|
|
|
|
|
const { isMultiSelectState, selectedAssets } = assetInteractionStore;
|
|
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
dragAndDropFilesStore.subscribe((value) => {
|
|
|
|
|
if (value.isDragging && value.files.length > 0) {
|
2024-02-27 08:37:37 -08:00
|
|
|
handlePromiseError(fileUploadHandler(value.files, album.id));
|
2023-07-01 00:50:47 -04:00
|
|
|
dragAndDropFilesStore.set({ isDragging: false, files: [] });
|
|
|
|
|
}
|
|
|
|
|
});
|
feat(web): Scroll to asset in gridview; increase gridview perf; reduce memory; scrollbar ticks in fixed position (#10646)
* Squashed
* Change strategy - now pre-measure buckets offscreen, so don't need to worry about sub-bucket scroll preservation
* Reduce jank on scroll, delay DOM updates until after scroll
* css opt, log measure time
* Trickle out queue while scrolling, flush when stopped
* yay
* Cleanup cleanup...
* everybody...
* everywhere...
* Clean up cleanup!
* Everybody do their share
* CLEANUP!
* package-lock ?
* dynamic measure, todo
* Fix web test
* type lint
* fix e2e
* e2e test
* Better scrollbar
* Tuning, and more tunables
* Tunable tweaks, more tunables
* Scrollbar dots and viewport events
* lint
* Tweaked tunnables, use requestIdleCallback for garbage tasks, bug fixes
* New tunables, and don't update url by default
* Bug fixes
* Bug fix, with debug
* Fix flickr, fix graybox bug, reduced debug
* Refactor/cleanup
* Fix
* naming
* Final cleanup
* review comment
* Forgot to update this after naming change
* scrubber works, with debug
* cleanup
* Rename scrollbar to scrubber
* rename to
* left over rename and change to previous album bar
* bugfix addassets, comments
* missing destroy(), cleanup
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
2024-08-21 22:15:21 -04:00
|
|
|
onDestroy(() => {
|
|
|
|
|
assetStore.destroy();
|
|
|
|
|
});
|
2022-07-15 23:18:17 -05:00
|
|
|
</script>
|
|
|
|
|
|
2024-03-15 00:16:55 +01:00
|
|
|
<svelte:window
|
|
|
|
|
use:shortcut={{
|
|
|
|
|
shortcut: { key: 'Escape' },
|
|
|
|
|
onShortcut: () => {
|
|
|
|
|
if (!$showAssetViewer && $isMultiSelectState) {
|
|
|
|
|
assetInteractionStore.clearMultiselect();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}}
|
2024-05-09 09:21:45 -05:00
|
|
|
bind:innerWidth
|
2024-03-15 00:16:55 +01:00
|
|
|
/>
|
|
|
|
|
|
2023-08-18 23:19:42 -04:00
|
|
|
<header>
|
2024-02-19 23:39:49 -05:00
|
|
|
{#if $isMultiSelectState}
|
2023-11-11 15:06:19 -06:00
|
|
|
<AssetSelectControlBar
|
2024-02-19 23:39:49 -05:00
|
|
|
ownerId={user?.id}
|
2023-11-11 15:06:19 -06:00
|
|
|
assets={$selectedAssets}
|
|
|
|
|
clearSelect={() => assetInteractionStore.clearMultiselect()}
|
|
|
|
|
>
|
2023-08-18 23:19:42 -04:00
|
|
|
<SelectAllAssets {assetStore} {assetInteractionStore} />
|
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}>
|
2023-07-01 00:50:47 -04:00
|
|
|
<svelte:fragment slot="leading">
|
2024-05-27 21:10:53 -05:00
|
|
|
<ImmichLogoSmallLink width={innerWidth} />
|
2023-07-01 00:50:47 -04:00
|
|
|
</svelte:fragment>
|
|
|
|
|
|
|
|
|
|
<svelte:fragment slot="trailing">
|
2023-08-11 12:00:51 -04:00
|
|
|
{#if sharedLink.allowUpload}
|
|
|
|
|
<CircleIconButton
|
2024-06-04 21:53:00 +02:00
|
|
|
title={$t('add_photos')}
|
2024-05-23 20:26:22 -04:00
|
|
|
on:click={() => 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}
|
2024-06-04 21:53:00 +02:00
|
|
|
<CircleIconButton
|
|
|
|
|
title={$t('download')}
|
|
|
|
|
on:click={() => downloadAlbum(album)}
|
|
|
|
|
icon={mdiFolderDownloadOutline}
|
|
|
|
|
/>
|
2023-07-01 00:50:47 -04:00
|
|
|
{/if}
|
|
|
|
|
|
2023-08-11 12:00:51 -04:00
|
|
|
<ThemeButton />
|
2023-07-01 00:50:47 -04:00
|
|
|
</svelte:fragment>
|
|
|
|
|
</ControlAppBar>
|
|
|
|
|
{/if}
|
2023-08-18 23:19:42 -04:00
|
|
|
</header>
|
|
|
|
|
|
2024-02-01 18:50:14 -08:00
|
|
|
<main class="relative h-screen overflow-hidden bg-immich-bg px-6 pt-[var(--navbar-height)] dark:bg-immich-dark-bg">
|
feat(web): Scroll to asset in gridview; increase gridview perf; reduce memory; scrollbar ticks in fixed position (#10646)
* Squashed
* Change strategy - now pre-measure buckets offscreen, so don't need to worry about sub-bucket scroll preservation
* Reduce jank on scroll, delay DOM updates until after scroll
* css opt, log measure time
* Trickle out queue while scrolling, flush when stopped
* yay
* Cleanup cleanup...
* everybody...
* everywhere...
* Clean up cleanup!
* Everybody do their share
* CLEANUP!
* package-lock ?
* dynamic measure, todo
* Fix web test
* type lint
* fix e2e
* e2e test
* Better scrollbar
* Tuning, and more tunables
* Tunable tweaks, more tunables
* Scrollbar dots and viewport events
* lint
* Tweaked tunnables, use requestIdleCallback for garbage tasks, bug fixes
* New tunables, and don't update url by default
* Bug fixes
* Bug fix, with debug
* Fix flickr, fix graybox bug, reduced debug
* Refactor/cleanup
* Fix
* naming
* Final cleanup
* review comment
* Forgot to update this after naming change
* scrubber works, with debug
* cleanup
* Rename scrollbar to scrubber
* rename to
* left over rename and change to previous album bar
* bugfix addassets, comments
* missing destroy(), cleanup
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
2024-08-21 22:15:21 -04:00
|
|
|
<AssetGrid enableRouting={true} {album} {assetStore} {assetInteractionStore}>
|
2024-07-26 23:06:08 +02:00
|
|
|
<section class="pt-8 md:pt-24">
|
2023-08-18 23:19:42 -04:00
|
|
|
<!-- ALBUM TITLE -->
|
2024-02-19 23:39:49 -05:00
|
|
|
<h1
|
2024-07-26 23:06:08 +02:00
|
|
|
class="bg-immich-bg text-2xl md:text-4xl lg:text-6xl text-immich-primary outline-none transition-all dark:bg-immich-dark-bg dark:text-immich-dark-primary"
|
2023-08-18 23:19:42 -04:00
|
|
|
>
|
|
|
|
|
{album.albumName}
|
2024-02-19 23:39:49 -05:00
|
|
|
</h1>
|
2023-08-18 23:19:42 -04:00
|
|
|
|
|
|
|
|
{#if album.assetCount > 0}
|
2024-03-08 20:03:37 +01:00
|
|
|
<AlbumSummary {album} />
|
2023-08-18 23:19:42 -04:00
|
|
|
{/if}
|
2023-07-01 00:50:47 -04:00
|
|
|
|
2023-08-18 23:19:42 -04:00
|
|
|
<!-- ALBUM DESCRIPTION -->
|
2024-01-23 03:53:56 +01:00
|
|
|
{#if album.description}
|
|
|
|
|
<p
|
|
|
|
|
class="whitespace-pre-line mb-12 mt-6 w-full pb-2 text-left font-medium text-base text-black dark:text-gray-300"
|
|
|
|
|
>
|
|
|
|
|
{album.description}
|
|
|
|
|
</p>
|
|
|
|
|
{/if}
|
2023-08-18 23:19:42 -04:00
|
|
|
</section>
|
|
|
|
|
</AssetGrid>
|
|
|
|
|
</main>
|