Lint fixes
This commit is contained in:
parent
ccf0716d3e
commit
45c6727bec
3 changed files with 164 additions and 159 deletions
|
|
@ -1,13 +1,14 @@
|
|||
/* eslint-disable import/no-absolute-path */
|
||||
/* eslint-disable react/jsx-indent-props */
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Row, Col } from 'react-bootstrap';
|
||||
import { Trans, translate } from 'react-i18next';
|
||||
import DistanceSlider from '/imports/ui/components/DistanceSlider/DistanceSlider';
|
||||
import SelectionMap from '/imports/ui/components/SelectionMap/SelectionMap';
|
||||
import update from 'immutability-helper';
|
||||
import Gkeys from '/imports/startup/client/Gkeys';
|
||||
import SubsAutocomplete from './SubsAutocomplete';
|
||||
import CenterInMyPosition from '/imports/ui/components/CenterInMyPosition/CenterInMyPosition.js';
|
||||
import SubsAutocomplete from './SubsAutocomplete';
|
||||
|
||||
class FireSubscription extends React.Component {
|
||||
constructor(props) {
|
||||
|
|
@ -18,26 +19,27 @@ class FireSubscription extends React.Component {
|
|||
// console.log(this.props.location.state);
|
||||
}
|
||||
|
||||
componentDidMount = () => {
|
||||
Gkeys.load(function (err, key) {
|
||||
this.setState({ init: true });
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
centerOnUserLocation(value) {
|
||||
this.setState(update(this.state, {$merge: {lat: value.center[0], lng: value.center[1]}}));
|
||||
componentDidMount() {
|
||||
const self = this;
|
||||
Gkeys.load(() => {
|
||||
self.setState({ init: true });
|
||||
});
|
||||
}
|
||||
|
||||
onAutocompleteChange(value) {
|
||||
this.setState(update(this.state, {$merge: {lat: value.lat, lng: value.lng}}));
|
||||
this.setState({ lat: value.lat, lng: value.lng });
|
||||
}
|
||||
|
||||
onSliderChange(value) {
|
||||
this.setState(update(this.state, {$merge: {distance: value}}));
|
||||
this.setState({ distance: value });
|
||||
}
|
||||
|
||||
onSelection(value) {
|
||||
this.setState(update(this.state, {$merge: {lat: value.lat, lng: value.lng, distance: value.distance}}));
|
||||
this.setState({ lat: value.lat, lng: value.lng, distance: value.distance });
|
||||
}
|
||||
|
||||
centerOnUserLocation(value) {
|
||||
this.setState({ lat: value.center[0], lng: value.center[1] });
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
@ -45,37 +47,37 @@ class FireSubscription extends React.Component {
|
|||
// https://github.com/kenny-hibino/react-places-autocomplete/blob/master/demo/Demo.js
|
||||
|
||||
if (!this.state.init) {
|
||||
return <div/>
|
||||
} else {
|
||||
return (
|
||||
<div>
|
||||
<Row>
|
||||
<Col xs={12} sm={12} md={6} lg={6} >
|
||||
<div>
|
||||
<h4 className="page-header"><Trans parent="span">Suscríbete a alertas de fuegos</Trans></h4>
|
||||
<SubsAutocomplete
|
||||
focusInput={this.props.focusInput}
|
||||
onChange={ (value) => this.onAutocompleteChange(value) }/>
|
||||
</div>
|
||||
</Col>
|
||||
<Col xs={12} sm={12} md={6} lg={6} >
|
||||
<DistanceSlider onChange={(value) => this.onSliderChange(value)} />
|
||||
<Row className="align-items-center justify-content-center">
|
||||
<CenterInMyPosition onClick={(viewport) => this.centerOnUserLocation(viewport)} />
|
||||
</Row>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="align-items-center justify-content-center">
|
||||
<SelectionMap
|
||||
center={[this.state.lat, this.state.lng]}
|
||||
distance={this.state.distance}
|
||||
history={this.props.history}
|
||||
onSelection={(state) => this.onSelection(state)}
|
||||
/>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
return <div />;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<Row>
|
||||
<Col xs={12} sm={12} md={6} lg={6} >
|
||||
<div>
|
||||
<h4 className="page-header"><Trans parent="span">Suscríbete a alertas de fuegos</Trans></h4>
|
||||
<SubsAutocomplete
|
||||
focusInput={this.props.focusInput}
|
||||
onChange={value => this.onAutocompleteChange(value)}
|
||||
/>
|
||||
</div>
|
||||
</Col>
|
||||
<Col xs={12} sm={12} md={6} lg={6} >
|
||||
<DistanceSlider onChange={value => this.onSliderChange(value)} />
|
||||
<Row className="align-items-center justify-content-center">
|
||||
<CenterInMyPosition onClick={viewport => this.centerOnUserLocation(viewport)} />
|
||||
</Row>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="align-items-center justify-content-center">
|
||||
<SelectionMap
|
||||
center={[this.state.lat, this.state.lng]}
|
||||
distance={this.state.distance}
|
||||
history={this.props.history}
|
||||
onSelection={state => this.onSelection(state)}
|
||||
/>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue