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