setMode --> changeMode

This commit is contained in:
Fedor Katurov 2020-01-21 15:01:17 +07:00
parent 5e55434772
commit d0f419c18b
9 changed files with 80 additions and 42 deletions

View file

@ -2,12 +2,12 @@ import React from 'react';
import { MODES } from '~/constants/modes';
import { Icon } from '~/components/panels/Icon';
import { editorSetMode, editorStopEditing } from '~/redux/editor/actions';
import { editorChangeMode, editorStopEditing } from '~/redux/editor/actions';
import { connect } from 'react-redux';
const mapStateToProps = () => ({});
const mapDispatchToProps = {
editorSetMode,
editorChangeMode,
editorStopEditing,
};
@ -19,7 +19,7 @@ class CancelDialogUnconnected extends React.Component<Props, void> {
};
proceed = () => {
this.props.editorSetMode(MODES.NONE);
this.props.editorChangeMode(MODES.NONE);
};
render() {

View file

@ -20,7 +20,7 @@ const mapStateToProps = state => ({
const mapDispatchToProps = {
editorCancelSave: EDITOR_ACTIONS.editorCancelSave,
editorSetMode: EDITOR_ACTIONS.editorSetMode,
editorChangeMode: EDITOR_ACTIONS.editorChangeMode,
editorSendSaveRequest: EDITOR_ACTIONS.editorSendSaveRequest,
};
@ -80,7 +80,7 @@ class SaveDialogUnconnected extends React.Component<Props, State> {
forceSaveRequest = e => this.editorSendSaveRequest(e, true);
cancelSaving = () => this.props.editorSetMode(MODES.NONE);
cancelSaving = () => this.props.editorChangeMode(MODES.NONE);
onCopy = e => {
e.preventDefault();

View file

@ -6,7 +6,7 @@ import { Icon } from '~/components/panels/Icon';
import { EditorDialog } from '~/components/panels/EditorDialog';
import { connect } from 'react-redux';
import {
editorSetMode,
editorChangeMode,
editorStartEditing,
editorStopEditing,
editorTakeAShot,
@ -21,7 +21,7 @@ const mapStateToProps = (state: IState) =>
pick(['mode', 'changed', 'editing', 'features'], selectEditor(state));
const mapDispatchToProps = {
editorSetMode,
editorChangeMode,
editorStartEditing,
editorStopEditing,
editorTakeAShot,
@ -54,12 +54,12 @@ class EditorPanelUnconnected extends PureComponent<Props, void> {
this.props.editorKeyPressed(event);
};
startPolyMode = () => this.props.editorSetMode(MODES.POLY);
startStickerMode = () => this.props.editorSetMode(MODES.STICKERS_SELECT);
startRouterMode = () => this.props.editorSetMode(MODES.ROUTER);
startTrashMode = () => this.props.editorSetMode(MODES.TRASH);
startPolyMode = () => this.props.editorChangeMode(MODES.POLY);
startStickerMode = () => this.props.editorChangeMode(MODES.STICKERS_SELECT);
startRouterMode = () => this.props.editorChangeMode(MODES.ROUTER);
startTrashMode = () => this.props.editorChangeMode(MODES.TRASH);
startSaveMode = () => {
this.props.editorSetMode(MODES.SAVE);
this.props.editorChangeMode(MODES.SAVE);
};
render() {

View file

@ -19,7 +19,7 @@ const mapStateToProps = (state: IState) => {
};
const mapDispatchToProps = {
editorSetMode: EDITOR_ACTIONS.editorSetMode,
editorChangeMode: EDITOR_ACTIONS.editorChangeMode,
};
type Props = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & {};
@ -29,11 +29,11 @@ const TopRightPanelUnconnected = ({
logo,
markers_shown,
editing,
editorSetMode,
editorChangeMode,
}: Props) => {
const startProviderMode = useCallback(() => editorSetMode(MODES.PROVIDER), [editorSetMode]);
const startLogoMode = useCallback(() => editorSetMode(MODES.LOGO), [editorSetMode]);
const clearMode = useCallback(() => editorSetMode(MODES.NONE), [editorSetMode]);
const startProviderMode = useCallback(() => editorChangeMode(MODES.PROVIDER), [editorChangeMode]);
const startLogoMode = useCallback(() => editorChangeMode(MODES.LOGO), [editorChangeMode]);
const clearMode = useCallback(() => editorChangeMode(MODES.NONE), [editorChangeMode]);
return (
<div className="status-panel top right">