import React from 'react'; import PropTypes from 'prop-types'; import { Utils } from '../../../utils/utils.js'; import { siteRoot, gettext } from '../../../utils/constants'; const { enableSysAdminViewRepo } = window.sysadmin.pageOptions; const RepoItemPropTypes = { repo: PropTypes.object.isRequired, showDeleteRepoDialog: PropTypes.func.isRequired, }; class RepoItem extends React.Component { constructor(props) { super(props); this.state = { highlight: false, }; } onMouseEnter = () => { this.setState({ highlight: true }); } onMouseLeave = () => { this.setState({ highlight: false }); } render() { const repo = this.props.repo; const highlight = this.state.highlight; let iconUrl = Utils.getLibIconUrl(repo); return ( {gettext('icon')}/ { enableSysAdminViewRepo ? {repo.name} : {repo.name} } {Utils.bytesToSize(repo.size)}{' '} { this.props.orgID == -1 ? : } ); } } RepoItem.propTypes = RepoItemPropTypes; export default RepoItem;