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