mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
routes: hiding map dialog on map select
This commit is contained in:
parent
c5b6fcf011
commit
f325824da3
3 changed files with 17 additions and 6 deletions
|
@ -8,12 +8,14 @@ import {
|
||||||
searchSetDistance,
|
searchSetDistance,
|
||||||
searchSetTitle,
|
searchSetTitle,
|
||||||
searchSetTab,
|
searchSetTab,
|
||||||
|
setDialogActive,
|
||||||
} from '$redux/user/actions';
|
} from '$redux/user/actions';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
import { Range } from 'rc-slider';
|
import { Range } from 'rc-slider';
|
||||||
import { TABS } from '$constants/dialogs';
|
import { TABS } from '$constants/dialogs';
|
||||||
import { Icon } from '$components/panels/Icon';
|
import { Icon } from '$components/panels/Icon';
|
||||||
|
import { pushPath } from '$utils/history';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
ready: Boolean,
|
ready: Boolean,
|
||||||
|
@ -31,10 +33,10 @@ type Props = {
|
||||||
editing: Boolean,
|
editing: Boolean,
|
||||||
routes_sorted: Array<string>,
|
routes_sorted: Array<string>,
|
||||||
|
|
||||||
searchSetAuthor: Function,
|
|
||||||
searchSetDistance: Function,
|
searchSetDistance: Function,
|
||||||
searchSetTitle: Function,
|
searchSetTitle: Function,
|
||||||
searchSetTab: Function,
|
searchSetTab: Function,
|
||||||
|
setDialogActive: Function,
|
||||||
};
|
};
|
||||||
|
|
||||||
class Component extends React.Component<Props> {
|
class Component extends React.Component<Props> {
|
||||||
|
@ -42,6 +44,11 @@ class Component extends React.Component<Props> {
|
||||||
this.props.searchSetTitle(value);
|
this.props.searchSetTitle(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
openRoute = _id => {
|
||||||
|
pushPath(`/${_id}/${this.props.editing ? 'edit' : ''}`);
|
||||||
|
this.props.setDialogActive(false);
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
ready,
|
ready,
|
||||||
|
@ -130,6 +137,7 @@ class Component extends React.Component<Props> {
|
||||||
editing={editing}
|
editing={editing}
|
||||||
{...route}
|
{...route}
|
||||||
key={route._id}
|
key={route._id}
|
||||||
|
openRoute={this.openRoute}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -164,6 +172,7 @@ const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
searchSetDistance,
|
searchSetDistance,
|
||||||
searchSetTitle,
|
searchSetTitle,
|
||||||
searchSetTab,
|
searchSetTab,
|
||||||
|
setDialogActive,
|
||||||
}, dispatch);
|
}, dispatch);
|
||||||
|
|
||||||
export const MapListMoreDialog = connect(mapStateToProps, mapDispatchToProps)(Component);
|
export const MapListMoreDialog = connect(mapStateToProps, mapDispatchToProps)(Component);
|
||||||
|
|
|
@ -9,14 +9,16 @@ type Props = {
|
||||||
created_at: String,
|
created_at: String,
|
||||||
_id: String,
|
_id: String,
|
||||||
editing: Boolean,
|
editing: Boolean,
|
||||||
|
|
||||||
|
openRoute: Function,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RouteRow = ({
|
export const RouteRow = ({
|
||||||
title, distance, created_at, _id, editing
|
title, distance, created_at, _id, editing, openRoute,
|
||||||
}: Props) => (
|
}: Props) => (
|
||||||
<div
|
<div
|
||||||
className="route-row"
|
className="route-row"
|
||||||
onClick={() => pushPath(`/${_id}/${editing ? 'edit' : ''}`)}
|
onClick={() => openRoute(_id)}
|
||||||
>
|
>
|
||||||
<div className="route-title">
|
<div className="route-title">
|
||||||
{title || _id}
|
{title || _id}
|
||||||
|
|
|
@ -461,9 +461,9 @@ function* openMapDialogSaga({ tab }) {
|
||||||
return yield put(setDialogActive(false));
|
return yield put(setDialogActive(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (tab !== current) { // if tab wasnt changed just update data
|
if (tab !== current) { // if tab wasnt changed just update data
|
||||||
yield put(searchSetTab(tab));
|
yield put(searchSetTab(tab));
|
||||||
// }
|
}
|
||||||
|
|
||||||
yield put(setDialog(DIALOGS.MAP_LIST));
|
yield put(setDialog(DIALOGS.MAP_LIST));
|
||||||
yield put(setDialogActive(true));
|
yield put(setDialogActive(true));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue