Skip to content

Commit

Permalink
Help craft the Sankey Title a littel better
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhoads committed Jul 30, 2024
1 parent 9c80ffc commit 83591bf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app/doi.org/[...doi]/RelatedContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ export default function RelatedContent(props: Props) {
partOfCount > 0 ? 'partOf' : 'otherRelated'

const displayedConnectionType = connectionType ? connectionType : defaultConnectionType
//convert camel case to title and make first letter uppercase
//convert connectionType to title, allRelated becomes All Related Wokrs, references becomes References, citations becomes Citations, parts becomes Parts, partOf becomes Part Of, and otherRelated becomes Other Works
const displayedConnectionTitle =
displayedConnectionType === 'allRelated' ? 'All Related Works' :
displayedConnectionType === 'otherRelated' ? 'Other Works' :
displayedConnectionType.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase())




const works: Works = displayedConnectionType in relatedWorks ?
Expand Down Expand Up @@ -101,7 +109,7 @@ export default function RelatedContent(props: Props) {
connectionTypesCounts={connectionTypeCounts}
showAnalytics={true}
showSankey={showSankey}
sankeyTitle={`Contributions to ${displayedConnectionType}`}
sankeyTitle={`Contributions to ${displayedConnectionTitle}`}
showClaimStatus={true}
hasPagination={works.totalCount > 25}
hasNextPage={hasNextPage}
Expand Down

0 comments on commit 83591bf

Please sign in to comment.