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