diff --git a/embark-ui/src/components/DataWrapper.js b/embark-ui/src/components/DataWrapper.js
index 7215a6a0b..7466072ea 100644
--- a/embark-ui/src/components/DataWrapper.js
+++ b/embark-ui/src/components/DataWrapper.js
@@ -4,7 +4,7 @@ import React from "react";
import Loading from '../components/Loading';
import Error from '../components/Error';
-const DataWrapper = ({error, loading, shouldRender, render, ...rest}) => {
+const DataWrapper = ({error, loading, shouldRender, render, elseRender, ...rest}) => {
if (error) {
return ;
}
@@ -17,6 +17,10 @@ const DataWrapper = ({error, loading, shouldRender, render, ...rest}) => {
return ;
}
+ if (elseRender) {
+ return elseRender(rest);
+ }
+
return ;
};
@@ -24,6 +28,7 @@ DataWrapper.propTypes = {
error: PropTypes.string,
loading: PropTypes.bool,
render: PropTypes.func,
+ elseRender: PropTypes.func,
shouldRender: PropTypes.bool
};
diff --git a/embark-ui/src/containers/GasStationContainer.js b/embark-ui/src/containers/GasStationContainer.js
index 82bac07d6..828b2012b 100644
--- a/embark-ui/src/containers/GasStationContainer.js
+++ b/embark-ui/src/containers/GasStationContainer.js
@@ -5,6 +5,7 @@ import GasStation from '../components/GasStation';
import {stopGasOracle, listenToGasOracle, gasOracle as ethGasAction, blocks as blocksAction} from "../actions";
import DataWrapper from "../components/DataWrapper";
import {getOracleGasStats, getLastBlock} from "../reducers/selectors";
+import {Alert} from 'reactstrap';
class GasStationContainer extends Component {
componentDidMount() {
@@ -18,6 +19,9 @@ class GasStationContainer extends Component {
}
getCurrentGas() {
+ if (!this.gasStation) {
+ return 'Unavailable';
+ }
return this.gasStation.getCurrentGas();
}
@@ -25,7 +29,13 @@ class GasStationContainer extends Component {
return (
{ this.gasStation = instance; }}/>
- )}/>;
+ )} elseRender={() => {
+ let message = 'Currently not enough blocks mined to estimated';
+ if (Object.keys(this.props.gasOracleStats).length === 0) {
+ message = 'No blocks detected. If you are connected using an RPC connection, switch to WS to have access to new block events.'
+ }
+ return ({message})
+ }}/>;
}
}