diff --git a/client/src/components/BoardPage/IssueCard.jsx b/client/src/components/BoardPage/IssueCard.jsx index 3a2a09d..a193ed8 100644 --- a/client/src/components/BoardPage/IssueCard.jsx +++ b/client/src/components/BoardPage/IssueCard.jsx @@ -1,8 +1,13 @@ import React from 'react'; +const issueURLPattern = /(^https?:\/\/([^\/]))$/i; + export class IssueCard extends React.PureComponent { render() { const { card } = this.props; + const issueURLInfo = extractInfoFromIssueURL(card.issue.url); + const projectURL = `${issueURLInfo.baseURL}/${issueURLInfo.owner}/${issueURLInfo.projectName}`; + const issueURL = `${projectURL}/issues/${card.issue.number}`; return (
@@ -30,18 +35,28 @@ export class IssueCard extends React.PureComponent {
- {card.project} + {card.project}
- - - - - + + + + +
); } +} + +function extractInfoFromIssueURL(issueURL) { + const pattern = /^(https?:\/\/[^\/]+)\/api\/v1\/repos\/([^\/]+)\/([^\/]+)\/.*$/; + const matches = pattern.exec(issueURL); + return { + baseURL: matches[1], + owner: matches[2], + projectName: matches[3], + }; } \ No newline at end of file