feat(ui): Display 'View in Gitlab' if externalUrl is a link to Gitlab (#10668)

This commit is contained in:
k7ragav 2024-06-12 19:04:45 +02:00 committed by GitHub
parent 894e25680b
commit 6054cb889b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,8 @@ import UrlButton from './UrlButton';
const GITHUB_LINK = 'github.com';
const GITHUB = 'GitHub';
const GITLAB_LINK = 'gitlab.com';
const GITLAB = 'GitLab';
interface Props {
externalUrl: string;
@ -26,6 +28,8 @@ export default function ExternalUrlButton({ externalUrl, platformName, entityTyp
let displayedName = platformName;
if (externalUrl.toLocaleLowerCase().includes(GITHUB_LINK)) {
displayedName = GITHUB;
} else if (externalUrl.toLocaleLowerCase().includes(GITLAB_LINK)) {
displayedName = GITLAB;
}
return (