diff --git a/imports/api/ActiveFires/server/publications.js b/imports/api/ActiveFires/server/publications.js index c6de899..9aee452 100644 --- a/imports/api/ActiveFires/server/publications.js +++ b/imports/api/ActiveFires/server/publications.js @@ -58,3 +58,7 @@ Meteor.publish('activefiresmyloc', function activeInMyLoc(northEastLng, northEas return activefires(northEastLng, northEastLat, southWestLng, southWestLat, withMarks); }); + +Meteor.publish('lastFireDetected', function lastFireDetected() { + return ActiveFires.find({}, { limit: 1, sort: { when: -1 } }); +}); diff --git a/imports/ui/pages/FiresMap/FiresMap.js b/imports/ui/pages/FiresMap/FiresMap.js index 87308a3..f1fe788 100644 --- a/imports/ui/pages/FiresMap/FiresMap.js +++ b/imports/ui/pages/FiresMap/FiresMap.js @@ -74,6 +74,7 @@ class FiresMap extends React.Component { this.onViewportChanged = this.onViewportChanged.bind(this); this.onMoveEnd = this.onMoveEnd.bind(this); this.onMoveStart = this.onMoveStart.bind(this); + this.fireStats = this.fireStats.bind(this); } componentDidMount() { @@ -195,6 +196,15 @@ class FiresMap extends React.Component { } } + fireStats() { + return ( + + { this.props.lastCheck && this.props.lastFireDetected && + Actualizado , último fuego detectado .} + + ); + } + render() { const { t } = this.props; console.log(`Rendering ${this.props.loading ? 'loading' : 'LOADED'}, zoom ${this.state.viewport.zoom}, map ${this.props.activefires.length + this.props.firealerts.length} of ${this.props.activefirestotal} total. False positives: ${this.props.falsePositives.length}. Reactive ${this.state.viewport.zoom >= MAXZOOMREACTIVE}`); @@ -243,8 +253,8 @@ class FiresMap extends React.Component {

{ (this.props.activefires.length + this.props.firealerts.length) === 0 ? - No hay fuegos activos en esta zona del mapa. {{ countTotal: this.props.activefirestotal }} fuegos activos en el mundo. Actualizado . : - En rojo, {{ count: this.props.activefires.length + this.props.firealerts.length }} fuegos activos. {{ countTotal: this.props.activefirestotal }} fuegos activos en el mundo. Actualizado . + No hay fuegos activos en esta zona del mapa. {{ countTotal: this.props.activefirestotal }} fuegos activos en el mundo. {this.fireStats()} : + En rojo, {{ count: this.props.activefires.length + this.props.firealerts.length }} fuegos activos. {{ countTotal: this.props.activefirestotal }} fuegos activos en el mundo. {this.fireStats()} }

{isNotHomeAndMobile() && this.props.firealerts.length > 0 && @@ -367,6 +377,7 @@ FiresMap.propTypes = { userSubs: PropTypes.string, userSubsBounds: PropTypes.string, activefires: PropTypes.arrayOf(PropTypes.object).isRequired, + lastFireDetected: PropTypes.object, firealerts: PropTypes.arrayOf(PropTypes.object).isRequired, falsePositives: PropTypes.arrayOf(PropTypes.object).isRequired, industries: PropTypes.arrayOf(PropTypes.object).isRequired, @@ -402,6 +413,7 @@ export default translate([], { wait: true })(withTracker(() => { if (typeof showUnionStored === 'boolean') { showUnion.set(showUnionStored); } + Meteor.subscribe('lastFireDetected'); Meteor.autorun(() => { if ((centerStored !== [0, 0] || geolocation.get()) && geoInit) { center.set(centerStored || geolocation.get()); @@ -458,6 +470,7 @@ export default translate([], { wait: true })(withTracker(() => { falsePositives, industries, lastCheck: lastCheck ? lastCheck.value : null, + lastFireDetected: ActiveFiresCollection.findOne({}, { sort: { when: -1 } }), center: center.get(), marks: marks.get(), showUnion: showUnion.get(), diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 7503a00..21486c9 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -168,6 +168,7 @@ "Zonas vigiladas": "Monitored areas", "En verde, las zonas vigiladas por nuestros usuari@s actualmente": "In green, the areas monitored by our users currently", "Actualizado <1>.": "Updated <1>.", + "Actualizado <1>, último fuego detectado <3>.": "Updated <1>, last fire detected <3>.", "Información adicional sobre fuego": "Additional information about fire", "CO2emisions": "Did you know that wildfires <1>produce as much CO² as cars and <3>about ⅕ of all our carbon emissions?", "Ayúdanos a combatir el cambio climático y a proteger el medioambiente": "Help us fight climate change and protect the environment", diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 6d12c9d..35a1da4 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -237,7 +237,7 @@ "Verifica tu dirección de correo", "Zonas vigiladas": "Zonas vigiladas", "En verde, las zonas vigiladas por nuestros usuari@s actualmente": "En verde, las zonas vigiladas por nuestros usuari@s actualmente", - "Actualizado <1>.": "Actualizado <1>.", + "Actualizado <1>, último fuego detectado <3>.": "Actualizado <1>, último fuego detectado <3>.", "Tomamos nota, ¡gracias por colaborar!": "Tomamos nota, ¡gracias por colaborar!", "Indícanos de que tipo de fuego se trata y ayúdanos así a mejorar nuestras notificaciones:": "Indícanos de que tipo de fuego se trata y ayúdanos así a mejorar nuestras notificaciones:",