diff --git a/src/components/dialogs/TrashDialog.tsx b/src/components/dialogs/TrashDialog.tsx index fcb19c9..e22abab 100644 --- a/src/components/dialogs/TrashDialog.tsx +++ b/src/components/dialogs/TrashDialog.tsx @@ -1,18 +1,27 @@ -import React from 'react'; -import { Icon } from '~/components/panels/Icon'; +import React, { FC } from 'react'; +import { connect } from 'react-redux'; +import * as EDITOR_ACTIONS from '~/redux/editor/actions'; -type Props = { - clearPoly: () => void, - clearStickers: () => void, - clearAll: () => void, - clearCancel: () => void, +const mapStateToProps = () => ({}); +const mapDispatchToProps = { + editorClearPoly: EDITOR_ACTIONS.editorClearPoly, + editorClearStickers: EDITOR_ACTIONS.editorClearStickers, + editorClearAll: EDITOR_ACTIONS.editorClearAll, + editorClearCancel: EDITOR_ACTIONS.editorClearCancel, +}; - width: number, -} +type Props = ReturnType<typeof mapStateToProps> & + typeof mapDispatchToProps & { + width: number; + }; -export const TrashDialog = ({ - clearPoly, clearStickers, clearAll, clearCancel, width, -}: Props) => ( +const TrashDialogUnconnected: FC<Props> = ({ + editorClearPoly, + editorClearStickers, + editorClearAll, + editorClearCancel, + width, +}) => ( <div className="control-dialog" style={{ width }}> <div className="helper trash-helper desktop-only"> <div className="helper__text danger"> @@ -22,21 +31,25 @@ export const TrashDialog = ({ <div className="helper trash-helper"> <div className="helper__buttons flex_1 trash-buttons"> <div className="button-group"> - <div className="button router-helper__button" onClick={clearPoly}> + <div className="button router-helper__button" onClick={editorClearPoly}> Маршрут </div> - <div className="button router-helper__button" onClick={clearStickers}> + <div className="button router-helper__button" onClick={editorClearStickers}> Стикеры </div> - <div className="button router-helper__button" onClick={clearAll}> + <div className="button router-helper__button" onClick={editorClearAll}> ВСЕ </div> </div> <div className="flex_1" /> - <div className="button primary router-helper__button" onClick={clearCancel}> + <div className="button primary router-helper__button" onClick={editorClearCancel}> Отмена </div> </div> </div> </div> ); + +const TrashDialog = connect(mapStateToProps, mapDispatchToProps)(TrashDialogUnconnected); + +export { TrashDialog };