Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/datagateway-dataview/public/res/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"techniques": "Techniques",
"samples": "Samples",
"subjects": "Subjects",
"funders": "Funders",
"publisher": "Publisher",
"type": "Type",
"license": "License",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,26 @@ describe('DLS Data Publication Landing page', () => {
},
rightsList: [],
geoLocations: [],
fundingReferences: [],
fundingReferences: [
{
funderName: 'funder 1',
funderIdentifier: null,
funderIdentifierType: null,
schemeUri: null,
awardUri: null,
awardTitle: null,
awardNumber: '',
},
{
funderName: 'funder 2',
funderIdentifier: null,
funderIdentifierType: null,
schemeUri: null,
awardUri: null,
awardTitle: null,
awardNumber: '',
},
],
url: '',
identifiers: [],
creators: [],
Expand Down Expand Up @@ -416,6 +435,8 @@ describe('DLS Data Publication Landing page', () => {

expect(screen.getByText('sample 1, sample 2')).toBeInTheDocument();

expect(screen.getByText('funder 1, funder 2'));

// two citation formatters
expect(
screen.getByText(
Expand All @@ -436,6 +457,7 @@ describe('DLS Data Publication Landing page', () => {
initialData.publicationDate = undefined;
initialData.type = undefined;
initialDataCiteData.attributes.subjects = [];
initialDataCiteData.attributes.fundingReferences = [];
renderComponent();

// displays doi + link correctly
Expand All @@ -453,6 +475,7 @@ describe('DLS Data Publication Landing page', () => {
).toBeNull();
expect(screen.queryByText('datapublications.details.subjects')).toBeNull();
expect(screen.queryByText('datapublications.details.samples')).toBeNull();
expect(screen.queryByText('datapublications.details.funders')).toBeNull();
});

it('renders correctly whilst loading', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ const LandingPage = (props: LandingPageProps): React.ReactElement => {
) ?? [[], [], []],
[dataciteData?.attributes.subjects]
);
const funders =
dataciteData?.attributes.fundingReferences.map((fr) => fr.funderName) ?? [];

const isVersionDOI = data?.relatedItems?.some(
(relatedItem) => relatedItem.relationType === DOIRelationType.IsVersionOf
Expand Down Expand Up @@ -684,6 +686,17 @@ const LandingPage = (props: LandingPageProps): React.ReactElement => {
{subjects.join(', ')}
</div>
)}
{funders.length > 0 && (
<div>
<Subheading
variant="h6"
data-testid="landing-dataPublication-funders-label"
>
{t('datapublications.details.funders')}
</Subheading>
{funders.join(', ')}
</div>
)}

{formattedUsers.length > 0 && (
<div>
Expand Down
Loading