@@ -98,14 +98,14 @@ const sortingAdditionalElement = (content) => {
98
98
}
99
99
const result = [ ] ;
100
100
if ( content . published_in ) {
101
- result . push ( "published in " ) ;
101
+ result . push ( "PUBLISHED IN " ) ;
102
102
}
103
103
if ( content . projects ) {
104
- result . push ( "projects " ) ;
104
+ result . push ( "PROJECTS " ) ;
105
105
}
106
106
if ( content . additional ) {
107
107
content . additional . forEach ( ( ade ) => {
108
- result . push ( ade . attr_name . toLowerCase ( ) ) ;
108
+ result . push ( ade . attr_name . toUpperCase ( ) ) ;
109
109
} ) ;
110
110
}
111
111
return result . sort ( ) ;
@@ -135,36 +135,22 @@ const DatasetDetail = ({
135
135
const additionalDict = { } ;
136
136
if ( content && content . additional ) {
137
137
content . additional . forEach ( ( adt ) => {
138
- additionalDict [ adt . attr_name . toLowerCase ( ) ] = adt . attr_set ;
138
+ additionalDict [ adt . attr_name . toUpperCase ( ) ] = adt . attr_set ;
139
139
} ) ;
140
140
}
141
141
let pocLinks = ! content || content . poc_email === undefined || content . poc_email === null ? "" : content . poc_email ;
142
142
if ( pocLinks ) { pocLinks = pocLinks . split ( ';' ) ; }
143
143
const sortedAdditonals = sortingAdditionalElement ( content ) ;
144
144
const grantIDs = [ ] ;
145
- const grantNames = [ ] ;
146
145
const grants = new Map ( ) ;
147
146
if ( sortedAdditonals ) {
148
- sortedAdditonals . forEach ( ( ad ) => {
149
- if ( ad . toUpperCase ( ) === "GRANT ID" ) {
150
- additionalDict [ ad ] . forEach ( ( item , i ) => {
151
- grantIDs [ i ] = item . k ;
152
- } ) ;
153
- }
154
- if ( ad . toUpperCase ( ) === "GRANT NAME" ) {
155
- additionalDict [ ad ] . forEach ( ( item , i ) => {
156
- grantNames [ i ] = item . k ;
157
- } ) ;
158
- }
159
- } ) ;
160
- }
161
- for ( let i = 0 ; i < grantIDs . length ; i += 1 ) {
162
- if ( grantNames [ i ] === null ) {
163
- grants . set ( grantIDs [ i ] , grantNames [ i - 1 ] ) ;
147
+ if ( sortedAdditonals . includes ( "GRANT ID" ) ) {
148
+ additionalDict [ "GRANT ID" ] . forEach ( ( item , i ) => {
149
+ grantIDs [ i ] = item . k ;
150
+ grants . set ( item . k , additionalDict [ "GRANT NAME" ] [ i ] . k ) ;
151
+ } ) ;
164
152
}
165
- grants . set ( grantIDs [ i ] , grantNames [ i ] ) ;
166
153
}
167
- const sortedGrants = new Map ( [ ...grants ] . sort ( ) ) ;
168
154
useEffect ( ( ) => {
169
155
if ( ! content ) {
170
156
onPageLoadDatasetDetail ( id ) . catch ( error => {
@@ -738,7 +724,7 @@ const DatasetDetail = ({
738
724
{
739
725
sortedAdditonals . map ( ( ad , adIdx ) => {
740
726
const adkey = `ad_${ adIdx } ` ;
741
- if ( ad === "published in " ) {
727
+ if ( ad === "PUBLISHED IN " ) {
742
728
let publishedLinks = content . published_in === undefined || content . published_in === null ? "" : content . published_in ;
743
729
if ( content . published_in ) {
744
730
publishedLinks = publishedLinks . split ( ';' ) ;
@@ -752,15 +738,17 @@ const DatasetDetail = ({
752
738
< >
753
739
< div className = "dataElementLabel" > Published In</ div >
754
740
< div className = "dataElementContentPublished" >
755
- { publishedLinks [ 0 ] ? < a href = { publishedLinks [ 0 ] } className = "dataElementContentPublished" target = "_blank" rel = "noreferrer noopener" > { publishedLinks [ 0 ] } </ a > : null }
756
- < div > { publishedLinks [ 1 ] ? < a href = { publishedLinks [ 1 ] } className = "dataElementContentPublished" target = "_blank" rel = "noreferrer noopener" > { publishedLinks [ 1 ] } </ a > : null } </ div >
757
- < div > { publishedLinks [ 2 ] ? < a href = { publishedLinks [ 2 ] } className = "dataElementContentPublished" target = "_blank" rel = "noreferrer noopener" > { `${ publishedLinks [ 2 ] } ` } </ a > : null } </ div >
758
- { /* <a href={content.published_in} target="_blank" rel="noreferrer noopener">{content.published_in}</a> */ }
741
+ { publishedLinks ? publishedLinks . map ( ( item , idx ) => {
742
+ const key = `sort_${ idx } ` ;
743
+ return (
744
+ < div key = { key } > < a href = { item } className = "dataElementContentPublished" target = "_blank" rel = "noreferrer noopener" > { item } </ a > </ div >
745
+ ) ;
746
+ } ) : null }
759
747
</ div >
760
748
</ >
761
749
) ;
762
750
}
763
- if ( ad === "projects " ) {
751
+ if ( ad === "PROJECTS " ) {
764
752
return (
765
753
< >
766
754
< div className = "dataElementLabel" > Projects</ div >
@@ -790,7 +778,7 @@ const DatasetDetail = ({
790
778
</ >
791
779
) ;
792
780
}
793
- if ( ad . toUpperCase ( ) === "GRANT ID" ) {
781
+ if ( ad === "GRANT ID" ) {
794
782
return (
795
783
< >
796
784
< div className = "dataElementLabel" > Grant Information</ div >
@@ -801,7 +789,7 @@ const DatasetDetail = ({
801
789
< tbody >
802
790
< tr >
803
791
{ item ? < td width = "210px" > < div className = "grantIDDataContainer" > { item } </ div > </ td > : null }
804
- { sortedGrants . get ( item ) ? < td > < div className = "grantNameDataContainer" > { sortedGrants . get ( item ) } </ div > </ td > : null }
792
+ { grants . get ( item ) ? < td > < div className = "grantNameDataContainer" > { grants . get ( item ) } </ div > </ td > : null }
805
793
</ tr >
806
794
</ tbody >
807
795
</ table >
@@ -814,10 +802,10 @@ const DatasetDetail = ({
814
802
return (
815
803
< div >
816
804
< div key = { adkey } className = "dataElementLabel" >
817
- { ad . toUpperCase ( ) === "GRANT ID" || ad . toUpperCase ( ) === "GRANT NAME" ? null : ad . toUpperCase ( ) }
818
- { ad . toUpperCase ( ) === "GRANT ID" || ad . toUpperCase ( ) === "GRANT NAME" ? null : < br /> }
805
+ { ad === "GRANT ID" || ad === "GRANT NAME" ? null : ad }
806
+ { ad === "GRANT ID" || ad === "GRANT NAME" ? null : < br /> }
819
807
{ additionalDict [ ad ] . map ( ( adee , adeeidx ) => {
820
- if ( ad . toUpperCase ( ) !== "GRANT ID" && ad . toUpperCase ( ) !== "GRANT NAME" ) {
808
+ if ( ad !== "GRANT ID" && ad !== "GRANT NAME" ) {
821
809
const adeekey = `adee_${ adeeidx } ` ;
822
810
let additonalText = adee . k === undefined ? "" : adee . k ;
823
811
if ( adee . k ) { additonalText = additonalText . split ( ';' ) ; }
0 commit comments