feat: toasts (#23298)

This commit is contained in:
Jason Rasmussen
2025-10-28 15:09:11 -04:00
committed by GitHub
parent 106effca2e
commit 52596255c8
80 changed files with 341 additions and 1069 deletions

View File

@@ -2,12 +2,11 @@
import { user } from '$lib/stores/user.store';
import { handleError } from '$lib/utils/handle-error';
import { createProfileImage, type AssetResponseDto } from '@immich/sdk';
import { Button, Modal, ModalBody, ModalFooter } from '@immich/ui';
import { Button, Modal, ModalBody, ModalFooter, toastManager } from '@immich/ui';
import domtoimage from 'dom-to-image';
import { onMount } from 'svelte';
import { t } from 'svelte-i18n';
import PhotoViewer from '../components/asset-viewer/photo-viewer.svelte';
import { NotificationType, notificationController } from '../components/shared-components/notification/notification';
interface Props {
asset: AssetResponseDto;
@@ -65,20 +64,12 @@
});
if (await hasTransparentPixels(blob)) {
notificationController.show({
type: NotificationType.Error,
message: $t('errors.profile_picture_transparent_pixels'),
timeout: 3000,
});
toastManager.danger($t('errors.profile_picture_transparent_pixels'));
return;
}
const file = new File([blob], 'profile-picture.png', { type: 'image/png' });
const { profileImagePath, profileChangedAt } = await createProfileImage({ createProfileImageDto: { file } });
notificationController.show({
type: NotificationType.Info,
message: $t('profile_picture_set'),
timeout: 3000,
});
toastManager.success($t('profile_picture_set'));
$user.profileImagePath = profileImagePath;
$user.profileChangedAt = profileChangedAt;
} catch (error) {