1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 00:20:07 +00:00
Files
seahub/frontend/src/components/toolbar/common-toolbar.js
JoinTyang 1a6fe7b9cf search file use ai (#5690)
* search file use ai

* Feat: optimize code

* feat: update code

---------

Co-authored-by: er-pai-r <18335219360@163.com>
2023-10-21 11:38:12 +08:00

50 lines
1.3 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { isPro, gettext, showLogoutIcon } from '../../utils/constants';
import Search from '../search/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,
repoName: PropTypes.string,
isLibView: PropTypes.bool,
onSearchedClick: PropTypes.func.isRequired,
searchPlaceholder: PropTypes.string
};
class CommonToolbar extends React.Component {
render() {
const { repoID, repoName } = this.props;
return (
<div className="common-toolbar">
{isPro && (
<Search
repoID={repoID}
placeholder={this.props.searchPlaceholder || gettext('Search files')}
onSearchedClick={this.props.onSearchedClick}
isLibView={this.props.isLibView}
repoName={repoName}
/>
)}
{this.props.isLibView && !isPro &&
<SearchByName
repoID={repoID}
repoName={repoName}
/>
}
<Notification />
<Account />
{showLogoutIcon && (<Logout />)}
</div>
);
}
}
CommonToolbar.propTypes = propTypes;
export default CommonToolbar;