Improvement in Subs and FireMap Union

This commit is contained in:
vjrj 2017-12-19 20:02:14 +01:00
parent 497724443f
commit 1742cd4913
19 changed files with 390 additions and 299 deletions

View file

@ -28,6 +28,16 @@ class FireSubscription extends React.Component {
});
}
shouldComponentUpdate(nextProps, nextState) {
if (this.state.init &&
nextState.center === this.state.center &&
nextState.distance === this.state.distance) {
return false;
}
return true;
}
onAutocompleteChange(value) {
this.setState({ center: [value.lat, value.lng] });
}
@ -51,7 +61,7 @@ class FireSubscription extends React.Component {
render() {
// https://developers.google.com/places/web-service/search
// https://github.com/kenny-hibino/react-places-autocomplete/blob/master/demo/Demo.js
console.log(`Focus autocomplete input: ${this.props.focusInput}`);
if (!this.state.init) {
return <div />;
}
@ -77,9 +87,11 @@ class FireSubscription extends React.Component {
<SelectionMap
center={this.state.center}
distance={this.state.distance}
subsBtn={this.props.subsBtn}
fstBtn={this.props.subsBtn}
onFstBtn={state => this.onSubs(state)}
onSelection={state => this.onSelection(state)}
onSubs={state => this.onSubs(state)}
readOnly={false}
edit={false}
/>
</Row>
</div>

View file

@ -60,7 +60,7 @@ class SubsAutocomplete extends React.Component {
<form>
<FormGroup>
<ControlLabel>
<Trans parent="span">Indícanos la posición a vigilar (por ej. tu pueblo, una calle, etc):</Trans>
<Trans parent="span">Indícanos la posición de la zona a vigilar (por ej. tu pueblo, una calle, etc):</Trans>
</ControlLabel>
<PlacesAutocomplete
styles={myStyles}
@ -90,7 +90,7 @@ class SubsAutocomplete extends React.Component {
autoFocus: this.props.focusInput
}}
/>
<HelpBlock><Trans parent="span">También puedes seleccionar el lugar en el mapa arrastrando el puntero naranja.</Trans></HelpBlock>
<HelpBlock><Trans parent="span">También puedes seleccionar la zona en el mapa arrastrando el puntero naranja.</Trans></HelpBlock>
</FormGroup>
</form>
);