From 876eb6b9043babf8c8ec787aef9126834ef33b67 Mon Sep 17 00:00:00 2001 From: gallaghersara Date: Mon, 11 Mar 2024 00:54:26 +0200 Subject: [PATCH] Add modal to confirm tile deletion #1625 --- .../EditToolbar/EditToolbar.component.js | 45 +++++++++++++++++-- .../Board/EditToolbar/EditToolbar.messages.js | 16 +++++++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/components/Board/EditToolbar/EditToolbar.component.js b/src/components/Board/EditToolbar/EditToolbar.component.js index 907462945..26aa85898 100644 --- a/src/components/Board/EditToolbar/EditToolbar.component.js +++ b/src/components/Board/EditToolbar/EditToolbar.component.js @@ -1,4 +1,4 @@ -import React, { Fragment } from 'react'; +import React, { Fragment, useState } from 'react'; import PropTypes from 'prop-types'; import { injectIntl, intlShape } from 'react-intl'; import classNames from 'classnames'; @@ -14,6 +14,10 @@ import AddBoxIcon from '@material-ui/icons/AddBox'; import { MdContentCopy } from 'react-icons/md'; import { MdContentPaste } from 'react-icons/md'; +import Dialog from '@material-ui/core/Dialog'; +import DialogActions from '@material-ui/core/DialogActions'; +import DialogContent from '@material-ui/core/DialogContent'; +import DialogTitle from '@material-ui/core/DialogTitle'; import SelectedCounter from '../../UI/SelectedCounter'; import IconButton from '../../UI/IconButton'; import messages from './EditToolbar.messages'; @@ -71,7 +75,10 @@ EditToolbar.propTypes = { */ onAddClick: PropTypes.func, onBoardTypeChange: PropTypes.func, - copiedTiles: PropTypes.arrayOf(PropTypes.object) + copiedTiles: PropTypes.arrayOf(PropTypes.object), + open: PropTypes.bool.isRequired, + onClose: PropTypes.func.isRequired, + onDialogAccecpted: PropTypes.func.isRequired }; function EditToolbar({ @@ -98,6 +105,13 @@ function EditToolbar({ }) { const isItemsSelected = !!selectedItemsCount; const isFixed = !!isFixedBoard; + const [openDeleteTiles, setOpenDeleteTiles] = useState(false); + const handleClickOpen = () => { + setOpenDeleteTiles(true); + }; + const handleClose = () => { + setOpenDeleteTiles(false); + }; return (
- { + handleClickOpen(); + }} > + + + {intl.formatMessage(messages.deleteTileTitle)} + + + {intl.formatMessage(messages.deleteTileDescription)} + + + + + + +