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