nominatim search (without working dialog)

This commit is contained in:
Fedor Katurov 2020-01-20 16:42:46 +07:00
parent c3e136cebb
commit b20a3445d1
27 changed files with 450 additions and 61 deletions

View file

@ -32,7 +32,7 @@ type Props = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & {}
class EditorPanelUnconnected extends PureComponent<Props, void> {
componentDidMount() {
window.addEventListener('keydown', this.props.editorKeyPressed as any);
window.addEventListener('keydown', this.onKeyPress as any);
const obj = document.getElementById('control-dialog');
const { width } = this.panel.getBoundingClientRect();
@ -45,9 +45,15 @@ class EditorPanelUnconnected extends PureComponent<Props, void> {
panel: HTMLElement = null;
componentWillUnmount() {
window.removeEventListener('keydown', this.props.editorKeyPressed as any);
window.removeEventListener('keydown', this.onKeyPress as any);
}
onKeyPress = event => {
if (event.target.tagName === 'TEXTAREA' || event.target.tagName === 'INPUT') return;
this.props.editorKeyPressed(event);
};
startPolyMode = () => this.props.editorSetMode(MODES.POLY);
startStickerMode = () => this.props.editorSetMode(MODES.STICKERS_SELECT);
startRouterMode = () => this.props.editorSetMode(MODES.ROUTER);

View file

@ -10,6 +10,7 @@ import {
editorSetDialog,
editorSetDialogActive,
editorGetGPXTrack,
editorSearchNominatim,
} from '~/redux/editor/actions';
import { connect } from 'react-redux';
import { Icon } from '~/components/panels/Icon';
@ -19,11 +20,12 @@ import { CLIENT } from '~/config/frontend';
import { DIALOGS, TABS } from '~/constants/dialogs';
import { Tooltip } from '~/components/panels/Tooltip';
import { TitleDialog } from '~/components/dialogs/TitleDialog';
import { NominatimSearchPanel } from '~/components/dialogs/NominatimSearchPanel';
import { IState } from '~/redux/store';
const mapStateToProps = ({
user: { user },
editor: { dialog, dialog_active },
editor: { dialog, dialog_active, features },
map: { route, stickers },
}: IState) => ({
dialog,
@ -31,6 +33,7 @@ const mapStateToProps = ({
user,
route,
stickers,
features,
});
const mapDispatchToProps = {
@ -42,6 +45,7 @@ const mapDispatchToProps = {
editorSetDialogActive,
openMapDialog,
editorGetGPXTrack,
editorSearchNominatim,
};
type Props = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & {};
@ -90,6 +94,7 @@ export class UserPanelUnconnected extends PureComponent<Props, State> {
}
setMenuOpened = () => this.setState({ menuOpened: !this.state.menuOpened });
openMapsDialog = () => {
this.props.openMapDialog(TABS.MY);
};
@ -115,7 +120,7 @@ export class UserPanelUnconnected extends PureComponent<Props, State> {
render() {
const {
props: { user, dialog, dialog_active, route, stickers },
props: { user, dialog, dialog_active, route, stickers, features },
state: { menuOpened },
} = this;
@ -124,6 +129,7 @@ export class UserPanelUnconnected extends PureComponent<Props, State> {
return (
<div>
<TitleDialog />
<NominatimSearchPanel active={features.nominatim} onSearch={this.props.editorSearchNominatim} />
<div className="panel active panel-user">
<div className="user-panel">