1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 08:53:14 +00:00
Files
seahub/frontend/src/components/toolbar/common-toolbar.js
Michael An 4722d16be7 12.0 change search UI (#6168)
* 01 remove AI search

* 02 change normal search UI
2024-06-06 12:11:49 +08:00

73 lines
1.9 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { isPro, gettext, showLogoutIcon } 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,
};
class CommonToolbar extends React.Component {
renderSearch = () => {
const { repoID, repoName, isLibView, searchPlaceholder, path } = this.props;
const placeholder = searchPlaceholder || gettext('Search files');
if (isPro) {
return (
<Search
repoID={repoID}
placeholder={placeholder}
onSearchedClick={this.props.onSearchedClick}
isPublic={false}
path={path}
/>
);
// if (enableSeafileAI && isLibView) {
// return (
// <AISearch
// repoID={repoID}
// placeholder={placeholder}
// onSearchedClick={this.props.onSearchedClick}
// repoName={repoName}
// currentRepoInfo={this.props.currentRepoInfo}
// />
// );
// }
} else {
if (isLibView) {
return (
<SearchByName repoID={repoID} repoName={repoName} />
);
}
return null;
}
};
render() {
return (
<div className="common-toolbar">
{this.renderSearch()}
<Notification />
<Account />
{showLogoutIcon && (<Logout />)}
</div>
);
}
}
CommonToolbar.propTypes = propTypes;
export default CommonToolbar;