| | |
| | |
| | |
| | |
| | |
| |
|
| | import React from 'react'; |
| | import PropTypes from 'prop-types'; |
| | import { connect } from 'react-redux'; |
| | import { createStructuredSelector } from 'reselect'; |
| | import { FormattedNumber } from 'react-intl'; |
| |
|
| | import { makeSelectCurrentUser } from 'containers/App/selectors'; |
| | import ListItem from 'components/ListItem'; |
| | import IssueIcon from './IssueIcon'; |
| | import IssueLink from './IssueLink'; |
| | import RepoLink from './RepoLink'; |
| | import Wrapper from './Wrapper'; |
| |
|
| | export function RepoListItem(props) { |
| | const { item } = props; |
| | let nameprefix = ''; |
| |
|
| | |
| | |
| | if (item.owner.login !== props.currentUser) { |
| | nameprefix = `${item.owner.login}/`; |
| | } |
| |
|
| | |
| | const content = ( |
| | <Wrapper> |
| | <RepoLink href={item.html_url} target="_blank"> |
| | {nameprefix + item.name} |
| | </RepoLink> |
| | <IssueLink href={`${item.html_url}/issues`} target="_blank"> |
| | <IssueIcon /> |
| | <FormattedNumber value={item.open_issues_count} /> |
| | </IssueLink> |
| | </Wrapper> |
| | ); |
| |
|
| | |
| | return <ListItem key={`repo-list-item-${item.full_name}`} item={content} />; |
| | } |
| |
|
| | RepoListItem.propTypes = { |
| | item: PropTypes.object, |
| | currentUser: PropTypes.string, |
| | }; |
| |
|
| | export default connect( |
| | createStructuredSelector({ |
| | currentUser: makeSelectCurrentUser(), |
| | }), |
| | )(RepoListItem); |
| |
|