File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ const meta: Meta<typeof TaskStatusLink> = {
1717export default meta ;
1818type Story = StoryObj < typeof TaskStatusLink > ;
1919
20+ export const GitHubNewPR : Story = {
21+ args : {
22+ uri : "https://github.com/coder/coder/pull/new/fix-deleted-template-button" ,
23+ } ,
24+ } ;
25+
2026export const GithubPRNumber : Story = {
2127 args : {
2228 uri : "https://github.com/org/repo/pull/1234" ,
@@ -29,6 +35,12 @@ export const GitHubPRNoNumber: Story = {
2935 } ,
3036} ;
3137
38+ export const GitHubNewIssue : Story = {
39+ args : {
40+ uri : "https://github.com/coder/coder/issues/new?template=BLANK_ISSUE" ,
41+ } ,
42+ } ;
43+
3244export const GithubIssueNumber : Story = {
3345 args : {
3446 uri : "https://github.com/org/repo/issues/4321" ,
@@ -70,3 +82,15 @@ export const Long: Story = {
7082 uri : "https://dev.coder.com/this-is-a/long-url/to-test/how-the-truncation/looks" ,
7183 } ,
7284} ;
85+
86+ export const InvalidPathNotRendered : Story = {
87+ args : {
88+ uri : "/path/to/foo" ,
89+ } ,
90+ } ;
91+
92+ export const InvalidRelativePathNotRendered : Story = {
93+ args : {
94+ uri : "path/to/foo" ,
95+ } ,
96+ } ;
Original file line number Diff line number Diff line change @@ -30,15 +30,21 @@ export const TaskStatusLink: FC<TaskStatusLinkProps> = ({ uri }) => {
3030 switch ( type ) {
3131 case "pull" :
3232 icon = < GitPullRequestArrowIcon /> ;
33- label = number
34- ? `${ org } /${ repo } #${ number } `
35- : `${ org } /${ repo } pull request` ;
33+ label =
34+ number === "new"
35+ ? `${ org } /${ repo } open pull request`
36+ : number
37+ ? `${ org } /${ repo } #${ number } `
38+ : `${ org } /${ repo } pull request` ;
3639 break ;
3740 case "issues" :
3841 icon = < BugIcon /> ;
39- label = number
40- ? `${ org } /${ repo } #${ number } `
41- : `${ org } /${ repo } issue` ;
42+ label =
43+ number === "new"
44+ ? `${ org } /${ repo } create new issue`
45+ : number
46+ ? `${ org } /${ repo } #${ number } `
47+ : `${ org } /${ repo } issue` ;
4248 break ;
4349 default :
4450 icon = < ExternalImage src = "/icon/github.svg" /> ;
@@ -52,6 +58,7 @@ export const TaskStatusLink: FC<TaskStatusLinkProps> = ({ uri }) => {
5258 }
5359 } catch ( _error ) {
5460 // Invalid URL, probably.
61+ return null ;
5562 }
5663
5764 return (
You can’t perform that action at this time.
0 commit comments