/* * Copyright 2007-2017 Charles du Jeu - Abstrium SAS * This file is part of Pydio. * * Pydio is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Pydio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Pydio. If not, see . * * The latest code can be found at . */ const React = require('react') const {AsyncComponent} = require('pydio/http/resources-manager').requireLib('boot') const {UserAvatar, IconButtonMenu, Toolbar} = require('pydio/http/resources-manager').requireLib('components') const {IconButton, Paper} = require('material-ui') import BookmarksList from './BookmarksList' export default React.createClass({ propTypes:{ pydio: React.PropTypes.instanceOf(Pydio), style: React.PropTypes.object, avatarStyle: React.PropTypes.object, actionBarStyle: React.PropTypes.object }, applyAction: function(actionName){ switch (actionName){ case 'home': this.props.pydio.triggerRepositoryChange('ajxp_home'); break; case 'settings': this.props.pydio.triggerRepositoryChange('ajxp_conf'); break; default: break; } }, render: function() { const messages = this.props.pydio.MessageHash; let avatar; let homeButton, infoButton, logoutButton, notificationsButton, currentIsSettings, bookmarksButton; let avatarStyle = this.props.avatarStyle || {}; if(this.props.pydio.user){ const user = this.props.pydio.user; currentIsSettings = user.activeRepository === 'ajxp_conf'; avatar = ( ); if(user.getRepositoriesList().has('ajxp_home') && user.activeRepository !== 'ajxp_home'){ homeButton = ( ); bookmarksButton = } if(this.props.pydio.Controller.getActionByName('get_my_feed') && !this.props.hideNotifications && !(this.props.pydio.user && this.props.pydio.user.activeRepository === 'inbox')){ notificationsButton = ( ); } } // Do not display Home Button here for the moment const actionBarStyle = this.props.actionBarStyle || {}; let actionBar; if(currentIsSettings){ actionBar = (
{homeButton}
); }else{ actionBar = (
{bookmarksButton} {notificationsButton} {homeButton}
); } if(this.props.children){ return (
{avatar} {actionBar}
{this.props.children}
); }else{ return ( {avatar} {actionBar} ); } } });