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

@@ -5,10 +5,6 @@
import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte';
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
import {
notificationController,
NotificationType,
} from '$lib/components/shared-components/notification/notification';
import LibraryImportPathModal from '$lib/modals/LibraryImportPathModal.svelte';
import LibraryRenameModal from '$lib/modals/LibraryRenameModal.svelte';
import LibraryUserPickerModal from '$lib/modals/LibraryUserPickerModal.svelte';
@@ -30,7 +26,7 @@
type LibraryStatsResponseDto,
type UserResponseDto,
} from '@immich/sdk';
import { Button, LoadingSpinner, modalManager, Text } from '@immich/ui';
import { Button, LoadingSpinner, modalManager, Text, toastManager } from '@immich/ui';
import { mdiDotsVertical, mdiPlusBoxOutline, mdiSync } from '@mdi/js';
import { onMount } from 'svelte';
import { t } from 'svelte-i18n';
@@ -92,10 +88,7 @@
let createdLibrary: LibraryResponseDto | undefined;
try {
createdLibrary = await createLibrary({ createLibraryDto: { ownerId } });
notificationController.show({
message: $t('admin.library_created', { values: { library: createdLibrary.name } }),
type: NotificationType.Info,
});
toastManager.success($t('admin.library_created', { values: { library: createdLibrary.name } }));
} catch (error) {
handleError(error, $t('errors.unable_to_create_library'));
} finally {
@@ -160,10 +153,7 @@
try {
await sendJobCommand({ id: JobName.Library, jobCommandDto: { command: JobCommand.Start } });
notificationController.show({
message: $t('admin.refreshing_all_libraries'),
type: NotificationType.Info,
});
toastManager.info($t('admin.refreshing_all_libraries'));
} catch (error) {
handleError(error, $t('errors.unable_to_scan_libraries'));
}
@@ -172,10 +162,7 @@
const handleScan = async (libraryId: string) => {
try {
await scanLibrary({ id: libraryId });
notificationController.show({
message: $t('admin.scanning_library'),
type: NotificationType.Info,
});
toastManager.info($t('admin.scanning_library'));
} catch (error) {
handleError(error, $t('errors.unable_to_scan_library'));
}
@@ -244,7 +231,7 @@
try {
await deleteLibrary({ id: library.id });
notificationController.show({ message: $t('admin.library_deleted'), type: NotificationType.Info });
toastManager.success($t('admin.library_deleted'));
} catch (error) {
handleError(error, $t('errors.unable_to_remove_library'));
} finally {