finally saving things

This commit is contained in:
muerwre 2018-08-30 17:10:33 +07:00
parent e0f5d0238a
commit 47e4f4a97d
22 changed files with 277 additions and 38 deletions

View file

@ -5,15 +5,17 @@ import { RouterDialog } from '$components/router/RouterDialog';
import { StickersDialog } from '$components/stickers/StickersDialog';
import { TrashDialog } from '$components/trash/TrashDialog';
import { LogoDialog } from '$components/logo/LogoDialog';
import { SaveDialog } from '$components/save/SaveDialog';
export const EditorDialog = ({
mode, routerPoints, editor, activeSticker, logo
mode, routerPoints, editor, activeSticker, logo, user,
}) => {
const showDialog = (
mode === MODES.ROUTER
|| (mode === MODES.STICKERS && !activeSticker)
|| mode === MODES.TRASH
|| mode === MODES.LOGO
|| mode === MODES.SAVE
);
return (
@ -23,6 +25,7 @@ export const EditorDialog = ({
{ mode === MODES.STICKERS && <StickersDialog editor={editor} /> }
{ mode === MODES.TRASH && <TrashDialog editor={editor} /> }
{ mode === MODES.LOGO && <LogoDialog editor={editor} logo={logo} /> }
{ mode === MODES.SAVE && <SaveDialog editor={editor} user={user} /> }
</div>
);
};

View file

@ -2,7 +2,7 @@ import React from 'react';
import { MODES } from '$constants/modes';
import classnames from 'classnames';
import { toHours } from '$utils/time';
import { toHours } from '$utils/format';
import { Icon } from '$components/panels/Icon';
import { EditorDialog } from '$components/panels/EditorDialog';
@ -21,9 +21,11 @@ export class EditorPanel extends React.PureComponent {
startLogoMode = () => this.props.editor.changeMode(MODES.LOGO);
startSaveMode = () => this.props.editor.changeMode(MODES.SAVE);
render() {
const {
mode, routerPoints, editor, totalDistance, estimateTime, activeSticker, logo,
mode, routerPoints, editor, totalDistance, estimateTime, activeSticker, logo, user
} = this.props;
return (
@ -35,6 +37,7 @@ export class EditorPanel extends React.PureComponent {
activeSticker={activeSticker}
editor={editor}
logo={logo}
user={user}
/>
<LogoPreview logo={logo} />
@ -96,6 +99,7 @@ export class EditorPanel extends React.PureComponent {
<button
className="highlighted"
onClick={this.startSaveMode}
>
<span>СХОРОНИТЬ</span>
<Icon icon="icon-save" />