@@ -2,7 +2,7 @@ import { GitProviderUtils } from '@gitkraken/provider-apis';
2
2
import { useQueryClient } from '@tanstack/react-query' ;
3
3
import React , { useEffect , useMemo , useState } from 'react' ;
4
4
import { storage } from 'webextension-polyfill' ;
5
- import { openGitKrakenDeepLink } from '../../deepLink' ;
5
+ import { getGitKrakenDeepLinkUrl } from '../../deepLink' ;
6
6
import { ProviderMeta } from '../../providers' ;
7
7
import { GKDotDevUrl } from '../../shared' ;
8
8
import type {
@@ -12,6 +12,7 @@ import type {
12
12
} from '../../types' ;
13
13
import { useFocusViewConnectedProviders , useFocusViewDataQuery , usePullRequestDraftCountsQuery } from '../hooks' ;
14
14
import { ConnectAProvider } from './ConnectAProvider' ;
15
+ import { ExternalLink } from './ExternalLink' ;
15
16
16
17
type PullRequestRowProps = {
17
18
userId : string ;
@@ -22,17 +23,17 @@ type PullRequestRowProps = {
22
23
23
24
const PullRequestRow = ( { userId, pullRequest, provider, draftCount = 0 } : PullRequestRowProps ) => {
24
25
const queryClient = useQueryClient ( ) ;
26
+ const deepLinkUrl = getGitKrakenDeepLinkUrl ( provider , pullRequest . url ) ;
25
27
26
28
return (
27
29
< >
28
30
< div className = "pull-request" >
29
31
< div className = "pull-request-title truncate" > { pullRequest . title } </ div >
30
32
< div className = "repository-name text-secondary truncate" > { pullRequest . repository . name } </ div >
31
33
< div className = "pull-request-number" >
32
- < a
34
+ < ExternalLink
33
35
className = "text-link"
34
36
href = { pullRequest . url || undefined }
35
- target = "_blank"
36
37
onClick = { ( ) => {
37
38
// Since there is a decent chance that the PR will be acted upon after the user clicks on it,
38
39
// mark the focus view data as stale so that it will be refetched when the user returns.
@@ -41,32 +42,25 @@ const PullRequestRow = ({ userId, pullRequest, provider, draftCount = 0 }: PullR
41
42
title = { `View pull request on ${ ProviderMeta [ provider ] . name } ` }
42
43
>
43
44
#{ pullRequest . number }
44
- </ a >
45
+ </ ExternalLink >
45
46
</ div >
46
- { pullRequest . url && (
47
- < a
48
- href = "#"
49
- onClick = { ( ) => {
50
- openGitKrakenDeepLink ( provider , pullRequest . url ) ;
51
- } }
52
- title = "Open with GitKraken"
53
- >
47
+ { deepLinkUrl && (
48
+ < ExternalLink href = { deepLinkUrl } title = "Open with GitKraken" >
54
49
< i className = "fa-brands fa-gitkraken icon text-link text-lg" />
55
- </ a >
50
+ </ ExternalLink >
56
51
) }
57
52
</ div >
58
53
{ draftCount > 0 && (
59
- < a
54
+ < ExternalLink
60
55
className = "pr-drafts-badge text-disabled"
61
56
href = { `${ GKDotDevUrl } /drafts/suggested-change/${ encodeURIComponent (
62
57
btoa ( pullRequest . uniqueId ) ,
63
58
) } ?source=browserExtension`}
64
- target = "_blank"
65
59
title = { `View code suggestion${ draftCount === 1 ? '' : 's' } on gitkraken.dev` }
66
60
>
67
61
< i className = "fa-regular fa-message-code icon" />
68
62
Code Suggestion{ draftCount === 1 ? '' : 's' }
69
- </ a >
63
+ </ ExternalLink >
70
64
) }
71
65
</ >
72
66
) ;
0 commit comments