Last fire detected
This commit is contained in:
parent
b794538ed2
commit
452f6baf45
4 changed files with 21 additions and 3 deletions
|
|
@ -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 } });
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<Fragment>
|
||||
{ this.props.lastCheck && this.props.lastFireDetected &&
|
||||
<Trans>Actualizado <FromNow when={this.props.lastCheck} />, último fuego detectado <FromNow when={this.props.lastFireDetected.when} />.</Trans>}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
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 {
|
|||
<Col xs={12} sm={6} md={6} lg={6} >
|
||||
<p className="firesmap-legend">
|
||||
{ (this.props.activefires.length + this.props.firealerts.length) === 0 ?
|
||||
<Fragment><Trans parent="span" i18nKey="noActiveFireInMapCount">No hay fuegos activos en esta zona del mapa. <strong>{{ countTotal: this.props.activefirestotal }}</strong> fuegos activos en el mundo.</Trans> <Trans>Actualizado <FromNow when={this.props.lastCheck} />.</Trans></Fragment> :
|
||||
<Fragment><Trans parent="span" i18nKey="activeFireInMapCount">En rojo, <strong>{{ count: this.props.activefires.length + this.props.firealerts.length }}</strong> fuegos activos. <strong>{{ countTotal: this.props.activefirestotal }}</strong> fuegos activos en el mundo.</Trans> <Trans>Actualizado <FromNow when={this.props.lastCheck} />.</Trans></Fragment>
|
||||
<Fragment><Trans parent="span" i18nKey="noActiveFireInMapCount">No hay fuegos activos en esta zona del mapa. <strong>{{ countTotal: this.props.activefirestotal }}</strong> fuegos activos en el mundo.</Trans> {this.fireStats()}</Fragment> :
|
||||
<Fragment><Trans parent="span" i18nKey="activeFireInMapCount">En rojo, <strong>{{ count: this.props.activefires.length + this.props.firealerts.length }}</strong> fuegos activos. <strong>{{ countTotal: this.props.activefirestotal }}</strong> fuegos activos en el mundo.</Trans> {this.fireStats()}</Fragment>
|
||||
}
|
||||
</p>
|
||||
{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(),
|
||||
|
|
|
|||
|
|
@ -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></1>.": "Updated <1></1>.",
|
||||
"Actualizado <1></1>, último fuego detectado <3></3>.": "Updated <1></1>, last fire detected <3></3>.",
|
||||
"Información adicional sobre fuego": "Additional information about fire",
|
||||
"CO2emisions": "Did you know that wildfires <1>produce as much CO² as cars</1> and <3>about ⅕ of all our carbon emissions</3>?",
|
||||
"Ayúdanos a combatir el cambio climático y a proteger el medioambiente": "Help us fight climate change and protect the environment",
|
||||
|
|
|
|||
|
|
@ -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></1>.": "Actualizado <1></1>.",
|
||||
"Actualizado <1></1>, último fuego detectado <3></3>.": "Actualizado <1></1>, último fuego detectado <3></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:",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue