diff --git a/config/frontend.example.js b/config/frontend.example.js index 4b3c3e3..ca59f89 100644 --- a/config/frontend.example.js +++ b/config/frontend.example.js @@ -1,11 +1,18 @@ import { DEFAULT_PROVIDER, PROVIDERS } from '$constants/providers'; +import { LatLngLiteral } from 'leaflet'; const API_ADDR = 'https://HOSTNAME.org:3000'; const OSRM_URL = 'https://HOSTNAME.org:5001/route/v1'; +const OSRM_PROFILE = 'bike'; +const OSRM_TEST_URL = ([south_west, north_east]: [LatLngLiteral, LatLngLiteral]) => ( + `${OSRM_URL}/${OSRM_PROFILE}/${Object.values(south_west).join(',')};${Object.values(north_east).join(',')}` +); export const CLIENT = { OSRM_URL, API_ADDR, + OSRM_TEST_URL, + OSRM_PROFILE, STROKE_WIDTH: 5, }; diff --git a/src/components/dialogs/MapListDialog.tsx b/src/components/dialogs/MapListDialog.tsx index 13795cd..e6ae4a4 100644 --- a/src/components/dialogs/MapListDialog.tsx +++ b/src/components/dialogs/MapListDialog.tsx @@ -78,6 +78,8 @@ class Component extends React.Component { if (isMobile()) this.props.setDialogActive(false); + // pushPath(`/${_id}/${this.props.editing ? 'edit' : ''}`); + pushPath(`/${_id}`); this.stopEditing(); pushPath(`/${_id}/${this.props.editing ? 'edit' : ''}`); diff --git a/src/components/dialogs/RouterDialog.tsx b/src/components/dialogs/RouterDialog.tsx index 731cd8e..b24b695 100644 --- a/src/components/dialogs/RouterDialog.tsx +++ b/src/components/dialogs/RouterDialog.tsx @@ -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) => (
+
+ {!routerPoints && noPoints({ routerCancel })} {routerPoints === 1 && firstPoint({ routerCancel })} {routerPoints >= 2 && draggablePoints({ routerCancel, routerSubmit })} diff --git a/src/components/panels/DistanceBar.tsx b/src/components/panels/DistanceBar.tsx index 5ea8699..dd4df1e 100644 --- a/src/components/panels/DistanceBar.tsx +++ b/src/components/panels/DistanceBar.tsx @@ -57,7 +57,7 @@ class Component extends React.PureComponent { - {toHours(estimated)} +
{toHours(estimated)}
{ dialogOpened && diff --git a/src/components/panels/EditorPanel.tsx b/src/components/panels/EditorPanel.tsx index 49a70fd..d2babca 100644 --- a/src/components/panels/EditorPanel.tsx +++ b/src/components/panels/EditorPanel.tsx @@ -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 { render() { const { - mode, changed, editing, + mode, changed, editing, routing, } = this.props; return (
{ this.panel = el; }}>
- + { + routing && + + } + + +