import React from 'react';
import ExternalLink from 'app/components/links/externalLink';
import {IconBitbucket, IconGithub, IconGitlab} from 'app/icons';
import {PullRequest, Repository} from 'app/types';
function renderIcon(repo: Repository) {
if (!repo.provider) {
return null;
}
const {id} = repo.provider;
const providerId = id.includes(':') ? id.split(':').pop() : id;
switch (providerId) {
case 'github':
return ;
case 'gitlab':
return ;
case 'bitbucket':
return ;
default:
return null;
}
}
type Props = {
pullRequest: PullRequest;
repository: Repository;
inline?: boolean;
};
const PullRequestLink = ({pullRequest, repository, inline}: Props) => {
const displayId = `${repository.name} #${pullRequest.id}: ${pullRequest.title}`;
return pullRequest.externalUrl ? (
{renderIcon(repository)}
{inline ? '' : ' '}
{displayId}
) : (
{displayId}
);
};
export default PullRequestLink;