diff --git a/frontend/components/Offline/Offline.js b/frontend/components/Offline/Offline.js
new file mode 100644
index 000000000..3d9eb7952
--- /dev/null
+++ b/frontend/components/Offline/Offline.js
@@ -0,0 +1,43 @@
+import React from 'react';
+
+class Offline extends React.Component {
+ static propTypes = {
+ children: React.PropTypes.node,
+ };
+
+ static childContextTypes = {
+ offline: React.PropTypes.bool,
+ };
+
+ state = {
+ offline: false,
+ }
+
+ getChildContext() {
+ return {
+ offline: this.state.offline,
+ };
+ }
+
+ componentDidMount = () => {
+ window.addEventListener('offline', this.handleConnectionState);
+ window.addEventListener('online', this.handleConnectionState);
+ }
+
+ componentWillUnmount = () => {
+ window.removeEventListener('offline', this.handleConnectionState);
+ window.removeEventListener('online', this.handleConnectionState);
+ };
+
+ handleConnectionState = () => {
+ this.setState({
+ offline: !navigator.onLine,
+ });
+ }
+
+ render() {
+ return React.Children.only(this.props.children);
+ }
+}
+
+export default Offline;
diff --git a/frontend/components/Offline/index.js b/frontend/components/Offline/index.js
new file mode 100644
index 000000000..5bc9f908c
--- /dev/null
+++ b/frontend/components/Offline/index.js
@@ -0,0 +1,7 @@
+import Offline from './Offline';
+import injectOffline from './injectOffline';
+
+export {
+ Offline,
+ injectOffline,
+}
diff --git a/frontend/components/Offline/injectOffline.js b/frontend/components/Offline/injectOffline.js
new file mode 100644
index 000000000..5bb665095
--- /dev/null
+++ b/frontend/components/Offline/injectOffline.js
@@ -0,0 +1,19 @@
+import React from 'react';
+
+const injectOffline = (WrappedComponent) => {
+ return class OfflineWrapper extends React.Component {
+ static contextTypes = {
+ offline: React.PropTypes.bool,
+ };
+
+ render() {
+ const newProps = {
+ offline: this.context.offline,
+ };
+
+ return (
);
+ }
+ };
+};
+
+export default injectOffline;
diff --git a/frontend/index.js b/frontend/index.js
index 83636a3fb..14778eb00 100644
--- a/frontend/index.js
+++ b/frontend/index.js
@@ -6,6 +6,7 @@ import Route from 'react-router/lib/Route';
import IndexRoute from 'react-router/lib/IndexRoute';
import Redirect from 'react-router/lib/Redirect';
import History from 'utils/History';
+import { Offline } from 'components/Offline';
import stores from 'stores';
@@ -45,35 +46,37 @@ function requireAuth(nextState, replace) {
render((
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
+
-
-
-
-
+
+
+
+
+
{ __DEV__ &&
}