mirror of
https://github.com/immich-app/immich.git
synced 2025-01-16 16:56:46 +01:00
fix(web): show a clearer confirmation message when deleting an unnamed album (#11988)
* fix(web): show a different confirmation message when deleting an unnamed album * Rename the function * Fix formatting
This commit is contained in:
parent
843345df4f
commit
7a4fccb1b2
4 changed files with 21 additions and 10 deletions
|
@ -17,7 +17,7 @@
|
||||||
import { handleError } from '$lib/utils/handle-error';
|
import { handleError } from '$lib/utils/handle-error';
|
||||||
import { downloadAlbum } from '$lib/utils/asset-utils';
|
import { downloadAlbum } from '$lib/utils/asset-utils';
|
||||||
import { normalizeSearchString } from '$lib/utils/string-utils';
|
import { normalizeSearchString } from '$lib/utils/string-utils';
|
||||||
import { getSelectedAlbumGroupOption, type AlbumGroup } from '$lib/utils/album-utils';
|
import { getSelectedAlbumGroupOption, type AlbumGroup, confirmAlbumDelete } from '$lib/utils/album-utils';
|
||||||
import type { ContextMenuPosition } from '$lib/utils/context-menu';
|
import type { ContextMenuPosition } from '$lib/utils/context-menu';
|
||||||
import { user } from '$lib/stores/user.store';
|
import { user } from '$lib/stores/user.store';
|
||||||
import {
|
import {
|
||||||
|
@ -31,7 +31,6 @@
|
||||||
} from '$lib/stores/preferences.store';
|
} from '$lib/stores/preferences.store';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute } from '$lib/constants';
|
||||||
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
export let ownedAlbums: AlbumResponseDto[] = [];
|
export let ownedAlbums: AlbumResponseDto[] = [];
|
||||||
|
@ -302,9 +301,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isConfirmed = await dialogController.show({
|
const isConfirmed = await confirmAlbumDelete(albumToDelete);
|
||||||
prompt: $t('album_delete_confirmation', { values: { album: albumToDelete.albumName } }),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!isConfirmed) {
|
if (!isConfirmed) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -335,7 +335,8 @@
|
||||||
"album_added": "Album added",
|
"album_added": "Album added",
|
||||||
"album_added_notification_setting_description": "Receive an email notification when you are added to a shared album",
|
"album_added_notification_setting_description": "Receive an email notification when you are added to a shared album",
|
||||||
"album_cover_updated": "Album cover updated",
|
"album_cover_updated": "Album cover updated",
|
||||||
"album_delete_confirmation": "Are you sure you want to delete the album {album}?\nIf this album is shared, other users will not be able to access it anymore.",
|
"album_delete_confirmation": "Are you sure you want to delete the album {album}?",
|
||||||
|
"album_delete_confirmation_description": "If this album is shared, other users will not be able to access it anymore.",
|
||||||
"album_info_updated": "Album info updated",
|
"album_info_updated": "Album info updated",
|
||||||
"album_leave": "Leave album?",
|
"album_leave": "Leave album?",
|
||||||
"album_leave_confirmation": "Are you sure you want to leave {album}?",
|
"album_leave_confirmation": "Are you sure you want to leave {album}?",
|
||||||
|
@ -1189,6 +1190,7 @@
|
||||||
"unlink_oauth": "Unlink OAuth",
|
"unlink_oauth": "Unlink OAuth",
|
||||||
"unlinked_oauth_account": "Unlinked OAuth account",
|
"unlinked_oauth_account": "Unlinked OAuth account",
|
||||||
"unnamed_album": "Unnamed Album",
|
"unnamed_album": "Unnamed Album",
|
||||||
|
"unnamed_album_delete_confirmation": "Are you sure you want to delete this album?",
|
||||||
"unnamed_share": "Unnamed Share",
|
"unnamed_share": "Unnamed Share",
|
||||||
"unsaved_change": "Unsaved change",
|
"unsaved_change": "Unsaved change",
|
||||||
"unselect_all": "Unselect all",
|
"unselect_all": "Unselect all",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute } from '$lib/constants';
|
||||||
import {
|
import {
|
||||||
AlbumFilter,
|
AlbumFilter,
|
||||||
|
@ -199,3 +200,16 @@ export const collapseAllAlbumGroups = (groupIds: string[]) => {
|
||||||
export const expandAllAlbumGroups = () => {
|
export const expandAllAlbumGroups = () => {
|
||||||
collapseAllAlbumGroups([]);
|
collapseAllAlbumGroups([]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const confirmAlbumDelete = async (album: AlbumResponseDto) => {
|
||||||
|
const $t = get(t);
|
||||||
|
const confirmation =
|
||||||
|
album.albumName.length > 0
|
||||||
|
? $t('album_delete_confirmation', { values: { album: album.albumName } })
|
||||||
|
: $t('unnamed_album_delete_confirmation');
|
||||||
|
|
||||||
|
const description = $t('album_delete_confirmation_description');
|
||||||
|
const prompt = `${confirmation} ${description}`;
|
||||||
|
|
||||||
|
return dialogController.show({ prompt });
|
||||||
|
};
|
||||||
|
|
|
@ -82,9 +82,9 @@
|
||||||
} from '@mdi/js';
|
} from '@mdi/js';
|
||||||
import { fly } from 'svelte/transition';
|
import { fly } from 'svelte/transition';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import { onDestroy } from 'svelte';
|
import { onDestroy } from 'svelte';
|
||||||
|
import { confirmAlbumDelete } from '$lib/utils/album-utils';
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
|
@ -365,9 +365,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRemoveAlbum = async () => {
|
const handleRemoveAlbum = async () => {
|
||||||
const isConfirmed = await dialogController.show({
|
const isConfirmed = await confirmAlbumDelete(album);
|
||||||
prompt: $t('album_delete_confirmation', { values: { album: album.albumName } }),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!isConfirmed) {
|
if (!isConfirmed) {
|
||||||
viewMode = ViewMode.VIEW;
|
viewMode = ViewMode.VIEW;
|
||||||
|
|
Loading…
Reference in a new issue