diff --git a/common/containers/App/index.jsx b/common/containers/App/index.jsx index f2e7b952..825bc597 100644 --- a/common/containers/App/index.jsx +++ b/common/containers/App/index.jsx @@ -1,11 +1,18 @@ import React, {Component} from 'react' import {connect} from 'react-redux' -import {Dimmer, Sidebar as SidebarSemantic, Container} from 'semantic-ui-react' -import {Header, Sidebar, Footer} from 'components' -import {CLOSE_SIDEBAR, OPEN_SIDEBAR, WINDOW_RESIZE} from 'actions/layout' -import {LOGOUT_AUTH} from 'actions/auth' +import {Header, Footer} from 'components' import {push} from 'react-router-redux' import {sidebarRouting} from 'routing' +import PropTypes from 'prop-types'; +import {Container} from 'semantic-ui-react' + +import { + CHANGE_LANGUAGE, + TOGGLE_LANGUAGE_DROPDOWN, + CHANGE_NODE, + TOGGLE_NODE_DROPDOWN +} from 'actions/config' + class App extends Component { constructor(props) { @@ -13,79 +20,72 @@ class App extends Component { } static propTypes = { - children: React.PropTypes.node.isRequired, - location: React.PropTypes.object, - sidebarOpened: React.PropTypes.bool, - closeSidebar: React.PropTypes.func, - isLoggedIn: React.PropTypes.bool, - handleWindowResize: React.PropTypes.func, - logout: React.PropTypes.func, - checkAuthLogic: React.PropTypes.func, - toggleSidebar: React.PropTypes.func, - onHeaderRightButtonClick: React.PropTypes.func, - router: React.PropTypes.object, - isMobile: React.PropTypes.bool + children: PropTypes.node.isRequired, + location: PropTypes.object, + sidebarOpened: PropTypes.bool, + closeSidebar: PropTypes.func, + isLoggedIn: PropTypes.bool, + handleWindowResize: PropTypes.func, + logout: PropTypes.func, + checkAuthLogic: PropTypes.func, + toggleSidebar: PropTypes.func, + onHeaderRightButtonClick: PropTypes.func, + router: PropTypes.object, + isMobile: PropTypes.bool, + + // BEGIN ACTUAL + languageSelection: PropTypes.number, + languageToggle: PropTypes.bool, + changeLanguage: PropTypes.func, + toggleLanguageDropdown: PropTypes.func, + + changeNode: PropTypes.func, + toggleNodeDropdown: PropTypes.func, + nodeSelection: PropTypes.number, + nodeToggle: PropTypes.bool, } componentWillMount() { let {handleWindowResize, isLoggedIn} = this.props window.addEventListener('resize', handleWindowResize) - this.checkAppAuthLogic(isLoggedIn) } - /** - * Call checkAuthLogic - * @param {Bool} loggedIn state.auth.loggedIn, current prop - * @return {Bool} Nothing - */ - checkAppAuthLogic(loggedIn) { - let {router, checkAuthLogic} = this.props - let path = router.getCurrentLocation().pathname - checkAuthLogic(path, loggedIn) - return false - } - - componentWillReceiveProps(nextProps) { - this.checkAppAuthLogic(nextProps.isLoggedIn) - } render() { let { children, - sidebarOpened, - closeSidebar, - isLoggedIn, - logout, - onHeaderRightButtonClick, - toggleSidebar, - isMobile - } = this.props - let title = children.props.route.name + // ACTUAL + languageSelection, + changeLanguage, + languageToggle, + toggleLanguageDropdown, + changeNode, + toggleNodeDropdown, + nodeSelection, + nodeToggle, + } = this.props; + + let title = children.props.route.name; - let sidebarProps = { - isMobile, - logout, - open: sidebarOpened, - routing: sidebarRouting - } let headerProps = { - toggleSidebar, title, - isLoggedIn, - onHeaderRightButtonClick - } - let dimmerProps = { - active: sidebarOpened, - onClick: closeSidebar + changeLanguage, + toggleLanguageDropdown, + languageSelection, + languageToggle, + + changeNode, + toggleNodeDropdown, + nodeSelection, + nodeToggle, } return (