/* eslint-disable import/no-absolute-path */
/* eslint-disable react/jsx-indent-props */
/* eslint-disable key-spacing */
/* eslint-env jquery */
import React, { Component, Fragment } from 'react';
import { translate, Trans } from 'react-i18next';
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 _ from 'lodash';
import { ScrollToTopOnMount, SectionsContainer, Section } from 'react-fullpage';
import 'html5-device-mockups/dist/device-mockups.min.css';
import { isAnyMobile } from '/imports/ui/components/Utils/isMobile';
import SubscriptionEditor from '/imports/ui/components/SubscriptionEditor/SubscriptionEditor';
import SubscriptionsMap from '/imports/ui/pages/Subscriptions/SubscriptionsMap';
import FiresMap from '../FiresMap/FiresMap';
import './Index.scss';
import './Index-custom.scss';
class Index extends Component {
// Debounce by David Walsch
// https://davidwalsh.name/javascript-debounce-function
constructor(props) {
super(props);
const self = this;
this.myScaleFunction = _.debounce(() => {
self.scaleHeader();
}, 250);
this.onResize = this.onResize.bind(this);
}
componentDidMount() {
$('.carousel').carousel();
}
onResize() {
this.myScaleFunction();
}
getMap(isMobile) {
if (!isMobile) {
return (
);
}
return ( );
}
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
const fullPageOptions = {
anchors: isAnyMobile ? ['home', 'crowdsourcing', 'users', 'participe', 'platforms'] : ['home', 'crowdsourcing', 'users', 'participe', 'fires', 'platforms'], // the anchors for each sections
activeClass: 'active', // the class that is appended to the sections links
arrowNavigation: true, // use arrow keys (true after development)
className: 'section-container', // the class name for the section container
delay: 1000, // the scroll animation speed
navigation: true, // !isMobile, // use dots navigation
scrollBar: isAnyMobile, // use the browser default scrollbar
sectionClassName: 'section', // the section class name
sectionPaddingTop: '0', // the section top padding
sectionPaddingBottom: '0', // the section bottom padding
verticalAlign: false // align the content of each section vertical
};
return (
{/* https://v4-alpha.getbootstrap.com/components/carousel/ */}
{this.props.t('AppName')}
Siempre alerta a los fuegos en nuestro vecindario
{/*
{this.props.t('Participa')} */}
Colaboración masiva contra los incendios
Imágenes capturadas por los satélites de la NASA muestran el humo de grandes incendios que se extienden sobre el Océano Pacífico. La actividad del fuego está delineada en rojo.
Suscríbete a alertas de fuegos
{this.getMap(isAnyMobile)}
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! */}
{}} role="button" onClick={() => this.handleBtnClick()} />
Notificaciones
Recibe nuestras notificaciones de fuegos por correo o en tu navegador
);
}
}
Index.propTypes = {
history: PropTypes.object.isRequired,
t: PropTypes.func.isRequired
};
export default translate([], { wait: true })(Index);