Commit 064184d 1 parent 308c937 commit 064184d Copy full SHA for 064184d
File tree 2 files changed +27
-6
lines changed
src/main/webapp/app/oncokb-frontend-commons/src
2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 1
1
import Tooltip from 'rc-tooltip' ;
2
- import { getNCBIlink } from '../lib/urls' ;
2
+ import { getNCBIlink , getNCTlink } from '../lib/urls' ;
3
3
import * as React from 'react' ;
4
4
5
5
import { ReferenceList } from './ReferenceList' ;
@@ -50,11 +50,6 @@ export default class RefComponent extends React.Component<{
50
50
51
51
if ( this . props . content . toLowerCase ( ) . includes ( 'pmid' ) ) {
52
52
prefix = 'PMID: ' ;
53
- } else if ( this . props . content . toLowerCase ( ) . includes ( 'nct' ) ) {
54
- prefix = 'NCT' ;
55
- }
56
-
57
- if ( prefix ) {
58
53
link = (
59
54
< a
60
55
target = "_blank"
@@ -64,6 +59,20 @@ export default class RefComponent extends React.Component<{
64
59
{ `${ prefix } ${ ids . join ( ', ' ) } ` }
65
60
</ a >
66
61
) ;
62
+ } else if ( this . props . content . toLowerCase ( ) . includes ( 'nct' ) ) {
63
+ if ( ids [ 0 ] ) {
64
+ prefix = 'NCT' ;
65
+ const studyId = `${ prefix } ${ ids [ 0 ] } ` ;
66
+ link = (
67
+ < a
68
+ target = "_blank"
69
+ rel = "noopener noreferrer"
70
+ href = { getNCTlink ( `/study/${ studyId } ` ) }
71
+ >
72
+ { studyId }
73
+ </ a >
74
+ ) ;
75
+ }
67
76
}
68
77
}
69
78
Original file line number Diff line number Diff line change @@ -23,3 +23,15 @@ export function getNCBIlink(
23
23
...params ,
24
24
} ) ;
25
25
}
26
+
27
+ export function getNCTlink ( pathnameOrParams ?: BuildUrlParams | string ) : string {
28
+ const params =
29
+ typeof pathnameOrParams === 'string'
30
+ ? { pathname : pathnameOrParams }
31
+ : pathnameOrParams ;
32
+ return URL . format ( {
33
+ protocol : 'https' ,
34
+ host : 'www.clinicaltrials.gov' ,
35
+ ...params ,
36
+ } ) ;
37
+ }
You can’t perform that action at this time.
0 commit comments