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 => {
pushPath(`/${_id}/${this.props.editing ? 'edit' : ''}`);
this.props.setDialogActive(false);
// this.props.setDialogActive(false);
};
render() {
@ -70,26 +70,26 @@ class Component extends React.Component<Props> {
return (
<div className="dialog-content">
{ list.length === 0 && loading &&
<div className="dialog-maplist-loader">
<div className="dialog-maplist-icon spin">
<Icon icon="icon-sync-1" />
</div>
<div className="dialog-maplist-loader">
<div className="dialog-maplist-icon spin">
<Icon icon="icon-sync-1" />
</div>
</div>
}
{ ready && !loading && list.length === 0 &&
<div className="dialog-maplist-loader">
<div className="dialog-maplist-icon">
<Icon icon="icon-sad-1" />
</div>
ТУТ ПУСТО <br />
И ОДИНОКО
<div className="dialog-maplist-loader">
<div className="dialog-maplist-icon">
<Icon icon="icon-sad-1" />
</div>
ТУТ ПУСТО <br />
И ОДИНОКО
</div>
}
<div className="dialog-tabs">
{
Object.keys(TABS).map(item => (
<div
className={classnames('dialog-tab', { active: tab === item})}
className={classnames('dialog-tab', { active: tab === item })}
onClick={() => this.props.searchSetTab(item)}
key={item}
>
@ -150,7 +150,7 @@ class Component extends React.Component<Props> {
}
const mapStateToProps = ({ user: { editing, routes } }) => {
if (routes.filter.max >= 9999){
if (routes.filter.max >= 9999) {
return {
routes, editing, marks: {}, ready: false,
};

View file

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

View file

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

View file

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