diff --git a/web/src/lib/components/album-page/album-viewer.svelte b/web/src/lib/components/album-page/album-viewer.svelte index 5a4425833a..85c368458c 100644 --- a/web/src/lib/components/album-page/album-viewer.svelte +++ b/web/src/lib/components/album-page/album-viewer.svelte @@ -22,6 +22,10 @@ import MenuOption from '../shared-components/context-menu/menu-option.svelte'; import ThumbnailSelection from './thumbnail-selection.svelte'; import ControlAppBar from '../shared-components/control-app-bar.svelte'; + import { + notificationController, + NotificationType + } from '../shared-components/notification/notification'; export let album: AlbumResponseDto; @@ -129,7 +133,11 @@ album = data; multiSelectAsset = new Set(); } catch (e) { - console.log('Error [album-viewer] [removeAssetFromAlbum]', e); + console.error('Error [album-viewer] [removeAssetFromAlbum]', e); + notificationController.show({ + type: NotificationType.Error, + message: 'Error removing assets from album, check console for more details' + }); } } }; @@ -179,7 +187,11 @@ currentAlbumName = album.albumName; }) .catch((e) => { - console.log('Error [updateAlbumInfo] ', e); + console.error('Error [updateAlbumInfo] ', e); + notificationController.show({ + type: NotificationType.Error, + message: "Error updating album's name, check console for more details" + }); }); } } @@ -193,7 +205,11 @@ isShowAssetSelection = false; } catch (e) { - console.log('Error [createAlbumHandler] ', e); + console.error('Error [createAlbumHandler] ', e); + notificationController.show({ + type: NotificationType.Error, + message: 'Error creating album, check console for more details' + }); } }; @@ -209,7 +225,11 @@ isShowShareUserSelection = false; } catch (e) { - console.log('Error [createAlbumHandler] ', e); + console.error('Error [addUserHandler] ', e); + notificationController.show({ + type: NotificationType.Error, + message: 'Error adding users to album, check console for more details' + }); } }; @@ -227,7 +247,11 @@ album = data; isShowShareInfoModal = false; } catch (e) { - console.log('Error [sharedUserDeletedHandler] ', e); + console.error('Error [sharedUserDeletedHandler] ', e); + notificationController.show({ + type: NotificationType.Error, + message: 'Error deleting share users, check console for more details' + }); } }; @@ -241,7 +265,11 @@ await api.albumApi.deleteAlbum(album.id); goto(backUrl); } catch (e) { - console.log('Error [userDeleteMenu] ', e); + console.error('Error [userDeleteMenu] ', e); + notificationController.show({ + type: NotificationType.Error, + message: 'Error deleting album, check console for more details' + }); } } }; @@ -262,7 +290,11 @@ albumThumbnailAssetId: asset.id }); } catch (e) { - console.log('Error [setAlbumThumbnailHandler] ', e); + console.error('Error [setAlbumThumbnailHandler] ', e); + notificationController.show({ + type: NotificationType.Error, + message: 'Error setting album thumbnail, check console for more details' + }); } isShowThumbnailSelection = false; diff --git a/web/src/lib/components/album-page/share-info-modal.svelte b/web/src/lib/components/album-page/share-info-modal.svelte index 1ec884c00e..ae76340a26 100644 --- a/web/src/lib/components/album-page/share-info-modal.svelte +++ b/web/src/lib/components/album-page/share-info-modal.svelte @@ -7,6 +7,10 @@ import CircleIconButton from '../shared-components/circle-icon-button.svelte'; import ContextMenu from '../shared-components/context-menu/context-menu.svelte'; import MenuOption from '../shared-components/context-menu/menu-option.svelte'; + import { + notificationController, + NotificationType + } from '../shared-components/notification/notification'; export let album: AlbumResponseDto; @@ -24,6 +28,10 @@ currentUser = data; } catch (e) { console.error('Error [share-info-modal] [getAllUsers]', e); + notificationController.show({ + message: 'Error getting user info, check console for more details', + type: NotificationType.Error + }); } }); @@ -48,6 +56,10 @@ dispatch('user-deleted', { userId }); } catch (e) { console.error('Error [share-info-modal] [removeUser]', e); + notificationController.show({ + message: 'Error removing user, check console for more details', + type: NotificationType.Error + }); } } }; diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index 5347389e1f..980314cf6f 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -9,6 +9,10 @@ import { downloadAssets } from '$lib/stores/download'; import VideoViewer from './video-viewer.svelte'; import { api, AssetResponseDto, AssetTypeEnum } from '@api'; + import { + notificationController, + NotificationType + } from '../shared-components/notification/notification'; export let asset: AssetResponseDto; @@ -115,7 +119,11 @@ }, 2000); } } catch (e) { - console.log('Error downloading file ', e); + console.error('Error downloading file ', e); + notificationController.show({ + type: NotificationType.Error, + message: 'Error downloading file, check console for more details.' + }); } }; diff --git a/web/src/lib/components/asset-viewer/photo-viewer.svelte b/web/src/lib/components/asset-viewer/photo-viewer.svelte index 920192a48e..9297b8e8c7 100644 --- a/web/src/lib/components/asset-viewer/photo-viewer.svelte +++ b/web/src/lib/components/asset-viewer/photo-viewer.svelte @@ -1,7 +1,7 @@ diff --git a/web/src/lib/components/shared-components/navigation-bar.svelte b/web/src/lib/components/shared-components/navigation-bar.svelte index 96c2766820..3e7c109814 100644 --- a/web/src/lib/components/shared-components/navigation-bar.svelte +++ b/web/src/lib/components/shared-components/navigation-bar.svelte @@ -25,7 +25,6 @@ await api.userApi.getProfileImage(user.id); shouldShowProfileImage = true; } catch (e) { - console.log('User does not have a profile image'); shouldShowProfileImage = false; } }; @@ -33,10 +32,6 @@ return text?.charAt(0).toUpperCase(); }; - const navigateToAdmin = () => { - goto('/admin'); - }; - const showAccountInfoPanel = () => { shouldShowAccountInfoPanel = true; }; diff --git a/web/src/lib/components/shared-components/notification/notification.ts b/web/src/lib/components/shared-components/notification/notification.ts index 3136165d93..98002ec8e8 100644 --- a/web/src/lib/components/shared-components/notification/notification.ts +++ b/web/src/lib/components/shared-components/notification/notification.ts @@ -27,7 +27,7 @@ export class ImmichNotificationDto { /** * Timeout in miliseconds */ - timeout = 3000; + timeout?: number; } function createNotificationList() { const notificationList = writable([]); @@ -36,7 +36,7 @@ function createNotificationList() { const newNotification = new ImmichNotification(); newNotification.message = notificationInfo.message; newNotification.type = notificationInfo.type; - newNotification.timeout = notificationInfo.timeout; + newNotification.timeout = notificationInfo.timeout || 3000; notificationList.update((currentList) => [...currentList, newNotification]); }; diff --git a/web/src/routes/albums/+page.svelte b/web/src/routes/albums/+page.svelte index dacb5cb9d5..ff2be0c9a3 100644 --- a/web/src/routes/albums/+page.svelte +++ b/web/src/routes/albums/+page.svelte @@ -10,6 +10,10 @@ import NavigationBar from '$lib/components/shared-components/navigation-bar.svelte'; import SideBar from '$lib/components/shared-components/side-bar/side-bar.svelte'; import PlusBoxOutline from 'svelte-material-icons/PlusBoxOutline.svelte'; + import { + notificationController, + NotificationType + } from '$lib/components/shared-components/notification/notification'; export let data: PageData; @@ -40,7 +44,11 @@ goto('/albums/' + newAlbum.id); } catch (e) { - console.log('Error [createAlbum] ', e); + console.error('Error [createAlbum] ', e); + notificationController.show({ + message: 'Error creating album, check console for more details', + type: NotificationType.Error + }); } }; @@ -49,7 +57,7 @@ await api.albumApi.deleteAlbum(album.id); return true; } catch (e) { - console.log('Error [autoDeleteAlbum] ', e); + console.error('Error [autoDeleteAlbum] ', e); return false; } }; @@ -64,7 +72,11 @@ await api.albumApi.deleteAlbum(targetAlbum.id); data.albums = data.albums.filter((a) => a.id !== targetAlbum.id); } catch (e) { - console.log('Error [userDeleteMenu] ', e); + console.error('Error [userDeleteMenu] ', e); + notificationController.show({ + message: 'Error deleting user, check console for more details', + type: NotificationType.Error + }); } } diff --git a/web/src/routes/photos/+page.svelte b/web/src/routes/photos/+page.svelte index d1c546d25d..38bf463e52 100644 --- a/web/src/routes/photos/+page.svelte +++ b/web/src/routes/photos/+page.svelte @@ -21,6 +21,10 @@ import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte'; import type { PageData } from './$types'; import { onMount } from 'svelte'; + import { + notificationController, + NotificationType + } from '$lib/components/shared-components/notification/notification'; export let data: PageData; @@ -68,7 +72,10 @@ pushState(selectedAsset.id); } } catch (e) { - console.log('Error navigating asset forward', e); + notificationController.show({ + type: NotificationType.Info, + message: 'You have reached the end' + }); } }; @@ -80,7 +87,10 @@ pushState(selectedAsset.id); } } catch (e) { - console.log('Error navigating asset backward', e); + notificationController.show({ + type: NotificationType.Info, + message: 'You have reached the end' + }); } }; @@ -176,7 +186,11 @@ clearMultiSelectAssetAssetHandler(); } } catch (e) { - console.log('Error deleteSelectedAssetHandler', e); + notificationController.show({ + type: NotificationType.Error, + message: 'Error deleting assets, check console for more details' + }); + console.error('Error deleteSelectedAssetHandler', e); } }; diff --git a/web/src/routes/sharing/+page.svelte b/web/src/routes/sharing/+page.svelte index d171ded06f..f7325ecc43 100644 --- a/web/src/routes/sharing/+page.svelte +++ b/web/src/routes/sharing/+page.svelte @@ -6,6 +6,10 @@ import { goto } from '$app/navigation'; import { api } from '@api'; import type { PageData } from './$types'; + import { + notificationController, + NotificationType + } from '$lib/components/shared-components/notification/notification'; export let data: PageData; @@ -17,6 +21,11 @@ goto('/albums/' + newAlbum.id); } catch (e) { + notificationController.show({ + message: 'Error creating album, check console for more details', + type: NotificationType.Error + }); + console.log('Error [createAlbum] ', e); } };