Merge branch 'master' into feature/dialog-editor

# Conflicts:
#	src/components/dialogs/MapListDialog.tsx
#	src/modules/Poly.ts
#	src/styles/dialogs.less
This commit is contained in:
muerwre 2019-03-06 14:08:16 +07:00
commit d42586d9e0
25 changed files with 556 additions and 971 deletions

View file

@ -78,6 +78,8 @@ class Component extends React.Component<IMapListDialogProps, IMapListDialogState
openRoute = (_id: string): void => {
if (isMobile()) this.props.setDialogActive(false);
// pushPath(`/${_id}/${this.props.editing ? 'edit' : ''}`);
pushPath(`/${_id}`);
this.stopEditing();
pushPath(`/${_id}/${this.props.editing ? 'edit' : ''}`);

View file

@ -4,10 +4,12 @@ import {
routerCancel as routerCancelAction,
routerSubmit as routerSubmitAction,
} from "$redux/user/actions";
import classnames from "classnames";
type Props = {
routerPoints: number,
width: number,
is_routing: boolean,
routerCancel: typeof routerCancelAction,
routerSubmit: typeof routerSubmitAction,
@ -81,9 +83,11 @@ const draggablePoints = ({
);
export const RouterDialog = ({
routerPoints, routerCancel, routerSubmit, width
routerPoints, routerCancel, routerSubmit, width, is_routing,
}: Props) => (
<div className="control-dialog" style={{ width }}>
<div className={classnames('save-loader', { active: is_routing })} />
{!routerPoints && noPoints({ routerCancel })}
{routerPoints === 1 && firstPoint({ routerCancel })}
{routerPoints >= 2 && draggablePoints({ routerCancel, routerSubmit })}

View file

@ -57,7 +57,7 @@ class Component extends React.PureComponent<Props, State> {
<span className="desktop-only">
<Icon icon="icon-cycle" size={32} />
</span>
<span className="desktop-only">{toHours(estimated)}</span>
<div className="desktop-only">{toHours(estimated)}</div>
</div>
{
dialogOpened &&

View file

@ -11,6 +11,7 @@ import { IRootState } from "$redux/user/reducer";
import { Tooltip } from "$components/panels/Tooltip";
interface Props extends IRootState {
routing: IRootState['features']['routing'],
setMode: typeof setMode,
startEditing: typeof startEditing,
stopEditing: typeof stopEditing,
@ -46,20 +47,25 @@ class Component extends React.PureComponent<Props, void> {
render() {
const {
mode, changed, editing,
mode, changed, editing, routing,
} = this.props;
return (
<div>
<div className={classnames('panel right', { active: editing })} ref={el => { this.panel = el; }}>
<div className="control-bar control-bar-padded">
<button
className={classnames({ active: mode === MODES.ROUTER })}
onClick={this.startRouterMode}
>
<Tooltip>Автоматический маршрут</Tooltip>
<Icon icon="icon-route-2" />
</button>
{
routing &&
<button
className={classnames({ active: mode === MODES.ROUTER })}
onClick={this.startRouterMode}
>
<Tooltip>Автоматический маршрут</Tooltip>
<Icon icon="icon-route-2" />
</button>
}
<button
className={classnames({ active: mode === MODES.POLY })}
onClick={this.startPolyMode}
@ -67,6 +73,7 @@ class Component extends React.PureComponent<Props, void> {
<Tooltip>Редактирование маршрута</Tooltip>
<Icon icon="icon-poly-3" />
</button>
<button
className={classnames({ active: (mode === MODES.STICKERS || mode === MODES.STICKERS_SELECT) })}
onClick={this.startStickerMode}
@ -133,26 +140,20 @@ class Component extends React.PureComponent<Props, void> {
function mapStateToProps(state) {
const {
user: {
user,
editing,
mode,
routerPoints,
activeSticker,
title,
address,
changed,
features: {
routing,
}
},
} = state;
return {
user,
editing,
mode,
routerPoints,
activeSticker,
title,
address,
changed,
routing,
};
}