|
|
|
|
@ -52,16 +52,20 @@ export const addAssetsToAlbum = async (albumId: string, assetIds: string[], show
|
|
|
|
|
key: authManager.key,
|
|
|
|
|
});
|
|
|
|
|
const count = result.filter(({ success }) => success).length;
|
|
|
|
|
const duplicateErrorCount = result.filter(({ error }) => error === 'duplicate').length;
|
|
|
|
|
const $t = get(t);
|
|
|
|
|
|
|
|
|
|
if (showNotification) {
|
|
|
|
|
let message = $t('assets_cannot_be_added_to_album_count', { values: { count: assetIds.length } });
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
message = $t('assets_added_to_album_count', { values: { count } });
|
|
|
|
|
} else if (duplicateErrorCount > 0) {
|
|
|
|
|
message = $t('assets_were_part_of_album_count', { values: { count: duplicateErrorCount } });
|
|
|
|
|
}
|
|
|
|
|
notificationController.show({
|
|
|
|
|
type: NotificationType.Info,
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
message:
|
|
|
|
|
count > 0
|
|
|
|
|
? $t('assets_added_to_album_count', { values: { count } })
|
|
|
|
|
: $t('assets_were_part_of_album_count', { values: { count: assetIds.length } }),
|
|
|
|
|
message,
|
|
|
|
|
button: {
|
|
|
|
|
text: $t('view_album'),
|
|
|
|
|
onClick() {
|
|
|
|
|
@ -125,23 +129,37 @@ export const addAssetsToNewAlbum = async (albumName: string, assetIds: string[])
|
|
|
|
|
}
|
|
|
|
|
const $t = get(t);
|
|
|
|
|
// for reasons beyond me <ComponentProps<typeof FormatBoldMessage>> doesn't work, even though it's (afaik) exactly this object
|
|
|
|
|
notificationController.show<{ key: Translations; values: InterpolationValues }>({
|
|
|
|
|
type: NotificationType.Info,
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
component: {
|
|
|
|
|
type: FormatBoldMessage,
|
|
|
|
|
props: {
|
|
|
|
|
key: 'assets_added_to_name_count',
|
|
|
|
|
values: { count: assetIds.length, name: albumName, hasName: !!albumName },
|
|
|
|
|
if (album.assets.length === 0) {
|
|
|
|
|
notificationController.show({
|
|
|
|
|
type: NotificationType.Info,
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
message: $t('assets_cannot_be_added_to_album_count', { values: { count: assetIds.length } }),
|
|
|
|
|
button: {
|
|
|
|
|
text: $t('view_album'),
|
|
|
|
|
onClick() {
|
|
|
|
|
return goto(`${AppRoute.ALBUMS}/${album.id}`);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
button: {
|
|
|
|
|
text: $t('view_album'),
|
|
|
|
|
onClick() {
|
|
|
|
|
return goto(`${AppRoute.ALBUMS}/${album.id}`);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
notificationController.show<{ key: Translations; values: InterpolationValues }>({
|
|
|
|
|
type: NotificationType.Info,
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
component: {
|
|
|
|
|
type: FormatBoldMessage,
|
|
|
|
|
props: {
|
|
|
|
|
key: 'assets_added_to_name_count',
|
|
|
|
|
values: { count: album.assets.length, name: albumName, hasName: !!albumName },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
button: {
|
|
|
|
|
text: $t('view_album'),
|
|
|
|
|
onClick() {
|
|
|
|
|
return goto(`${AppRoute.ALBUMS}/${album.id}`);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return album;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|