add confirmation modal to clear all annotations whiteboard action

This commit is contained in:
Ramon Souza 2022-04-14 10:52:49 -03:00
parent 6d48e66048
commit 5b52665cd2
2 changed files with 19 additions and 2 deletions

View File

@ -7,6 +7,8 @@ import injectWbResizeEvent from '/imports/ui/components/presentation/resize-wrap
import Styled from './styles';
import ToolbarMenuItem from './toolbar-menu-item/component';
import ToolbarSubmenu from './toolbar-submenu/component';
import { withModalMounter } from '/imports/ui/components/common/modal/service';
import ConfirmationModal from '/imports/ui/components/common/modal/confirmation/component';
const TRANSITION_DURATION = '0.4s';
const TOOLBAR_CONFIG = Meteor.settings.public.whiteboard.toolbar;
@ -43,6 +45,10 @@ const intlMessages = defineMessages({
id: 'app.whiteboard.toolbar.clear',
description: 'Whiteboard toolbar clear menu',
},
toolbarConfirmClearAnnotations: {
id: 'app.whiteboard.toolbar.clearConfirmation',
description: 'Whiteboard toolbar clear confirmation',
},
toolbarMultiUserOn: {
id: 'app.whiteboard.toolbar.multiUserOn',
description: 'Whiteboard toolbar turn multi-user on menu',
@ -375,9 +381,19 @@ class WhiteboardToolbar extends Component {
const {
actions,
whiteboardId,
mountModal,
intl,
} = this.props;
actions.clearWhiteboard(whiteboardId);
mountModal(
<ConfirmationModal
intl={intl}
title={intl.formatMessage(intlMessages.toolbarClearAnnotations)}
description={intl.formatMessage(intlMessages.toolbarConfirmClearAnnotations)}
confirmParam={whiteboardId}
onConfirm={actions.clearWhiteboard}
/>
)
}
handleSwitchWhiteboardMode() {
@ -888,4 +904,4 @@ WhiteboardToolbar.propTypes = {
};
export default injectWbResizeEvent(injectIntl(WhiteboardToolbar));
export default injectWbResizeEvent(injectIntl(withModalMounter(WhiteboardToolbar)));

View File

@ -851,6 +851,7 @@
"app.whiteboard.toolbar.color.silver": "Silver",
"app.whiteboard.toolbar.undo": "Undo annotation",
"app.whiteboard.toolbar.clear": "Clear all annotations",
"app.whiteboard.toolbar.clearConfirmation": "Are you sure you want to clear all annotations?",
"app.whiteboard.toolbar.multiUserOn": "Turn multi-user whiteboard on",
"app.whiteboard.toolbar.multiUserOff": "Turn multi-user whiteboard off",
"app.whiteboard.toolbar.palmRejectionOn": "Turn palm rejection on",