2022-07-15 23:18:17 -05:00
|
|
|
<script lang="ts">
|
2023-05-16 16:13:20 +02:00
|
|
|
import { browser } from '$app/environment';
|
2022-07-22 09:44:22 -05:00
|
|
|
import { afterNavigate, goto } from '$app/navigation';
|
2023-05-16 16:13:20 +02:00
|
|
|
import { albumAssetSelectionStore } from '$lib/stores/album-asset-selection.store';
|
2023-06-29 17:26:25 +02:00
|
|
|
import { dragAndDropFilesStore } from '$lib/stores/drag-and-drop-files.store';
|
2023-05-16 16:13:20 +02:00
|
|
|
import { locale } from '$lib/stores/preferences.store';
|
2023-06-29 17:26:25 +02:00
|
|
|
import { fileUploadHandler, openFileUploadDialog } from '$lib/utils/file-uploader';
|
2023-01-09 14:16:08 -06:00
|
|
|
import {
|
|
|
|
|
AlbumResponseDto,
|
|
|
|
|
AssetResponseDto,
|
|
|
|
|
SharedLinkResponseDto,
|
|
|
|
|
SharedLinkType,
|
2023-05-16 16:13:20 +02:00
|
|
|
UserResponseDto,
|
|
|
|
|
api
|
2023-01-09 14:16:08 -06:00
|
|
|
} from '@api';
|
2022-07-23 23:23:14 -05:00
|
|
|
import { onMount } from 'svelte';
|
2022-07-15 23:18:17 -05:00
|
|
|
import ArrowLeft from 'svelte-material-icons/ArrowLeft.svelte';
|
2023-05-16 16:13:20 +02:00
|
|
|
import DeleteOutline from 'svelte-material-icons/DeleteOutline.svelte';
|
|
|
|
|
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
|
2022-07-15 23:18:17 -05:00
|
|
|
import FileImagePlusOutline from 'svelte-material-icons/FileImagePlusOutline.svelte';
|
2023-05-16 16:13:20 +02:00
|
|
|
import FolderDownloadOutline from 'svelte-material-icons/FolderDownloadOutline.svelte';
|
|
|
|
|
import Plus from 'svelte-material-icons/Plus.svelte';
|
2022-07-23 13:08:49 -05:00
|
|
|
import ShareVariantOutline from 'svelte-material-icons/ShareVariantOutline.svelte';
|
2023-05-16 16:13:20 +02:00
|
|
|
import Button from '../elements/buttons/button.svelte';
|
2023-04-07 18:45:00 +02:00
|
|
|
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
2023-05-26 09:11:10 -04:00
|
|
|
import DownloadAction from '../photos-page/actions/download-action.svelte';
|
2023-05-16 16:13:20 +02:00
|
|
|
import RemoveFromAlbum from '../photos-page/actions/remove-from-album.svelte';
|
|
|
|
|
import AssetSelectControlBar from '../photos-page/asset-select-control-bar.svelte';
|
2023-05-28 15:10:55 +02:00
|
|
|
import UserAvatar from '../shared-components/user-avatar.svelte';
|
2022-07-27 11:16:02 -05:00
|
|
|
import ContextMenu from '../shared-components/context-menu/context-menu.svelte';
|
|
|
|
|
import MenuOption from '../shared-components/context-menu/menu-option.svelte';
|
2022-08-08 22:06:11 -05:00
|
|
|
import ControlAppBar from '../shared-components/control-app-bar.svelte';
|
2023-01-09 14:16:08 -06:00
|
|
|
import CreateSharedLinkModal from '../shared-components/create-share-link-modal/create-shared-link-modal.svelte';
|
2023-01-14 23:49:47 -06:00
|
|
|
import GalleryViewer from '../shared-components/gallery-viewer/gallery-viewer.svelte';
|
2023-02-10 23:01:35 +01:00
|
|
|
import ImmichLogo from '../shared-components/immich-logo.svelte';
|
2023-06-10 21:06:13 +02:00
|
|
|
import SelectAll from 'svelte-material-icons/SelectAll.svelte';
|
2023-05-16 16:13:20 +02:00
|
|
|
import {
|
|
|
|
|
NotificationType,
|
|
|
|
|
notificationController
|
|
|
|
|
} from '../shared-components/notification/notification';
|
|
|
|
|
import ThemeButton from '../shared-components/theme-button.svelte';
|
|
|
|
|
import AssetSelection from './asset-selection.svelte';
|
|
|
|
|
import ShareInfoModal from './share-info-modal.svelte';
|
|
|
|
|
import ThumbnailSelection from './thumbnail-selection.svelte';
|
|
|
|
|
import UserSelectionModal from './user-selection-modal.svelte';
|
2023-06-30 21:53:16 +02:00
|
|
|
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
|
2023-06-07 10:37:25 -04:00
|
|
|
import { handleError } from '../../utils/handle-error';
|
2023-06-30 12:24:28 -04:00
|
|
|
import { downloadArchive } from '../../utils/asset-utils';
|
2022-07-27 11:16:02 -05:00
|
|
|
|
2022-07-15 23:18:17 -05:00
|
|
|
export let album: AlbumResponseDto;
|
2023-01-09 14:16:08 -06:00
|
|
|
export let sharedLink: SharedLinkResponseDto | undefined = undefined;
|
|
|
|
|
|
2022-09-09 15:55:20 -05:00
|
|
|
const { isAlbumAssetSelectionOpen } = albumAssetSelectionStore;
|
2022-07-18 00:22:39 -05:00
|
|
|
|
2022-07-22 09:44:22 -05:00
|
|
|
let isShowAssetSelection = false;
|
2022-09-09 15:55:20 -05:00
|
|
|
|
2023-01-09 14:16:08 -06:00
|
|
|
let isShowShareLinkModal = false;
|
|
|
|
|
|
2022-09-09 15:55:20 -05:00
|
|
|
$: $isAlbumAssetSelectionOpen = isShowAssetSelection;
|
2022-09-04 08:34:39 -05:00
|
|
|
$: {
|
|
|
|
|
if (browser) {
|
|
|
|
|
if (isShowAssetSelection) {
|
|
|
|
|
document.body.style.overflow = 'hidden';
|
|
|
|
|
} else {
|
|
|
|
|
document.body.style.overflow = 'auto';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-07-22 09:44:22 -05:00
|
|
|
let isShowShareUserSelection = false;
|
|
|
|
|
let isEditingTitle = false;
|
|
|
|
|
let isCreatingSharedAlbum = false;
|
2022-07-23 13:08:49 -05:00
|
|
|
let isShowShareInfoModal = false;
|
2022-07-27 11:16:02 -05:00
|
|
|
let isShowAlbumOptions = false;
|
|
|
|
|
let isShowThumbnailSelection = false;
|
2023-06-30 21:53:16 +02:00
|
|
|
let isShowDeleteConfirmation = false;
|
2022-07-22 09:44:22 -05:00
|
|
|
|
2022-07-16 23:52:00 -05:00
|
|
|
let backUrl = '/albums';
|
2022-07-22 09:44:22 -05:00
|
|
|
let currentAlbumName = '';
|
|
|
|
|
let currentUser: UserResponseDto;
|
2022-07-26 12:28:07 -05:00
|
|
|
let titleInput: HTMLInputElement;
|
2022-07-27 11:16:02 -05:00
|
|
|
let contextMenuPosition = { x: 0, y: 0 };
|
2022-07-22 09:44:22 -05:00
|
|
|
|
2023-01-09 14:16:08 -06:00
|
|
|
$: isPublicShared = sharedLink;
|
2022-07-22 09:44:22 -05:00
|
|
|
$: isOwned = currentUser?.id == album.ownerId;
|
2022-07-15 23:18:17 -05:00
|
|
|
|
2023-06-29 17:26:25 +02:00
|
|
|
dragAndDropFilesStore.subscribe((value) => {
|
|
|
|
|
if (value.isDragging && value.files.length > 0) {
|
|
|
|
|
fileUploadHandler(value.files, album.id, sharedLink?.key);
|
|
|
|
|
dragAndDropFilesStore.set({ isDragging: false, files: [] });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2022-07-23 23:23:14 -05:00
|
|
|
let multiSelectAsset: Set<AssetResponseDto> = new Set();
|
|
|
|
|
$: isMultiSelectionMode = multiSelectAsset.size > 0;
|
|
|
|
|
|
2022-07-22 09:44:22 -05:00
|
|
|
afterNavigate(({ from }) => {
|
2022-09-16 23:13:22 -05:00
|
|
|
backUrl = from?.url.pathname ?? '/albums';
|
2022-07-22 09:44:22 -05:00
|
|
|
|
2023-06-14 20:47:18 -05:00
|
|
|
if (from?.url.pathname === '/sharing' && album.sharedUsers.length === 0) {
|
2022-07-22 09:44:22 -05:00
|
|
|
isCreatingSharedAlbum = true;
|
|
|
|
|
}
|
2023-06-21 15:18:00 -05:00
|
|
|
|
|
|
|
|
if (from?.route.id === '/(user)/search') {
|
|
|
|
|
backUrl = from.url.href;
|
|
|
|
|
}
|
2022-07-16 23:52:00 -05:00
|
|
|
});
|
2022-07-22 09:44:22 -05:00
|
|
|
|
2022-12-05 04:35:20 +13:00
|
|
|
const albumDateFormat: Intl.DateTimeFormatOptions = {
|
2022-12-04 22:51:22 -06:00
|
|
|
month: 'short',
|
|
|
|
|
day: 'numeric',
|
|
|
|
|
year: 'numeric'
|
|
|
|
|
};
|
2022-07-22 09:44:22 -05:00
|
|
|
|
2022-12-05 04:35:20 +13:00
|
|
|
const getDateRange = () => {
|
2023-02-19 16:44:53 +00:00
|
|
|
const startDate = new Date(album.assets[0].fileCreatedAt);
|
|
|
|
|
const endDate = new Date(album.assets[album.assetCount - 1].fileCreatedAt);
|
2022-12-05 04:35:20 +13:00
|
|
|
|
2023-02-22 18:53:08 +01:00
|
|
|
const startDateString = startDate.toLocaleDateString($locale, albumDateFormat);
|
|
|
|
|
const endDateString = endDate.toLocaleDateString($locale, albumDateFormat);
|
2022-12-05 04:35:20 +13:00
|
|
|
|
|
|
|
|
// If the start and end date are the same, only show one date
|
2022-12-04 22:51:22 -06:00
|
|
|
return startDateString === endDateString
|
|
|
|
|
? startDateString
|
|
|
|
|
: `${startDateString} - ${endDateString}`;
|
2022-07-15 23:18:17 -05:00
|
|
|
};
|
|
|
|
|
|
2022-07-22 09:44:22 -05:00
|
|
|
onMount(async () => {
|
|
|
|
|
currentAlbumName = album.albumName;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const { data } = await api.userApi.getMyUserInfo();
|
|
|
|
|
currentUser = data;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log('Error [getMyUserInfo - album-viewer] ', e);
|
|
|
|
|
}
|
2022-07-15 23:18:17 -05:00
|
|
|
});
|
2022-07-18 00:22:39 -05:00
|
|
|
|
2022-07-22 09:44:22 -05:00
|
|
|
// Update Album Name
|
|
|
|
|
$: {
|
|
|
|
|
if (!isEditingTitle && currentAlbumName != album.albumName && isOwned) {
|
|
|
|
|
api.albumApi
|
2023-05-28 04:52:22 +03:00
|
|
|
.updateAlbumInfo({
|
|
|
|
|
id: album.id,
|
|
|
|
|
updateAlbumDto: {
|
|
|
|
|
albumName: album.albumName
|
|
|
|
|
}
|
2022-07-22 09:44:22 -05:00
|
|
|
})
|
|
|
|
|
.then(() => {
|
|
|
|
|
currentAlbumName = album.albumName;
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
2022-08-26 10:36:41 -07:00
|
|
|
console.error('Error [updateAlbumInfo] ', e);
|
|
|
|
|
notificationController.show({
|
|
|
|
|
type: NotificationType.Error,
|
|
|
|
|
message: "Error updating album's name, check console for more details"
|
|
|
|
|
});
|
2022-07-22 09:44:22 -05:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const createAlbumHandler = async (event: CustomEvent) => {
|
2022-09-04 08:34:39 -05:00
|
|
|
const { assets }: { assets: AssetResponseDto[] } = event.detail;
|
2022-07-22 09:44:22 -05:00
|
|
|
try {
|
2023-05-28 04:52:22 +03:00
|
|
|
const { data } = await api.albumApi.addAssetsToAlbum({
|
|
|
|
|
id: album.id,
|
|
|
|
|
addAssetsDto: {
|
2023-01-09 14:16:08 -06:00
|
|
|
assetIds: assets.map((a) => a.id)
|
|
|
|
|
},
|
2023-05-28 04:52:22 +03:00
|
|
|
key: sharedLink?.key
|
|
|
|
|
});
|
2022-07-22 09:44:22 -05:00
|
|
|
|
2022-10-28 21:54:09 +02:00
|
|
|
if (data.album) {
|
|
|
|
|
album = data.album;
|
|
|
|
|
}
|
2022-07-22 09:44:22 -05:00
|
|
|
isShowAssetSelection = false;
|
|
|
|
|
} catch (e) {
|
2022-08-26 10:36:41 -07:00
|
|
|
console.error('Error [createAlbumHandler] ', e);
|
|
|
|
|
notificationController.show({
|
|
|
|
|
type: NotificationType.Error,
|
|
|
|
|
message: 'Error creating album, check console for more details'
|
|
|
|
|
});
|
2022-07-22 09:44:22 -05:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const addUserHandler = async (event: CustomEvent) => {
|
|
|
|
|
const { selectedUsers }: { selectedUsers: UserResponseDto[] } = event.detail;
|
|
|
|
|
|
|
|
|
|
try {
|
2023-05-28 04:52:22 +03:00
|
|
|
const { data } = await api.albumApi.addUsersToAlbum({
|
|
|
|
|
id: album.id,
|
|
|
|
|
addUsersDto: {
|
|
|
|
|
sharedUserIds: Array.from(selectedUsers).map((u) => u.id)
|
|
|
|
|
}
|
2022-07-22 09:44:22 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
album = data;
|
|
|
|
|
|
|
|
|
|
isShowShareUserSelection = false;
|
|
|
|
|
} catch (e) {
|
2022-08-26 10:36:41 -07:00
|
|
|
console.error('Error [addUserHandler] ', e);
|
|
|
|
|
notificationController.show({
|
|
|
|
|
type: NotificationType.Error,
|
|
|
|
|
message: 'Error adding users to album, check console for more details'
|
|
|
|
|
});
|
2022-07-22 09:44:22 -05:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2022-07-23 13:08:49 -05:00
|
|
|
const sharedUserDeletedHandler = async (event: CustomEvent) => {
|
|
|
|
|
const { userId }: { userId: string } = event.detail;
|
|
|
|
|
|
|
|
|
|
if (userId == 'me') {
|
|
|
|
|
isShowShareInfoModal = false;
|
|
|
|
|
goto(backUrl);
|
2023-06-07 10:37:25 -04:00
|
|
|
return;
|
2022-07-22 09:44:22 -05:00
|
|
|
}
|
2022-07-23 13:08:49 -05:00
|
|
|
|
|
|
|
|
try {
|
2023-05-28 04:52:22 +03:00
|
|
|
const { data } = await api.albumApi.getAlbumInfo({ id: album.id });
|
2022-07-23 13:08:49 -05:00
|
|
|
|
|
|
|
|
album = data;
|
2023-06-07 10:37:25 -04:00
|
|
|
isShowShareInfoModal = data.sharedUsers.length >= 1;
|
2022-07-23 13:08:49 -05:00
|
|
|
} catch (e) {
|
2023-06-07 10:37:25 -04:00
|
|
|
handleError(e, 'Error deleting share users');
|
2022-07-23 13:08:49 -05:00
|
|
|
}
|
|
|
|
|
};
|
2022-07-24 22:47:12 -05:00
|
|
|
|
|
|
|
|
const removeAlbum = async () => {
|
2023-06-30 21:53:16 +02:00
|
|
|
try {
|
|
|
|
|
await api.albumApi.deleteAlbum({ id: album.id });
|
|
|
|
|
goto(backUrl);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Error [userDeleteMenu] ', e);
|
|
|
|
|
notificationController.show({
|
|
|
|
|
type: NotificationType.Error,
|
|
|
|
|
message: 'Error deleting album, check console for more details'
|
|
|
|
|
});
|
|
|
|
|
} finally {
|
|
|
|
|
isShowDeleteConfirmation = false;
|
2022-07-24 22:47:12 -05:00
|
|
|
}
|
|
|
|
|
};
|
2022-07-27 11:16:02 -05:00
|
|
|
|
2022-10-30 18:38:04 +01:00
|
|
|
const downloadAlbum = async () => {
|
2023-06-30 12:24:28 -04:00
|
|
|
await downloadArchive(
|
|
|
|
|
`${album.albumName}.zip`,
|
|
|
|
|
{ albumId: album.id },
|
|
|
|
|
undefined,
|
|
|
|
|
sharedLink?.key
|
|
|
|
|
);
|
2022-10-30 18:38:04 +01:00
|
|
|
};
|
|
|
|
|
|
2023-02-10 23:17:39 +01:00
|
|
|
const showAlbumOptionsMenu = ({ x, y }: MouseEvent) => {
|
|
|
|
|
contextMenuPosition = { x, y };
|
2022-07-27 11:16:02 -05:00
|
|
|
isShowAlbumOptions = !isShowAlbumOptions;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const setAlbumThumbnailHandler = (event: CustomEvent) => {
|
|
|
|
|
const { asset }: { asset: AssetResponseDto } = event.detail;
|
|
|
|
|
try {
|
2023-05-28 04:52:22 +03:00
|
|
|
api.albumApi.updateAlbumInfo({
|
|
|
|
|
id: album.id,
|
|
|
|
|
updateAlbumDto: {
|
|
|
|
|
albumThumbnailAssetId: asset.id
|
|
|
|
|
}
|
2022-07-27 11:16:02 -05:00
|
|
|
});
|
|
|
|
|
} catch (e) {
|
2022-08-26 10:36:41 -07:00
|
|
|
console.error('Error [setAlbumThumbnailHandler] ', e);
|
|
|
|
|
notificationController.show({
|
|
|
|
|
type: NotificationType.Error,
|
|
|
|
|
message: 'Error setting album thumbnail, check console for more details'
|
|
|
|
|
});
|
2022-07-27 11:16:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isShowThumbnailSelection = false;
|
|
|
|
|
};
|
2023-01-09 14:16:08 -06:00
|
|
|
|
|
|
|
|
const onSharedLinkClickHandler = () => {
|
|
|
|
|
isShowShareUserSelection = false;
|
|
|
|
|
isShowShareLinkModal = true;
|
|
|
|
|
};
|
2023-06-10 21:06:13 +02:00
|
|
|
|
|
|
|
|
const handleSelectAll = () => {
|
|
|
|
|
multiSelectAsset = new Set(album.assets);
|
|
|
|
|
};
|
2022-07-15 23:18:17 -05:00
|
|
|
</script>
|
|
|
|
|
|
2023-04-05 18:41:27 +02:00
|
|
|
<section class="bg-immich-bg dark:bg-immich-dark-bg" class:hidden={isShowThumbnailSelection}>
|
2022-07-23 23:23:14 -05:00
|
|
|
<!-- Multiselection mode app bar -->
|
|
|
|
|
{#if isMultiSelectionMode}
|
2023-05-16 16:13:20 +02:00
|
|
|
<AssetSelectControlBar
|
|
|
|
|
assets={multiSelectAsset}
|
2023-05-17 13:07:17 -04:00
|
|
|
clearSelect={() => (multiSelectAsset = new Set())}
|
2022-07-23 23:23:14 -05:00
|
|
|
>
|
2023-06-10 21:06:13 +02:00
|
|
|
<CircleIconButton title="Select all" logo={SelectAll} on:click={handleSelectAll} />
|
2023-06-29 17:11:37 +02:00
|
|
|
{#if sharedLink?.allowDownload || !isPublicShared}
|
2023-06-30 12:24:28 -04:00
|
|
|
<DownloadAction filename="{album.albumName}.zip" sharedLinkKey={sharedLink?.key} />
|
2023-06-29 17:11:37 +02:00
|
|
|
{/if}
|
2023-05-16 16:13:20 +02:00
|
|
|
{#if isOwned}
|
|
|
|
|
<RemoveFromAlbum bind:album />
|
|
|
|
|
{/if}
|
|
|
|
|
</AssetSelectControlBar>
|
2022-07-23 23:23:14 -05:00
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<!-- Default app bar -->
|
|
|
|
|
{#if !isMultiSelectionMode}
|
2023-01-09 14:16:08 -06:00
|
|
|
<ControlAppBar
|
|
|
|
|
on:close-button-click={() => goto(backUrl)}
|
|
|
|
|
backIcon={ArrowLeft}
|
|
|
|
|
showBackButton={(!isPublicShared && isOwned) ||
|
|
|
|
|
(!isPublicShared && !isOwned) ||
|
|
|
|
|
(isPublicShared && isOwned)}
|
|
|
|
|
>
|
|
|
|
|
<svelte:fragment slot="leading">
|
|
|
|
|
{#if isPublicShared && !isOwned}
|
|
|
|
|
<a
|
|
|
|
|
data-sveltekit-preload-data="hover"
|
|
|
|
|
class="flex gap-2 place-items-center hover:cursor-pointer ml-6"
|
|
|
|
|
href="https://immich.app"
|
|
|
|
|
>
|
2023-02-10 23:01:35 +01:00
|
|
|
<ImmichLogo height={30} width={30} />
|
2023-01-09 14:16:08 -06:00
|
|
|
<h1 class="font-immich-title text-lg text-immich-primary dark:text-immich-dark-primary">
|
|
|
|
|
IMMICH
|
|
|
|
|
</h1>
|
|
|
|
|
</a>
|
|
|
|
|
{/if}
|
|
|
|
|
</svelte:fragment>
|
|
|
|
|
|
2022-07-23 23:23:14 -05:00
|
|
|
<svelte:fragment slot="trailing">
|
2023-05-29 20:58:09 +02:00
|
|
|
{#if !isCreatingSharedAlbum}
|
2023-01-09 14:16:08 -06:00
|
|
|
{#if !sharedLink}
|
|
|
|
|
<CircleIconButton
|
|
|
|
|
title="Add Photos"
|
|
|
|
|
on:click={() => (isShowAssetSelection = true)}
|
|
|
|
|
logo={FileImagePlusOutline}
|
|
|
|
|
/>
|
2023-05-29 20:58:09 +02:00
|
|
|
{:else if sharedLink?.allowUpload}
|
2023-01-09 14:16:08 -06:00
|
|
|
<CircleIconButton
|
|
|
|
|
title="Add Photos"
|
|
|
|
|
on:click={() => openFileUploadDialog(album.id, sharedLink?.key)}
|
|
|
|
|
logo={FileImagePlusOutline}
|
|
|
|
|
/>
|
|
|
|
|
{/if}
|
2022-07-23 23:23:14 -05:00
|
|
|
|
|
|
|
|
{#if isOwned}
|
|
|
|
|
<CircleIconButton
|
|
|
|
|
title="Share"
|
|
|
|
|
on:click={() => (isShowShareUserSelection = true)}
|
|
|
|
|
logo={ShareVariantOutline}
|
|
|
|
|
/>
|
2023-06-30 21:53:16 +02:00
|
|
|
<CircleIconButton
|
|
|
|
|
title="Remove album"
|
|
|
|
|
on:click={() => (isShowDeleteConfirmation = true)}
|
|
|
|
|
logo={DeleteOutline}
|
|
|
|
|
/>
|
2022-07-23 23:23:14 -05:00
|
|
|
{/if}
|
2023-05-29 20:58:09 +02:00
|
|
|
{/if}
|
2022-07-27 11:16:02 -05:00
|
|
|
|
2023-05-29 20:58:09 +02:00
|
|
|
{#if album.assetCount > 0 && !isCreatingSharedAlbum}
|
2023-01-21 22:15:16 -06:00
|
|
|
{#if !isPublicShared || (isPublicShared && sharedLink?.allowDownload)}
|
|
|
|
|
<CircleIconButton
|
|
|
|
|
title="Download"
|
|
|
|
|
on:click={() => downloadAlbum()}
|
|
|
|
|
logo={FolderDownloadOutline}
|
|
|
|
|
/>
|
|
|
|
|
{/if}
|
2022-10-30 18:38:04 +01:00
|
|
|
|
2023-05-23 16:40:32 -04:00
|
|
|
{#if !isPublicShared && isOwned}
|
2023-05-29 20:58:09 +02:00
|
|
|
<CircleIconButton
|
|
|
|
|
title="Album options"
|
|
|
|
|
on:click={showAlbumOptionsMenu}
|
|
|
|
|
logo={DotsVertical}
|
|
|
|
|
>
|
|
|
|
|
{#if isShowAlbumOptions}
|
|
|
|
|
<ContextMenu
|
|
|
|
|
{...contextMenuPosition}
|
|
|
|
|
on:outclick={() => (isShowAlbumOptions = false)}
|
|
|
|
|
>
|
|
|
|
|
<MenuOption
|
|
|
|
|
on:click={() => {
|
|
|
|
|
isShowThumbnailSelection = true;
|
|
|
|
|
isShowAlbumOptions = false;
|
|
|
|
|
}}
|
|
|
|
|
text="Set album cover"
|
|
|
|
|
/>
|
|
|
|
|
</ContextMenu>
|
|
|
|
|
{/if}
|
|
|
|
|
</CircleIconButton>
|
2023-01-09 14:16:08 -06:00
|
|
|
{/if}
|
2023-05-29 20:58:09 +02:00
|
|
|
{/if}
|
2023-01-09 14:16:08 -06:00
|
|
|
|
2023-05-29 20:58:09 +02:00
|
|
|
{#if isPublicShared}
|
|
|
|
|
<ThemeButton />
|
2022-07-23 23:23:14 -05:00
|
|
|
{/if}
|
2022-07-22 09:44:22 -05:00
|
|
|
|
2022-07-23 23:23:14 -05:00
|
|
|
{#if isCreatingSharedAlbum && album.sharedUsers.length == 0}
|
2023-04-07 18:45:00 +02:00
|
|
|
<Button
|
|
|
|
|
size="sm"
|
|
|
|
|
rounded="lg"
|
2022-08-10 22:48:25 -05:00
|
|
|
disabled={album.assetCount == 0}
|
2022-07-23 23:23:14 -05:00
|
|
|
on:click={() => (isShowShareUserSelection = true)}
|
|
|
|
|
>
|
2023-04-07 18:45:00 +02:00
|
|
|
Share
|
|
|
|
|
</Button>
|
2022-07-23 23:23:14 -05:00
|
|
|
{/if}
|
|
|
|
|
</svelte:fragment>
|
2022-08-08 22:06:11 -05:00
|
|
|
</ControlAppBar>
|
2022-07-23 23:23:14 -05:00
|
|
|
{/if}
|
2022-07-15 23:18:17 -05:00
|
|
|
|
2023-01-09 14:16:08 -06:00
|
|
|
<section class="flex flex-col my-[160px] px-6 sm:px-12 md:px-24 lg:px-40">
|
2022-07-22 09:44:22 -05:00
|
|
|
<input
|
2022-07-26 12:28:07 -05:00
|
|
|
on:keydown={(e) => {
|
|
|
|
|
if (e.key == 'Enter') {
|
|
|
|
|
isEditingTitle = false;
|
|
|
|
|
titleInput.blur();
|
|
|
|
|
}
|
|
|
|
|
}}
|
2022-07-22 09:44:22 -05:00
|
|
|
on:focus={() => (isEditingTitle = true)}
|
|
|
|
|
on:blur={() => (isEditingTitle = false)}
|
2022-10-26 11:10:48 -05:00
|
|
|
class={`transition-all text-6xl text-immich-primary dark:text-immich-dark-primary w-[99%] border-b-2 border-transparent outline-none ${
|
2022-07-22 09:44:22 -05:00
|
|
|
isOwned ? 'hover:border-gray-400' : 'hover:border-transparent'
|
2022-10-26 11:10:48 -05:00
|
|
|
} focus:outline-none focus:border-b-2 focus:border-immich-primary dark:focus:border-immich-dark-primary bg-immich-bg dark:bg-immich-dark-bg dark:focus:bg-immich-dark-gray`}
|
2022-07-22 09:44:22 -05:00
|
|
|
type="text"
|
|
|
|
|
bind:value={album.albumName}
|
|
|
|
|
disabled={!isOwned}
|
2022-07-26 12:28:07 -05:00
|
|
|
bind:this={titleInput}
|
2022-07-22 09:44:22 -05:00
|
|
|
/>
|
2022-07-15 23:18:17 -05:00
|
|
|
|
2022-08-10 22:48:25 -05:00
|
|
|
{#if album.assetCount > 0}
|
2023-04-22 20:38:45 +02:00
|
|
|
<span class="flex gap-2 my-4 text-sm text-gray-500 font-medium" data-testid="album-details">
|
|
|
|
|
<p class="">{getDateRange()}</p>
|
|
|
|
|
<p>·</p>
|
|
|
|
|
<p>{album.assetCount} items</p>
|
|
|
|
|
</span>
|
2022-07-22 09:44:22 -05:00
|
|
|
{/if}
|
|
|
|
|
{#if album.shared}
|
2023-05-28 15:10:55 +02:00
|
|
|
<div class="flex my-6 gap-x-1">
|
|
|
|
|
{#each album.sharedUsers as user (user.id)}
|
|
|
|
|
<button on:click={() => (isShowShareInfoModal = true)}>
|
|
|
|
|
<UserAvatar {user} size="md" autoColor />
|
|
|
|
|
</button>
|
2022-07-15 23:18:17 -05:00
|
|
|
{/each}
|
2022-07-22 09:44:22 -05:00
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
style:display={isOwned ? 'block' : 'none'}
|
|
|
|
|
on:click={() => (isShowShareUserSelection = true)}
|
|
|
|
|
title="Add more users"
|
|
|
|
|
class="h-12 w-12 border bg-white transition-colors hover:bg-gray-300 text-3xl flex place-items-center place-content-center rounded-full"
|
|
|
|
|
>+</button
|
|
|
|
|
>
|
2022-07-15 23:18:17 -05:00
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
2022-08-10 22:48:25 -05:00
|
|
|
{#if album.assetCount > 0}
|
2023-04-20 09:09:27 -05:00
|
|
|
<GalleryViewer
|
|
|
|
|
assets={album.assets}
|
|
|
|
|
{sharedLink}
|
|
|
|
|
bind:selectedAssets={multiSelectAsset}
|
|
|
|
|
viewFrom="album-page"
|
|
|
|
|
/>
|
2022-07-22 09:44:22 -05:00
|
|
|
{:else}
|
|
|
|
|
<!-- Album is empty - Show asset selectection buttons -->
|
|
|
|
|
<section id="empty-album" class=" mt-[200px] flex place-content-center place-items-center">
|
|
|
|
|
<div class="w-[300px]">
|
2022-10-26 11:10:48 -05:00
|
|
|
<p class="text-xs dark:text-immich-dark-fg">ADD PHOTOS</p>
|
2022-07-22 09:44:22 -05:00
|
|
|
<button
|
|
|
|
|
on:click={() => (isShowAssetSelection = true)}
|
2022-10-26 11:10:48 -05:00
|
|
|
class="w-full py-8 border bg-immich-bg dark:bg-immich-dark-gray text-immich-fg dark:text-immich-dark-fg dark:hover:text-immich-dark-primary rounded-md mt-5 flex place-items-center gap-6 px-8 transition-all hover:bg-gray-100 hover:text-immich-primary dark:border-none"
|
2022-07-22 09:44:22 -05:00
|
|
|
>
|
2022-10-26 11:10:48 -05:00
|
|
|
<span class="text-text-immich-primary dark:text-immich-dark-primary"
|
|
|
|
|
><Plus size="24" />
|
|
|
|
|
</span>
|
|
|
|
|
<span class="text-lg">Select photos</span>
|
2022-07-22 09:44:22 -05:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
{/if}
|
2022-07-15 23:18:17 -05:00
|
|
|
</section>
|
|
|
|
|
</section>
|
2022-07-18 00:22:39 -05:00
|
|
|
|
2022-07-22 09:44:22 -05:00
|
|
|
{#if isShowAssetSelection}
|
|
|
|
|
<AssetSelection
|
2022-12-30 04:07:18 +02:00
|
|
|
albumId={album.id}
|
2022-07-22 09:44:22 -05:00
|
|
|
assetsInAlbum={album.assets}
|
|
|
|
|
on:go-back={() => (isShowAssetSelection = false)}
|
|
|
|
|
on:create-album={createAlbumHandler}
|
|
|
|
|
/>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if isShowShareUserSelection}
|
|
|
|
|
<UserSelectionModal
|
2023-01-09 14:16:08 -06:00
|
|
|
{album}
|
2022-07-22 09:44:22 -05:00
|
|
|
on:close={() => (isShowShareUserSelection = false)}
|
|
|
|
|
on:add-user={addUserHandler}
|
2023-01-09 14:16:08 -06:00
|
|
|
on:sharedlinkclick={onSharedLinkClickHandler}
|
2022-07-22 09:44:22 -05:00
|
|
|
sharedUsersInAlbum={new Set(album.sharedUsers)}
|
|
|
|
|
/>
|
|
|
|
|
{/if}
|
2022-07-23 13:08:49 -05:00
|
|
|
|
2023-01-09 14:16:08 -06:00
|
|
|
{#if isShowShareLinkModal}
|
|
|
|
|
<CreateSharedLinkModal
|
|
|
|
|
on:close={() => (isShowShareLinkModal = false)}
|
|
|
|
|
shareType={SharedLinkType.Album}
|
|
|
|
|
{album}
|
|
|
|
|
/>
|
|
|
|
|
{/if}
|
2022-07-23 13:08:49 -05:00
|
|
|
{#if isShowShareInfoModal}
|
|
|
|
|
<ShareInfoModal
|
|
|
|
|
on:close={() => (isShowShareInfoModal = false)}
|
|
|
|
|
{album}
|
|
|
|
|
on:user-deleted={sharedUserDeletedHandler}
|
|
|
|
|
/>
|
|
|
|
|
{/if}
|
2022-07-27 11:16:02 -05:00
|
|
|
|
|
|
|
|
{#if isShowThumbnailSelection}
|
|
|
|
|
<ThumbnailSelection
|
|
|
|
|
{album}
|
|
|
|
|
on:close={() => (isShowThumbnailSelection = false)}
|
|
|
|
|
on:thumbnail-selected={setAlbumThumbnailHandler}
|
|
|
|
|
/>
|
|
|
|
|
{/if}
|
2023-06-30 21:53:16 +02:00
|
|
|
|
|
|
|
|
{#if isShowDeleteConfirmation}
|
|
|
|
|
<ConfirmDialogue
|
|
|
|
|
title="Delete Album"
|
|
|
|
|
confirmText="Delete"
|
|
|
|
|
on:confirm={removeAlbum}
|
|
|
|
|
on:cancel={() => (isShowDeleteConfirmation = false)}
|
|
|
|
|
>
|
|
|
|
|
<svelte:fragment slot="prompt">
|
|
|
|
|
<p>Are you sure you want to delete the album <b>{album.albumName}</b>?</p>
|
|
|
|
|
<p>If this album is shared, other users will not be able to access it anymore.</p>
|
|
|
|
|
</svelte:fragment>
|
|
|
|
|
</ConfirmDialogue>
|
|
|
|
|
{/if}
|