import React from 'react'; import PropTypes from 'prop-types'; import ModalPortal from './modal-portal'; import ListTaggedFilesDialog from './dialog/list-taggedfiles-dialog'; import ListRepoDraftsDialog from './dialog/list-repo-drafts-dialog'; import '../css/repo-info-bar.css'; const propTypes = { repoID: PropTypes.string.isRequired, usedRepoTags: PropTypes.array.isRequired, draftCounts: PropTypes.number, updateUsedRepoTags: PropTypes.func, onFileTagChanged: PropTypes.func, className: PropTypes.string, shareLinkToken: PropTypes.string, enableFileDownload: PropTypes.bool }; class RepoInfoBar extends React.Component { constructor(props) { super(props); this.state = { currentTag: null, isListTaggedFileShow: false, showRepoDrafts: false }; } onListTaggedFiles = (currentTag) => { this.setState({ currentTag: currentTag, isListTaggedFileShow: !this.state.isListTaggedFileShow }); }; onCloseDialog = () => { this.setState({ isListTaggedFileShow: false }); }; toggleDrafts = () => { this.setState({ showRepoDrafts: !this.state.showRepoDrafts }); }; render() { let { repoID, usedRepoTags, draftCounts, className } = this.props; // to be compatible with the existing code if (draftCounts === undefined) { draftCounts = 0; } return (
{usedRepoTags.length > 0 && ( )} {/*
0 ? 'file-info-list mt-1' : 'file-info-list'}> {draftCounts > 0 && {gettext('draft')} }
*/} {this.state.isListTaggedFileShow && ( )} {this.state.showRepoDrafts && ( )}
); } } RepoInfoBar.propTypes = propTypes; export default RepoInfoBar;