routes: backend endpoint

This commit is contained in:
muerwre 2018-12-12 17:32:08 +07:00
parent d11dd9043c
commit c69da00b2a
10 changed files with 106 additions and 15 deletions

View file

@ -5,7 +5,6 @@ import { connect } from 'react-redux';
import { RouteRow } from '$components/maps/RouteRow';
import { Scroll } from '$components/Scroll';
import {
searchSetAuthor,
searchSetDistance,
searchSetTitle,
} from '$redux/user/actions';
@ -98,11 +97,11 @@ class Component extends React.Component<Props> {
<Scroll className="dialog-shader">
<div className="dialog-maplist">
{
list.map((route, index) => (
list.map(route => (
<RouteRow
editing={editing}
{...route}
key={index}
key={route._id}
/>
))
}
@ -120,7 +119,6 @@ const mapStateToProps = ({ user: { editing, routes } }) => ({
});
const mapDispatchToProps = dispatch => bindActionCreators({
searchSetAuthor,
searchSetDistance,
searchSetTitle,
}, dispatch);

View file

@ -33,7 +33,7 @@ type Props = {
class Component extends React.PureComponent<Props, void> {
componentDidMount() {
window.addEventListener('keydown', this.props.keyPressed);
window.addEventListener('keydown', this.keyPressed);
const obj = document.getElementById('control-dialog');
const { width } = this.panel.getBoundingClientRect();
@ -44,9 +44,21 @@ class Component extends React.PureComponent<Props, void> {
}
componentWillUnmount() {
window.removeEventListener('keydown', this.props.keyPressed);
window.removeEventListener('keydown', this.keyPressed);
}
keyPressed = e => {
// if (
// e.target.tagName === 'INPUT' ||
// e.target.tagName === 'TEXTAREA'
// ) {
// if (e.key === 'Escape') e.target.blur();
// return;
// }
this.props.keyPressed(e);
};
startPolyMode = () => this.props.setMode(MODES.POLY);
startStickerMode = () => this.props.setMode(MODES.STICKERS_SELECT);
startRouterMode = () => this.props.setMode(MODES.ROUTER);