Skip to content

Commit

Permalink
Merge pull request #477 from AlexsLemonade/davidsmejia/455-display-ex…
Browse files Browse the repository at this point in the history
…ternal-accessions

add support for displaying external accessions
  • Loading branch information
davidsmejia authored Nov 13, 2023
2 parents df82d5c + 4a8df46 commit 7193ab4
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 3 deletions.
27 changes: 27 additions & 0 deletions client/src/components/ProjectExternalAccessionsDetail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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>
))
}

// 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
2 changes: 1 addition & 1 deletion client/src/components/ProjectPublicationsDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { Box, Text } from 'grommet'
import { Link } from 'components/Link'

export const ProjectPublicationsDetail = ({ publications }) => (
export const ProjectPublicationsDetail = ({ publications = [] }) => (
<>
{publications.map((publication, i) => (
<Box key={publication.doi} margin={{ top: i ? 'small' : 'none' }}>
Expand Down
15 changes: 14 additions & 1 deletion 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,18 @@ 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 All @@ -41,7 +54,7 @@ export const ProjectSearchResult = ({ project }) => {
<Text>{d.value}</Text>
) : (
<Text italic color="black-tint-30">
Not Available
Not Specified
</Text>
)}
</Box>
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
1 change: 0 additions & 1 deletion client/src/theme/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default {
tr td, tr th {
background-color: #fff;
box-shadow: 1px 0 0 0 #ccc inset, 0 1px 0 0 #ccc inset;
vertical-align: middle;
}
tr th {
box-shadow: 1px 0 0 0 #ccc inset,
Expand Down

0 comments on commit 7193ab4

Please sign in to comment.