diff --git a/frontend/components/Alert/Alert.js b/frontend/components/Alert/Alert.js index 072804847..203afd11e 100644 --- a/frontend/components/Alert/Alert.js +++ b/frontend/components/Alert/Alert.js @@ -11,7 +11,6 @@ class Alert extends React.Component { danger: PropTypes.bool, warning: PropTypes.bool, success: PropTypes.bool, - offline: PropTypes.bool, }; render() { @@ -19,7 +18,6 @@ class Alert extends React.Component { if (this.props.danger) alertType = 'danger'; if (this.props.warning) alertType = 'warning'; if (this.props.success) alertType = 'success'; - if (this.props.offline) alertType = 'offline'; if (!alertType) alertType = 'info'; // default return ( diff --git a/frontend/components/Alert/Alert.test.js b/frontend/components/Alert/Alert.test.js index 2bec85bc3..849a25c47 100644 --- a/frontend/components/Alert/Alert.test.js +++ b/frontend/components/Alert/Alert.test.js @@ -23,7 +23,3 @@ test('renders warning', () => { test('renders danger', () => { snap(danger); }); - -test('renders offline', () => { - snap(offline); -}); diff --git a/frontend/components/Alert/__snapshots__/Alert.test.js.snap b/frontend/components/Alert/__snapshots__/Alert.test.js.snap deleted file mode 100644 index e419df800..000000000 --- a/frontend/components/Alert/__snapshots__/Alert.test.js.snap +++ /dev/null @@ -1,113 +0,0 @@ -exports[`test renders danger 1`] = ` -
- danger -
-`; - -exports[`test renders default as info 1`] = ` -
- default -
-`; - -exports[`test renders info 1`] = ` -
- info -
-`; - -exports[`test renders offline 1`] = ` -
- offline -
-`; - -exports[`test renders success 1`] = ` -
- success -
-`; - -exports[`test renders warning 1`] = ` -
- warning -
-`; diff --git a/frontend/components/Layout/Layout.js b/frontend/components/Layout/Layout.js index cb3733f0c..3b1f975d3 100644 --- a/frontend/components/Layout/Layout.js +++ b/frontend/components/Layout/Layout.js @@ -2,7 +2,6 @@ import React from 'react'; import { browserHistory, Link } from 'react-router'; import Helmet from 'react-helmet'; import { observer, inject } from 'mobx-react'; -import { injectOffline } from 'components/Offline'; import keydown from 'react-keydown'; import _ from 'lodash'; @@ -18,7 +17,6 @@ const cx = classNames.bind(styles); @inject('user') @observer -@injectOffline class Layout extends React.Component { static propTypes = { children: React.PropTypes.node, @@ -28,7 +26,6 @@ class Layout extends React.Component { loading: React.PropTypes.bool, user: React.PropTypes.object.isRequired, search: React.PropTypes.bool, - offline: React.PropTypes.bool, notifications: React.PropTypes.node, }; @@ -61,11 +58,6 @@ class Layout extends React.Component { {this.props.loading && } - {this.props.offline && - - It looks like you're offline. Reconnect to restore access to all of your documents 📚 - } - {this.props.notifications}
diff --git a/frontend/components/Offline/Offline.js b/frontend/components/Offline/Offline.js deleted file mode 100644 index 574649571..000000000 --- a/frontend/components/Offline/Offline.js +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react'; - -class Offline extends React.Component { - static propTypes = { - children: React.PropTypes.node, - }; - - static childContextTypes = { - offline: React.PropTypes.bool, - }; - - state = { - offline: !navigator.onLine, - }; - - 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 deleted file mode 100644 index d7fa3527c..000000000 --- a/frontend/components/Offline/index.js +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index f5d519d21..000000000 --- a/frontend/components/Offline/injectOffline.js +++ /dev/null @@ -1,19 +0,0 @@ -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 8ffef4491..975ddf006 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -5,7 +5,6 @@ import Router from 'react-router/lib/Router'; import Route from 'react-router/lib/Route'; import IndexRoute from 'react-router/lib/IndexRoute'; import History from 'utils/History'; -import { Offline } from 'components/Offline'; import stores from 'stores'; @@ -49,78 +48,72 @@ function requireAuth(nextState, replace) { render(
- - - - + + + - - - - - - + + + + + + - - + + - - - + + + - + - + - - - - - + + + + {__DEV__ && }
,