/* eslint-disable import/no-absolute-path */ /* eslint-disable react/jsx-indent-props */ /* eslint-disable key-spacing */ import 'simple-line-icons/css/simple-line-icons.css'; import React, { Component } from 'react'; import { withTranslation, Trans } from 'react-i18next'; import { Helmet } from 'react-helmet-async'; import { Carousel } from 'react-bootstrap'; import PropTypes from 'prop-types'; // import { Link } from 'react-router-dom'; // https://www.npmjs.com/package/react-resize-detector import ReactResizeDetector from 'react-resize-detector'; import MobileStoreButton from 'react-mobile-store-button'; import _ from 'lodash'; 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 ShareIt from '/imports/ui/components/ShareIt/ShareIt'; import getFallbackLang from '/imports/modules/lang-fallback'; 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; // Progressive slide backgrounds: each carousel-item shows a blurred/low-res // bg until it becomes active, when the `.lazy` class swaps in the full image // (see Index-custom.scss). Was the jQuery `slide.bs.carousel` handler; now the // react-bootstrap marks the incoming index here. this.state = { mainLazy: {}, sndLazy: {} }; this.myScaleFunction = _.debounce(() => { self.scaleHeader(); }, 250); this.onResize = this.onResize.bind(this); this.getBotUrl = this.getBotUrl.bind(this); this.markLazy = this.markLazy.bind(this); } onResize() { this.myScaleFunction(); } markLazy(which, index) { this.setState(s => ({ [which]: { ...s[which], [index]: true } })); } getMap(isMobile, props) { if (!isMobile) { return (
); } return (
); } getBotUrl() { const fallbackLng = getFallbackLang(this.props.i18n.language); console.log(`language: ${this.props.i18n.language}, fallback: ${fallbackLng}`); return fallbackLng === 'es' ? 'https://t.me/TodosContraElFuego_bot' : 'https://t.me/AllAgainstTheFire_bot'; } 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(this.getBotUrl(), '_blank'); } gotoParticipe() { const element = document.querySelector('#participe'); if (element) { element.scrollIntoView(); } } render() { const { t } = this.props; const title = `${t('AppName')}: ${t('Inicio')}`; const androidUrl = 'https://play.google.com/store/apps/details?id=org.comunes.fires'; return (
{title} {/* https://v4-alpha.getbootstrap.com/components/carousel/ */}
this.markLazy('mainLazy', index)} prevLabel={t('Anterior')} nextLabel={t('Siguiente')} >
{ this.gotoParticipe(); }} onClick={() => { this.gotoParticipe(); }} />

Elige un lugar

Elige un radio de vigilancia

Recibe alertas de fuegos en esa zona

Alerta cuando hay un fuego

{this.props.t('AppName')}

Siempre alerta a los fuegos en nuestro vecindario

{/* {this.props.t('Participa')} */}

{this.props.t('AppDescrip')}

{this.props.t('AppDescripLong')}

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.

this.markLazy('sndLazy', index)} prevLabel={t('Anterior')} nextLabel={t('Siguiente')} >

Ayúdanos a combatir el cambio climático y a proteger el medioambiente

Suscríbete a alertas de fuegos

{this.getMap(isAnyMobile, this.props)}
); } } Index.propTypes = { history: PropTypes.object.isRequired, i18n: PropTypes.object.isRequired, t: PropTypes.func.isRequired }; export default withTranslation()(Index);