diff --git a/imports/ui/pages/FireSubscription/FireSubscription.js b/imports/ui/pages/FireSubscription/FireSubscription.js
index a1f18be..1ce057d 100644
--- a/imports/ui/pages/FireSubscription/FireSubscription.js
+++ b/imports/ui/pages/FireSubscription/FireSubscription.js
@@ -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
- } else {
- return (
-
-
-
-
-
Suscríbete a alertas de fuegos
- this.onAutocompleteChange(value) }/>
-
-
-
- this.onSliderChange(value)} />
-
- this.centerOnUserLocation(viewport)} />
-
-
-
-
- this.onSelection(state)}
- />
-
-
- );
+ return ;
}
+ return (
+
+
+
+
+
Suscríbete a alertas de fuegos
+ this.onAutocompleteChange(value)}
+ />
+
+
+
+ this.onSliderChange(value)} />
+
+ this.centerOnUserLocation(viewport)} />
+
+
+
+
+ this.onSelection(state)}
+ />
+
+
+ );
}
}
diff --git a/imports/ui/pages/FireSubscription/SubsAutocomplete.js b/imports/ui/pages/FireSubscription/SubsAutocomplete.js
index 1e38223..a6e9426 100644
--- a/imports/ui/pages/FireSubscription/SubsAutocomplete.js
+++ b/imports/ui/pages/FireSubscription/SubsAutocomplete.js
@@ -1,35 +1,36 @@
+/* eslint-disable react/jsx-indent-props */
import React from 'react';
import PropTypes from 'prop-types';
import { Trans, translate } from 'react-i18next';
-import PlacesAutocomplete, { geocodeByAddress, geocodeByPlaceId, getLatLng } from 'react-places-autocomplete';
+import PlacesAutocomplete, { geocodeByAddress, getLatLng } from 'react-places-autocomplete';
import { FormGroup, ControlLabel, HelpBlock } from 'react-bootstrap';
class SubsAutocomplete extends React.Component {
constructor(props) {
super(props);
this.state = {
- address: '',
+ address: ''
};
}
- onChange = (address) => { this.setState({ address }); }
+ onChange(address) { this.setState({ address }); }
- handleSelect = (address) => {
+ handleSelect(address) {
const self = this;
geocodeByAddress(address)
- .then((results) => getLatLng(results[0]))
+ .then(results => getLatLng(results[0]))
.then(({ lat, lng }) => {
// console.log('Success Yay', { lat, lng })
// const newState = update(this.state, {$merge: {lat: lat, lng: lng}});
// console.log(newState);
// this.setState(newState);
- self.props.onChange({lat: lat, lng: lng});
+ self.props.onChange({ lat, lng });
// console.log(this.state);
})
- .catch(error => {
+ .catch((error) => {
console.log(error);
if (error === 'ZERO_RESULTS') {
- console.log("No results");
+ console.log('No results');
}
});
}
@@ -43,17 +44,17 @@ class SubsAutocomplete extends React.Component {
backgroundSize: 'auto 12px',
backgroundPosition: 'bottom left 10px',
backgroundRepeat: 'no-repeat',
- backgroundImage: "url('https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3_hdpi.png')",
- },
- }
+ backgroundImage: "url('https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3_hdpi.png')"
+ }
+ };
// http://simplelineicons.com/
const AutocompleteItem = ({ formattedSuggestion }) => (
- {' '}
+ {' '}
{formattedSuggestion.mainText}{' '}
{formattedSuggestion.secondaryText}
-
)
+ );
return (
- )
+ );
}
}
SubsAutocomplete.propTypes = {
- focusInput: PropTypes.bool.isRequired
+ focusInput: PropTypes.bool.isRequired,
+ t: PropTypes.func.isRequired,
+ i18n: PropTypes.object.isRequired
};
-export default translate([], { wait: true }) (SubsAutocomplete);
+export default translate([], { wait: true })(SubsAutocomplete);
diff --git a/imports/ui/pages/Index/Index.js b/imports/ui/pages/Index/Index.js
index 56a00a6..9e1598f 100644
--- a/imports/ui/pages/Index/Index.js
+++ b/imports/ui/pages/Index/Index.js
@@ -1,15 +1,19 @@
-import React, {Component} from 'react';
-import { Button } from 'react-bootstrap';
+/* eslint-disable import/no-absolute-path */
+/* eslint-disable react/jsx-indent-props */
+/* eslint-disable key-spacing */
+/* eslint-env jquery */
+import React, { Component } from 'react';
import { translate, Trans } from 'react-i18next';
-import {render} from 'react-dom';
+import PropTypes from 'prop-types';
// import { HashLink as Link } from 'react-router-hash-link';
// import { Link } from 'react-router-dom';
// https://www.npmjs.com/package/react-resize-detector
import ReactResizeDetector from 'react-resize-detector';
-import {ScrollToTopOnMount, SectionsContainer, Section} from 'react-fullpage';
-import FiresMap from '../FiresMap/FiresMap';
-import FireSubscription from '/imports/ui/pages/FireSubscription/FireSubscription';
+import _ from 'lodash';
+import { ScrollToTopOnMount, SectionsContainer, Section } from 'react-fullpage';
import 'html5-device-mockups/dist/device-mockups.min.css';
+import FireSubscription from '/imports/ui/pages/FireSubscription/FireSubscription';
+import FiresMap from '../FiresMap/FiresMap';
import './Index.scss';
import './Index-custom.scss';
@@ -20,53 +24,39 @@ class Index extends Component {
constructor(props) {
super(props);
+ const self = this;
+ this.myScaleFunction = _.debounce(() => {
+ self.scaleHeader();
+ }, 250);
+ this.onResize = this.onResize.bind(this);
}
- debounce = (func, wait, immediate) => {
- var timeout;
- return function() {
- var context = this, args = arguments;
- var later = function() {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- var callNow = immediate && !timeout;
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- if (callNow) func.apply(context, args);
- };
- };
-
- scaleHeader = () => {
- var scalable = document.getElementById('tcefh1');
- var margin = 10;
- var scalableContainer = scalable.parentNode;
- scalable.style.transform = 'scale(1)';
- var scalableContainerWidth = scalableContainer.offsetWidth - margin;
- var scalableWidth = scalable.offsetWidth;
- scalable.style.transform = 'scale(' + scalableContainerWidth / scalableWidth + ')';
- scalableContainer.style.height = scalable.getBoundingClientRect().height + 'px';
- };
-
- myScaleFunction = this.debounce(() => {
- this.scaleHeader();
- }, 250);
-
- _onResize = () => {
- this.myScaleFunction();
- };
-
- componentDidMount = () => {
+ componentDidMount() {
$('.carousel').carousel();
}
- handleBtnClick = (event) => {
+ onResize() {
+ this.myScaleFunction();
+ }
+
+ scaleHeader() {
+ const scalable = document.getElementById('tcefh1');
+ const margin = 10;
+ const scalableContainer = scalable.parentNode;
+ scalable.style.transform = 'scale(1)';
+ const scalableContainerWidth = scalableContainer.offsetWidth - margin;
+ const scalableWidth = scalable.offsetWidth;
+ scalable.style.transform = `scale(${scalableContainerWidth / scalableWidth})`;
+ scalableContainer.style.height = `${scalable.getBoundingClientRect().height}px`;
+ }
+
+ handleBtnClick() {
window.open('https://t.me/TodosContraElFuego_bot', '_blank');
}
render() {
// https://github.com/subtirelumihail/react-fullpage
- let fullPageOptions = {
+ const fullPageOptions = {
activeClass: 'active', // the class that is appended to the sections links
anchors: ['home', 'crowdsourcing', 'platforms', 'participe', 'fires'], // the anchors for each sections
arrowNavigation: false, // use arrow keys (true after development)
@@ -88,67 +78,70 @@ class Index extends Component {
-
-
+
+
{ this.slides = ref; }}
+ >
-
-
-
-
+
+
+
+
-
+
-
Elige un lugar
-
+
Elige un lugar
+
-
+
-
Elige un radio de vigilancia
-
+
Elige un radio de vigilancia
+
-
+
-
Recibe alertas de fuegos en esa zona
-
+
Recibe alertas de fuegos en esa zona
+
-
+
-
Alerta cuando hay un fuego
-
+
Alerta cuando hay un fuego
+
-
+
Previous
-
+
Next
-
-
-
{this.props.t('AppName')}
+
+
+
{this.props.t('AppName')}
+
+
Siempre alerta a los fuegos en nuestro vecindario
+ {/*
{this.props.t('Participa')} */}
-
Siempre alerta a los fuegos en nuestro vecindario
- {/*
{this.props.t('Participa')} */}
-
@@ -162,40 +155,40 @@ class Index extends Component {
-
-
Somos muchos ojos
Usamos diferentes fuentes de datos para notificarte de fuegos activos en tus zonas de interés
-
+
-
-
-
- {/* Demo image for screen mockup, you can put an image here, some HTML, an animation, video, or anything else! */}
-

-
-
this.handleBtnClick(event)}>
+
+
+
+ {/* Demo image for screen mockup, you can put an image here, some HTML, an animation, video, or anything else! */}
+
+
{}} role="button" onClick={() => this.handleBtnClick()} />
+
-
+
Correo electronico
Recibe nuestras notificaciones de fuegos por correo
@@ -204,16 +197,16 @@ class Index extends Component {
@@ -227,7 +220,7 @@ class Index extends Component {
-
+
@@ -238,7 +231,12 @@ class Index extends Component {
);
- };
+ }
}
+Index.propTypes = {
+ history: PropTypes.object.isRequired,
+ t: PropTypes.func.isRequired
+};
+
export default translate([], { wait: true })(Index);