refactor trash files message
This commit is contained in:
parent
9a3f8f939c
commit
e77f3b3775
|
@ -9,6 +9,7 @@ import { AppContext } from 'pages/_app';
|
||||||
import CloseIcon from '@mui/icons-material/Close';
|
import CloseIcon from '@mui/icons-material/Close';
|
||||||
import BackButton from '@mui/icons-material/ArrowBackOutlined';
|
import BackButton from '@mui/icons-material/ArrowBackOutlined';
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
|
import { getTrashFilesMessage } from 'utils/ui';
|
||||||
|
|
||||||
const VerticalLine = styled('div')`
|
const VerticalLine = styled('div')`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -41,16 +42,7 @@ export default function DeduplicateOptions({
|
||||||
const { setDialogMessage } = useContext(AppContext);
|
const { setDialogMessage } = useContext(AppContext);
|
||||||
|
|
||||||
const trashHandler = () =>
|
const trashHandler = () =>
|
||||||
setDialogMessage({
|
setDialogMessage(getTrashFilesMessage(deleteFileHelper));
|
||||||
title: constants.CONFIRM_DELETE,
|
|
||||||
content: constants.TRASH_MESSAGE,
|
|
||||||
proceed: {
|
|
||||||
action: deleteFileHelper,
|
|
||||||
text: constants.MOVE_TO_TRASH,
|
|
||||||
variant: 'danger',
|
|
||||||
},
|
|
||||||
close: { text: constants.CANCEL },
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SelectionBar>
|
<SelectionBar>
|
||||||
|
|
|
@ -25,6 +25,7 @@ import UnArchiveIcon from '@mui/icons-material/Visibility';
|
||||||
import ArchiveIcon from '@mui/icons-material/VisibilityOff';
|
import ArchiveIcon from '@mui/icons-material/VisibilityOff';
|
||||||
import MoveIcon from '@mui/icons-material/ArrowForward';
|
import MoveIcon from '@mui/icons-material/ArrowForward';
|
||||||
import RemoveIcon from '@mui/icons-material/RemoveCircleOutline';
|
import RemoveIcon from '@mui/icons-material/RemoveCircleOutline';
|
||||||
|
import { getTrashFilesMessage } from 'utils/ui';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
addToCollectionHelper: (collection: Collection) => void;
|
addToCollectionHelper: (collection: Collection) => void;
|
||||||
|
@ -78,16 +79,7 @@ const SelectedFileOptions = ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const trashHandler = () =>
|
const trashHandler = () =>
|
||||||
setDialogMessage({
|
setDialogMessage(getTrashFilesMessage(deleteFileHelper));
|
||||||
title: constants.TRASH_FILES_TITLE,
|
|
||||||
content: constants.TRASH_FILES_MESSAGE,
|
|
||||||
proceed: {
|
|
||||||
action: deleteFileHelper,
|
|
||||||
text: constants.MOVE_TO_TRASH,
|
|
||||||
variant: 'danger',
|
|
||||||
},
|
|
||||||
close: { text: constants.CANCEL },
|
|
||||||
});
|
|
||||||
|
|
||||||
const permanentlyDeleteHandler = () =>
|
const permanentlyDeleteHandler = () =>
|
||||||
setDialogMessage({
|
setDialogMessage({
|
||||||
|
|
|
@ -17,3 +17,16 @@ export const getDownloadAppMessage = (): DialogBoxAttributes => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getTrashFilesMessage = (
|
||||||
|
deleteFileHelper
|
||||||
|
): DialogBoxAttributes => ({
|
||||||
|
title: constants.TRASH_FILES_TITLE,
|
||||||
|
content: constants.TRASH_FILES_MESSAGE,
|
||||||
|
proceed: {
|
||||||
|
action: deleteFileHelper,
|
||||||
|
text: constants.MOVE_TO_TRASH,
|
||||||
|
variant: 'danger',
|
||||||
|
},
|
||||||
|
close: { text: constants.CANCEL },
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue