mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 15:38:24 -08:00
feat: toasts (#23298)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user