diff --git a/imports/ui/pages/FiresMap/FireStats.js b/imports/ui/pages/FiresMap/FireStats.js
index 3a9887e..f88245c 100644
--- a/imports/ui/pages/FiresMap/FireStats.js
+++ b/imports/ui/pages/FiresMap/FireStats.js
@@ -8,19 +8,49 @@ import { translate, Trans } from 'react-i18next';
import FromNow from '/imports/ui/components/FromNow/FromNow';
class FireStats extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ lastFireDetected: props.lastFireDetected,
+ lastCheck: props.lastCheck,
+ loadingAll: props.loadingAll
+ };
+ }
+
+ componentWillReceiveProps(nextProps) {
+ if (this.props.lastCheck !== nextProps.lastCheck ||
+ this.props.lastFireDetected !== nextProps.lastFireDetected ||
+ this.props.loadingAll !== nextProps.loadingAll
+ ) {
+ this.setState({
+ lastFireDetected: nextProps.lastFireDetected,
+ lastCheck: nextProps.lastCheck,
+ loadingAll: nextProps.loadingAll
+ });
+ }
+ }
+
+ shouldComponentUpdate(nextProps, nextState) {
+ return !(nextState.lastCheck === this.state.lastCheck &&
+ nextState.lastFireDetected === this.state.lastFireDetected &&
+ nextState.loadingAll === this.state.loadingAll);
+ }
+
render() {
- return (
-
- { this.props.lastCheck && this.props.lastFireDetected ?
- Actualizado , último fuego detectado .
- : '' }
-
- );
+ if (this.state.loadingAll) return (
Actualizando...);
+ if (this.state.lastCheck && !this.state.lastFireDetected) {
+ return (
Actualizado .);
+ }
+ if (this.state.lastCheck && this.state.lastFireDetected) {
+ return (
Actualizado , último fuego detectado .);
+ }
+ return ();
}
}
FireStats.propTypes = {
lastFireDetected: PropTypes.object,
+ loadingAll: PropTypes.bool.isRequired,
lastCheck: PropTypes.instanceOf(Date)
};
diff --git a/imports/ui/pages/FiresMap/FiresMap.js b/imports/ui/pages/FiresMap/FiresMap.js
index 9013572..265b0cc 100644
--- a/imports/ui/pages/FiresMap/FiresMap.js
+++ b/imports/ui/pages/FiresMap/FiresMap.js
@@ -245,8 +245,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. :
- En rojo, {{ count: this.props.activefires.length + this.props.firealerts.length }} fuegos activos. {{ countTotal: this.props.activefirestotal }} fuegos activos en el mundo.
+ No hay fuegos activos en esta zona del mapa. {{ countTotal: this.props.activefirestotal }} fuegos activos en el mundo. :
+ En rojo, {{ count: this.props.activefires.length + this.props.firealerts.length }} fuegos activos. {{ countTotal: this.props.activefirestotal }} fuegos activos en el mundo.
}
{isNotHomeAndMobile() && this.props.firealerts.length > 0 &&
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index e5189fc..bc6ae5a 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -167,6 +167,7 @@
"Verifica tu dirección de correo": "Verify Your Email Address",
"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 cars1> and <3>about ⅕ of all our carbon emissions3>?",
@@ -248,5 +249,6 @@
"Note: Cloud cover might obscure active fire detections.",
"Hay más información sobre un fuego":
"There is more information about a fire",
- "esDecirTalDia": "That is on {{date}}"
+ "esDecirTalDia": "That is on {{date}}",
+ "Actualizando...": "Updating..."
}
diff --git a/public/locales/es/common.json b/public/locales/es/common.json
index 35a1da4..a460481 100644
--- a/public/locales/es/common.json
+++ b/public/locales/es/common.json
@@ -237,6 +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!",
@@ -333,5 +334,7 @@
"Nota: Las nubes pueden entorpecer la detección de fuegos activos.",
"Hay más información sobre un fuego":
"Hay más información sobre un fuego",
- "esDecirTalDia": "Es decir el {{date}}"
+ "esDecirTalDia": "Es decir el {{date}}",
+ "Actualizando...":
+ "Actualizando..."
}