dont close map list on click

This commit is contained in:
muerwre 2019-02-06 16:50:30 +07:00
parent 46a7d30f8a
commit 25630a30b8
5 changed files with 15 additions and 68 deletions

View file

@ -1,53 +0,0 @@
// @flow
import React from 'react';
// import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { RouteRow } from '$components/maps/RouteRow';
import type { Route } from '$constants/types';
import { Scroll } from '$components/Scroll';
type Props = {
routes: { [id: String]: Route },
editing: Boolean,
routes_sorted: Array<string>,
};
const Component = ({ routes, editing, routes_sorted }: Props) => (
<div className="dialog-content">
<div className="dialog-head">
<div className="dialog-head-title">
Ваши маршруты
</div>
<div className="small gray">
{
routes_sorted.length > 0
? `${routes_sorted.length} шт.`
: '(здесь пока ничего нет)'
}
</div>
</div>
<Scroll className="dialog-shader">
<div className="dialog-maplist">
{
routes_sorted.map(id => (
<RouteRow
editing={editing}
{...routes[id]}
key={id}
/>
))
}
</div>
</Scroll>
</div>
);
const mapStateToProps = ({ user: { editing, user: { routes } } }) => ({
routes,
editing,
routes_sorted: Object.keys(routes).sort((a, b) => (Date.parse(routes[b].updated_at) - Date.parse(routes[a].updated_at))),
});
// const mapDispatchToProps = dispatch => bindActionCreators({}, dispatch);
export const MapListDialog = connect(mapStateToProps)(Component);

View file

@ -46,7 +46,7 @@ class Component extends React.Component<Props> {
openRoute = _id => { openRoute = _id => {
pushPath(`/${_id}/${this.props.editing ? 'edit' : ''}`); pushPath(`/${_id}/${this.props.editing ? 'edit' : ''}`);
this.props.setDialogActive(false); // this.props.setDialogActive(false);
}; };
render() { render() {
@ -89,7 +89,7 @@ class Component extends React.Component<Props> {
{ {
Object.keys(TABS).map(item => ( Object.keys(TABS).map(item => (
<div <div
className={classnames('dialog-tab', { active: tab === item})} className={classnames('dialog-tab', { active: tab === item })}
onClick={() => this.props.searchSetTab(item)} onClick={() => this.props.searchSetTab(item)}
key={item} key={item}
> >
@ -150,7 +150,7 @@ class Component extends React.Component<Props> {
} }
const mapStateToProps = ({ user: { editing, routes } }) => { const mapStateToProps = ({ user: { editing, routes } }) => {
if (routes.filter.max >= 9999){ if (routes.filter.max >= 9999) {
return { return {
routes, editing, marks: {}, ready: false, routes, editing, marks: {}, ready: false,
}; };

View file

@ -1,7 +1,6 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import { Icon } from '$components/panels/Icon'; import { Icon } from '$components/panels/Icon';
import { pushPath } from '$utils/history';
type Props = { type Props = {
title: String, title: String,

View file

@ -1,7 +1,6 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import { DIALOGS } from '$constants/dialogs'; import { DIALOGS } from '$constants/dialogs';
import { MapListDialog } from '$components/dialogs/MapListDialog';
import classnames from 'classnames'; import classnames from 'classnames';
import { AppInfoDialog } from '$components/dialogs/AppInfoDialog'; import { AppInfoDialog } from '$components/dialogs/AppInfoDialog';
import { Icon } from '$components/panels/Icon'; import { Icon } from '$components/panels/Icon';

View file

@ -1,5 +1,6 @@
/* /*
todo save spinner todo save spinner
todo cancelling editing someone's else map return back to it's original address /razminochnyj/ todo cancelling editing someone's else map return back to it's original address /razminochnyj/
@ -29,6 +30,7 @@
OBLIVION STARTS HERE: OBLIVION STARTS HERE:
done dont close map list on click
done fix loaded stickers has wrong text placement for right-sided captions done fix loaded stickers has wrong text placement for right-sided captions
done fix save button should not react to clicks done fix save button should not react to clicks
done stickers with empty text should not have blackbox at view mode done stickers with empty text should not have blackbox at view mode