Skip to content

Commit

Permalink
add support for displaying external accessions
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsmejia committed Nov 10, 2023
1 parent 1071b5b commit 39b8581
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
25 changes: 25 additions & 0 deletions client/src/components/ProjectExternalAccessionsDetail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react'
import { Box } from 'grommet'
import { Link } from 'components/Link'

export const ProjectExternalAccessionsDetail = ({ inline = false, externalAccessions }) => {

// Comma separated list.
if (inline) {
return externalAccessions.map(({ accession, url }, i) => (
<React.Fragment key={accession}>
{i != 0 && ', '}
<Link label={accession} href={url} />
</React.Fragment>

Check failure on line 13 in client/src/components/ProjectExternalAccessionsDetail.js

View workflow job for this annotation

GitHub Actions / ESLint

client/src/components/ProjectExternalAccessionsDetail.js#L13

Expected '!==' and instead saw '!=' (eqeqeq)
))
}

// One external accession per line.
return externalAccessions.map(({ accession, url }, i) => (
<Box key={accession} margin={{ top: i ? 'small' : 'none' }}>
<Link label={accession} href={url} />
</Box>
))
}

export default ProjectExternalAccessionsDetail
9 changes: 9 additions & 0 deletions client/src/components/ProjectSearchResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Link } from 'components/Link'
import { ProjectHeader } from 'components/ProjectHeader'
import { ProjectAbstractDetail } from 'components/ProjectAbstractDetail'
import { ProjectPublicationsDetail } from 'components/ProjectPublicationsDetail'
import { ProjectExternalAccessionsDetail } from 'components/ProjectExternalAccessionsDetail'

export const ProjectSearchResult = ({ project }) => {
const searchDetails = [
Expand All @@ -25,6 +26,14 @@ export const ProjectSearchResult = ({ project }) => {
''
)
},
{
title: 'Also deposited under',
value: project.external_accessions.length > 0 ? (
<ProjectExternalAccessionsDetail inline externalAccessions={project.external_accessions} />
) : (
''
)
},
{
title: 'Additional Sample Metadata Fields',
value: project.additional_metadata_keys
Expand Down
12 changes: 12 additions & 0 deletions client/src/pages/projects/[scpca_id].js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ProjectHeader } from 'components/ProjectHeader'
import { DetailsTable } from 'components/DetailsTable'
import { ProjectAbstractDetail } from 'components/ProjectAbstractDetail'
import { ProjectPublicationsDetail } from 'components/ProjectPublicationsDetail'
import { ProjectExternalAccessionsDetail } from 'components/ProjectExternalAccessionsDetail'
import { ProjectSamplesTable } from 'components/ProjectSamplesTable'
import { ProjectSamplesSummaryTable } from 'components/ProjectSamplesSummaryTable'
import { Link } from 'components/Link'
Expand Down Expand Up @@ -49,6 +50,17 @@ const Project = ({ project }) => {
''
)
},
{
label: 'Also deposited under',
value:
project.external_accessions.length > 0 ? (
<ProjectExternalAccessionsDetail
externalAccessions={project.external_accessions}
/>
) : (
''
)
},
{
label: 'DOI',
value:
Expand Down

0 comments on commit 39b8581

Please sign in to comment.