Implemented Keep photos collection action

This commit is contained in:
Ananddubey01 2023-01-31 13:01:11 +05:30
parent bb2b78d6ff
commit b8faf0d22d
2 changed files with 19 additions and 4 deletions

View file

@ -40,6 +40,7 @@ export enum CollectionActions {
UNARCHIVE,
CONFIRM_DELETE,
DELETE,
KEEP_PHOTOS,
SHOW_SHARE_DIALOG,
CONFIRM_EMPTY_TRASH,
EMPTY_TRASH,
@ -90,6 +91,9 @@ const CollectionOptions = (props: CollectionOptionsProps) => {
case CollectionActions.DELETE:
callback = deleteCollection;
break;
case CollectionActions.KEEP_PHOTOS:
callback = keepPhotos;
break;
case CollectionActions.SHOW_SHARE_DIALOG:
callback = showCollectionShareModal;
break;
@ -138,7 +142,12 @@ const CollectionOptions = (props: CollectionOptionsProps) => {
};
const deleteCollection = async () => {
await CollectionAPI.deleteCollection(activeCollection.id);
await CollectionAPI.deleteCollection(activeCollection.id, false);
redirectToAll();
};
const keepPhotos = async () => {
await CollectionAPI.deleteCollection(activeCollection.id, true);
redirectToAll();
};
@ -177,7 +186,7 @@ const CollectionOptions = (props: CollectionOptionsProps) => {
const confirmDeleteCollection = () => {
setDialogMessage({
title: constants.DELETE_COLLECTION_TITLE,
content: constants.DELETE_COLLECTION_MESSAGE,
content: constants.DELETE_COLLECTION_MESSAGE(),
proceed: {
text: constants.DELETE_COLLECTION,
action: handleCollectionAction(CollectionActions.DELETE),

View file

@ -368,8 +368,14 @@ const englishConstants = {
DELETE_COLLECTION_TITLE: 'Delete album?',
DELETE_COLLECTION: 'Delete album',
DELETE_COLLECTION_FAILED: 'Album deletion failed, please try again',
DELETE_COLLECTION_MESSAGE:
'Files that are unique to this album will be moved to trash, and this album would be deleted.',
DELETE_COLLECTION_MESSAGE: () => (
<p>
Also delete the photos (and videos) present in this album from
<strong> all </strong> other albums they are part of?
</p>
),
DELETE_PHOTOS: 'Delete photos',
KEEP_PHOTOS: 'Keep photos',
SHARE: 'Share',
SHARE_COLLECTION: 'Share album',
SHARE_WITH_PEOPLE: 'Share with your loved ones',