1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-16 03:40:33 +02:00

feat(web) Add drag n drop upload functionality (#1216)

* Add image drag n drop functionality

* Change upload cover name, background color and opacity
This commit is contained in:
Krisjanis Lejejs
2022-12-30 04:07:18 +02:00
committed by GitHub
parent 6736063f83
commit 10b0924cfb
11 changed files with 159 additions and 177 deletions

View File

@ -12,7 +12,6 @@
import AlbumSelectionModal from '../shared-components/album-selection-modal.svelte';
import {
api,
AddAssetsResponseDto,
AssetResponseDto,
AssetTypeEnum,
AlbumResponseDto
@ -23,6 +22,7 @@
} from '../shared-components/notification/notification';
import { assetStore } from '$lib/stores/assets.store';
import { addAssetsToAlbum } from '$lib/utils/asset-utils';
export let asset: AssetResponseDto;
$: {
@ -209,17 +209,6 @@
addToSharedAlbum = shared;
};
const showAddNotification = (dto: AddAssetsResponseDto) => {
notificationController.show({
message: `Added ${dto.successfullyAdded} to ${dto.album?.albumName}`,
type: NotificationType.Info
});
if (dto.successfullyAdded === 1 && dto.album) {
appearsInAlbums = [...appearsInAlbums, dto.album];
}
};
const handleAddToNewAlbum = () => {
isShowAlbumPicker = false;
api.albumApi.createAlbum({ albumName: 'Untitled', assetIds: [asset.id] }).then((response) => {
@ -232,9 +221,11 @@
isShowAlbumPicker = false;
const album = event.detail.album;
api.albumApi
.addAssetsToAlbum(album.id, { assetIds: [asset.id] })
.then((response) => showAddNotification(response.data));
addAssetsToAlbum(album.id, [asset.id]).then((dto) => {
if (dto.successfullyAdded === 1 && dto.album) {
appearsInAlbums = [...appearsInAlbums, dto.album];
}
});
};
</script>