import React from 'react'; import PropTypes from 'prop-types'; import { isPro, gettext, showLogoutIcon, enableSeafileAI } from '../../utils/constants'; import Search from '../search/search'; import AISearch from '../search/ai-search'; import SearchByName from '../search/search-by-name'; import Notification from '../common/notification'; import Account from '../common/account'; import Logout from '../common/logout'; const propTypes = { repoID: PropTypes.string, path: PropTypes.string, repoName: PropTypes.string, isLibView: PropTypes.bool, onSearchedClick: PropTypes.func.isRequired, searchPlaceholder: PropTypes.string, currentRepoInfo: PropTypes.object, isViewFile: PropTypes.bool, }; class CommonToolbar extends React.Component { renderSearch = () => { const { repoID, repoName, isLibView, searchPlaceholder, path, isViewFile } = this.props; const placeholder = searchPlaceholder || gettext('Search files'); if (isPro) { if (enableSeafileAI) { return ( ); } else { return ( ); } } else { if (isLibView) { return ( ); } return null; } }; render() { return (
{this.renderSearch()} {showLogoutIcon && ()}
); } } CommonToolbar.propTypes = propTypes; export default CommonToolbar;