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