Gkey improved. New pages. Home improved based in startbootstrap

This commit is contained in:
vjrj 2017-12-10 03:32:12 +01:00
parent 6497278755
commit b6b8f893e3
19 changed files with 782 additions and 269 deletions

View file

@ -5,8 +5,7 @@ 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 { withTracker } from 'meteor/react-meteor-data';
import { Gkeys } from '/imports/startup/client/Gkeys';
import Gkeys from '/imports/startup/client/Gkeys';
import SubsAutocomplete from './SubsAutocomplete';
import CenterInMyPosition from '/imports/ui/components/CenterInMyPosition/CenterInMyPosition.js';
@ -16,23 +15,24 @@ class FireSubscription extends React.Component {
this.state = {
init: false
};
// console.log(this.props.location.state);
}
componentDidMount = () => {
Gkeys.load(function(err, key) {
this.setState({init: true});
Gkeys.load(function (err, key) {
this.setState({ init: true });
}.bind(this));
}
centerOnUserLocation = (value) => {
centerOnUserLocation(value) {
this.setState(update(this.state, {$merge: {lat: value.center[0], lng: value.center[1]}}));
}
onAutocompleteChange = (value) => {
onAutocompleteChange(value) {
this.setState(update(this.state, {$merge: {lat: value.lat, lng: value.lng}}));
}
onSliderChange = (value) => {
onSliderChange(value) {
this.setState(update(this.state, {$merge: {distance: value}}));
}
@ -42,14 +42,15 @@ class FireSubscription extends React.Component {
if (!this.state.init) {
return <div/>
} else
return (
<div>
<Row>
} 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 onChange={(value) => this.onAutocompleteChange(value)}/>
<SubsAutocomplete
onChange={ (value) => this.onAutocompleteChange(value) }/>
</div>
</Col>
<Col xs={12} sm={12} md={6} lg={6} >
@ -60,11 +61,21 @@ class FireSubscription extends React.Component {
</Col>
</Row>
<Row className="align-items-center justify-content-center">
<SelectionMap lat={this.state.lat} lng={this.state.lng} distance={this.state.distance || 10} />
<SelectionMap
lat={this.state.lat}
lng={this.state.lng}
distance={this.state.distance || 10}
history={this.props.history}
/>
</Row>
</div>
)
</div>
);
}
}
}
export default translate([], { wait: true }) (FireSubscription);
FireSubscription.propTypes = {
history: PropTypes.object.isRequired
};
export default translate([], { wait: true })(FireSubscription);