mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
a81f08b07b
* Moves side panels into the side_panel directory * Adds SecondarySidePanelContainer component * Renames MainSidePanel to SiteNavSidePanel
62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
import React, { Component, PropTypes } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { StyleRoot } from 'radium';
|
|
|
|
import componentStyles from './styles';
|
|
import FlashMessage from '../../components/FlashMessage';
|
|
import SiteNavSidePanel from '../../components/side_panels/SiteNavSidePanel';
|
|
|
|
export class CoreLayout extends Component {
|
|
static propTypes = {
|
|
children: PropTypes.node,
|
|
config: PropTypes.shape({
|
|
org_logo_url: PropTypes.string,
|
|
org_name: PropTypes.string,
|
|
}),
|
|
dispatch: PropTypes.func,
|
|
notifications: PropTypes.object,
|
|
showRightSidePanel: PropTypes.bool,
|
|
user: PropTypes.object,
|
|
};
|
|
|
|
render () {
|
|
const { children, config, dispatch, notifications, showRightSidePanel, user } = this.props;
|
|
const { wrapperStyles } = componentStyles;
|
|
|
|
if (!user) return false;
|
|
|
|
const { pathname } = global.window.location;
|
|
|
|
return (
|
|
<StyleRoot>
|
|
<SiteNavSidePanel
|
|
config={config}
|
|
pathname={pathname}
|
|
user={user}
|
|
/>
|
|
<div style={wrapperStyles(showRightSidePanel)}>
|
|
<FlashMessage notification={notifications} dispatch={dispatch} />
|
|
{children}
|
|
</div>
|
|
</StyleRoot>
|
|
);
|
|
}
|
|
}
|
|
|
|
const mapStateToProps = (state) => {
|
|
const {
|
|
app: { config, showRightSidePanel },
|
|
auth: { user },
|
|
notifications,
|
|
} = state;
|
|
|
|
return {
|
|
config,
|
|
notifications,
|
|
showRightSidePanel,
|
|
user,
|
|
};
|
|
};
|
|
|
|
export default connect(mapStateToProps)(CoreLayout);
|