switching between modes :-)

This commit is contained in:
muerwre 2018-08-31 16:52:31 +07:00
parent 293f3cd7b9
commit f85911861a
4 changed files with 51 additions and 24 deletions

View file

@ -23,9 +23,13 @@ export class EditorPanel extends React.PureComponent {
startSaveMode = () => this.props.editor.changeMode(MODES.SAVE);
stopEditing = () => this.props.editor.stopEditing();
startEditing = () => this.props.editor.startEditing();
render() {
const {
mode, routerPoints, editor, totalDistance, estimateTime, activeSticker, logo, user
mode, routerPoints, editor, totalDistance, estimateTime, activeSticker, logo, user, editing,
} = this.props;
return (
@ -42,7 +46,7 @@ export class EditorPanel extends React.PureComponent {
<LogoPreview logo={logo} />
<div className="panel right">
<div className={classnames('panel right', { active: editing })}>
<div className="control-dist">
{totalDistance} км
<Icon icon="icon-cycle" size={32} />
@ -96,9 +100,20 @@ export class EditorPanel extends React.PureComponent {
>
<Icon icon="icon-logo" />
</button>
</div>
<div className="control-sep" />
<div className="control-bar">
<button
className="highlighted"
onClick={this.stopEditing}
>
<span>ОТМЕНА</span>
</button>
<button
className="primary"
onClick={this.startSaveMode}
>
<span>СХОРОНИТЬ</span>
@ -107,6 +122,17 @@ export class EditorPanel extends React.PureComponent {
</div>
</div>
<div className={classnames('panel right', { active: !editing })}>
<div className="control-bar">
<button className="success" onClick={this.startEditing}>
<Icon icon="icon-router" />
<span>
РЕДАКТОРОВАТЬ
</span>
</button>
</div>
</div>
</div>
);
}