2017-12-01 08:09:51 -08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
2018-02-27 16:35:32 -05:00
|
|
|
import { BetaAgreement, Footer, Header } from 'components';
|
2017-09-24 19:06:28 -07:00
|
|
|
import { AppState } from 'reducers';
|
2017-06-22 03:31:59 +04:00
|
|
|
import Notifications from './Notifications';
|
2018-01-11 13:04:11 -05:00
|
|
|
import OfflineTab from './OfflineTab';
|
2018-02-12 15:43:07 -05:00
|
|
|
import { getOffline, getLatestBlock } from 'selectors/config';
|
2017-04-12 00:04:27 -05:00
|
|
|
|
2018-02-12 15:43:07 -05:00
|
|
|
interface StateProps {
|
|
|
|
isOffline: AppState['config']['meta']['offline'];
|
|
|
|
latestBlock: AppState['config']['meta']['latestBlock'];
|
2017-12-01 08:09:51 -08:00
|
|
|
}
|
2017-04-14 01:22:53 -05:00
|
|
|
|
2018-02-12 15:43:07 -05:00
|
|
|
interface OwnProps {
|
2018-01-11 13:04:11 -05:00
|
|
|
isUnavailableOffline?: boolean;
|
|
|
|
children: string | React.ReactElement<string> | React.ReactElement<string>[];
|
2018-02-12 15:43:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type Props = OwnProps & StateProps;
|
2017-12-01 08:09:51 -08:00
|
|
|
|
2017-10-04 00:13:49 -04:00
|
|
|
class TabSection extends Component<Props, {}> {
|
2017-09-24 19:06:28 -07:00
|
|
|
public render() {
|
2018-02-12 15:43:07 -05:00
|
|
|
const { isUnavailableOffline, children, isOffline, latestBlock } = this.props;
|
2017-04-12 00:04:27 -05:00
|
|
|
|
2017-07-03 22:21:19 -05:00
|
|
|
return (
|
|
|
|
<div className="page-layout">
|
2018-02-24 12:57:54 -05:00
|
|
|
<Header />
|
|
|
|
<div className="Tab container">
|
|
|
|
{isUnavailableOffline && isOffline ? <OfflineTab /> : children}
|
|
|
|
</div>
|
|
|
|
<div className="flex-spacer" />
|
|
|
|
<Footer latestBlock={latestBlock} />
|
2017-07-03 22:21:19 -05:00
|
|
|
<Notifications />
|
2018-02-27 16:35:32 -05:00
|
|
|
<BetaAgreement />
|
2017-07-03 22:21:19 -05:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-04-12 00:04:27 -05:00
|
|
|
}
|
|
|
|
|
2018-02-12 15:43:07 -05:00
|
|
|
function mapStateToProps(state: AppState): StateProps {
|
2017-07-03 22:21:19 -05:00
|
|
|
return {
|
2018-02-12 15:43:07 -05:00
|
|
|
isOffline: getOffline(state),
|
|
|
|
latestBlock: getLatestBlock(state)
|
2017-07-03 22:21:19 -05:00
|
|
|
};
|
2017-04-12 00:04:27 -05:00
|
|
|
}
|
|
|
|
|
2018-02-12 15:43:07 -05:00
|
|
|
export default connect(mapStateToProps, {})(TabSection);
|