import React, { Component } from 'react'; import { connect } from 'react-redux'; import { AppState } from 'reducers'; import Notifications from './Notifications'; import OfflineTab from './OfflineTab'; import { getOffline } from 'selectors/config'; import { ElectronNav, AppAlphaNotice } from 'components'; import './ElectronTemplate.scss'; interface StateProps { isOffline: AppState['config']['meta']['offline']; } interface OwnProps { isUnavailableOffline?: boolean; children: string | React.ReactElement | React.ReactElement[]; } type Props = OwnProps & StateProps; class ElectronTemplate extends Component { public render() { const { isUnavailableOffline, children, isOffline } = this.props; return (
{isUnavailableOffline && isOffline ? : children}
); } } function mapStateToProps(state: AppState): StateProps { return { isOffline: getOffline(state) }; } export default connect(mapStateToProps, {})(ElectronTemplate);