diff --git a/cypress/e2e/Consultation/PageStudy_2.cy.ts b/cypress/e2e/Consultation/PageStudy_2.cy.ts index e74eeb02..80aaa213 100644 --- a/cypress/e2e/Consultation/PageStudy_2.cy.ts +++ b/cypress/e2e/Consultation/PageStudy_2.cy.ts @@ -20,11 +20,18 @@ describe('Page d\'une étude - Vérifier les informations affichées', () => { cy.get('button[class*="SummaryHeader_item"]').eq(2).contains(/\d{1}/); cy.get('button[class*="SummaryHeader_item"]').eq(2).contains('Files'); cy.get('[id="summary"] [class="ant-collapse-header"]').contains('Summary').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(0).contains('Study Code').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(0).contains('Study Name').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(0).contains('The Human Trisome Project').should('exist'); cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(0).contains('HTP').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(1).contains('Study Name').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(1).contains('The Human Trisome Project').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(1).find('[class*="ant-tag-green"]').contains('Harmonized').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(0).find('[class*="studyNameTag"]').contains('Harmonized').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(1).contains('Clinical Trial Registry ID').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(1).contains('NCT04048759').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(1).find('[class="ant-tag"]').contains('Prevention').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(1).find('[class="ant-tag"]').contains('Not Applicable').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(1).find('[class="ant-tag"]:contains("Prevention")').trigger('mouseover', {eventConstructor: 'MouseEvent', force: true}); + cy.get('div[class="ant-tooltip-inner"]').contains('Primary Purpose').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(1).find('[class="ant-tag"]:contains("Not Applicable")').trigger('mouseover', {eventConstructor: 'MouseEvent', force: true}); + cy.get('div[class="ant-tooltip-inner"]').contains('Trial Phase').should('exist'); cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(2).contains('Program').should('exist'); cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(2).contains('INCLUDE').should('exist'); cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(3).contains('dbGaP Accession Number').should('exist'); @@ -32,72 +39,59 @@ describe('Page d\'une étude - Vérifier les informations affichées', () => { cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(3).contains('phs002981').should('exist'); cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(4).contains('GUID Available').should('exist'); cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(4).find('[class*="ant-tag-green"]').contains('True').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(5).contains('Participant Lifespan').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(5).find('[class*="ant-tag-cyan"]').contains('Pediatric').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(5).find('[class*="ant-tag-cyan"]').contains('Adult').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(6).contains('Description').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(6).contains('The Human Trisome Project (HTP) is a large and comprehensive natural history study of Down syndrome involving collection of deep clinical data, multimodal phenotyping, a multi-dimensional biobank, generation of pan-omics datasets, and rapid release of data. The HTP has enabled many discoveries about the pathophysiology of Down syndrome, leading to new clinical trials testing therapies to improve diverse health outcomes in this population.').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(7).contains('Research Domain').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(7).contains('All Co-occurring Conditions').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(8).contains('Clinical Data Source Type').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(8).contains('Investigator Assessment, Medical Record, Participant or Caregiver Report').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(9).contains('Data Category').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(9).contains('Imaging, Harmonized Demographic/Clinical Data, Genomics, Proteomics, Metabolomics, Transcriptomics, Unharmonized Demographic/Clinical Data, Microbiome').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(10).contains('Selection Criteria').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).contains('Ages 6 months to 89 years old, with or without Down syndrome').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(11).contains('Study Design').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(11).contains('longitudinal').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(12).contains('Study Website').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(12).contains('https://www.trisome.org').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(13).contains('Publication').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(0).contains('Donovan'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(0).contains(','); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(0).contains('Micah G'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(1).contains('et al.'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(2).contains(' "'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(2).contains('Variegated overexpression of chromosome 21 genes reveals molecular and immune subtypes of Down syndrome'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(2).contains('"'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(3).find('i').contains('Nat Commun'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(4).contains('vol.'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(4).contains('15'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(5).contains(','); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(5).contains('1'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(6).contains('('); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(6).contains('2024'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(6).contains('):'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(7).contains('5473'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(7).contains('.'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(8).contains('doi:'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(8).contains('10.1038/s41467-024-49781-1'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(8).contains('.'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(9).contains('PMID:'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(9).contains('38942750'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[class="ant-typography"]').eq(9).contains('.'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[data-icon="copy"]').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[data-icon="copy"]').trigger('mouseover', {eventConstructor: 'MouseEvent', force: true}); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(5).contains('Description').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(5).contains('The Human Trisome Project (HTP) is a large and comprehensive natural history study of Down syndrome involving collection of deep clinical data, multimodal phenotyping, a multi-dimensional biobank, generation of pan-omics datasets, and rapid release of data. The HTP has enabled many discoveries about the pathophysiology of Down syndrome, leading to new clinical trials testing therapies to improve diverse health outcomes in this population.').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(5).contains('See more').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(6).contains('Research Domain').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(6).contains('All Co-occurring Conditions').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(7).contains('Clinical Data Source Type').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(7).contains('Investigator Assessment, Medical Record, Participant or Caregiver Report').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(8).contains('Data Category').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(8).contains('Imaging, Harmonized Demographic/Clinical Data, Genomics, Proteomics, Metabolomics, Transcriptomics, Unharmonized Demographic/Clinical Data, Microbiome').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(9).contains('Study Design').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(9).contains('longitudinal').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(10).contains('Publication').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(0).contains('Donovan'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(0).contains(','); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(0).contains('Micah G'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(1).contains('et al.'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(2).contains(' "'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(2).contains('Variegated overexpression of chromosome 21 genes reveals molecular and immune subtypes of Down syndrome'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(2).contains('"'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(3).find('i').contains('Nat Commun'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(4).contains('vol.'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(4).contains('15'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(5).contains(','); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(5).contains('1'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(6).contains('('); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(6).contains('2024'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(6).contains('):'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(7).contains('5473'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(7).contains('.'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(8).contains('doi:'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(8).contains('10.1038/s41467-024-49781-1'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(8).contains('.'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(9).contains('PMID:'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(9).contains('38942750'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[class="ant-typography"]').eq(9).contains('.'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[data-icon="copy"]').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[data-icon="copy"]').trigger('mouseover', {eventConstructor: 'MouseEvent', force: true}); cy.get('div[class="ant-tooltip-inner"]').contains('Copy citation').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).contains('See more').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(14).contains('DOI Citation').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(14).contains('Espinosa J. The Human Trisome Project [Internet]. The INCLUDE Data Coordinating Center; 2022.').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(14).contains('https://doi.org/10.71738/p0a9-2v09.').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(14).find('[data-icon="copy"]').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(14).find('[data-icon="copy"]').trigger('mouseover', {eventConstructor: 'MouseEvent', force: true}); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).contains('See more').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(11).contains('DOI Citation').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(11).contains('Espinosa J. The Human Trisome Project [Internet]. The INCLUDE Data Coordinating Center; 2022.').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(11).contains('https://doi.org/10.71738/p0a9-2v09.').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(11).find('[data-icon="copy"]').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(11).find('[data-icon="copy"]').trigger('mouseover', {eventConstructor: 'MouseEvent', force: true}); cy.get('div[class="ant-tooltip-inner"]').contains('Copy DOI Citation').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(15).contains('Principal Investigator').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(15).contains('Joaquin M. Espinosa').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(16).contains('Institution').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(16).contains('Linda Crnic Institute for Down Syndrome').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(17).contains('Study Contact').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(17).contains('Virtual Biorepository Contact; dsresearch@cuanschutz.edu').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(17).contains('Angela Rachubinski; dsresearch@cuanschutz.edu').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(18).contains('Virtual Biorepository Email').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(18).contains('dsresearch@cuanschutz.edu').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(19).contains('Virtual Biorepository URL').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(19).contains('https://redcap.link/HTPVBRrequest').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(20).contains('Citation Statement').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(20).contains('Citation Statement').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(21).contains('Acknowledgement').should('exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(21).contains('Acknowledgement').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(12).contains('Principal Investigator').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(12).contains('Joaquin M. Espinosa').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(13).contains('Institution').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).contains('Linda Crnic Institute for Down Syndrome').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(14).contains('Citation Statement').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(14).contains('A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. This is the end of the Citation Statement text.').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-label"]').eq(15).contains('Acknowledgement').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(15).contains('A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. This is the end of the Acknowledgement text.').should('exist'); }); it('Panneau Statistic', () => { @@ -115,6 +109,15 @@ describe('Page d\'une étude - Vérifier les informations affichées', () => { cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(1).contains('genetic studies only').should('exist'); cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(1).contains('DUO:').should('exist'); cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(1).contains('0000016').should('exist'); + cy.get('[id="data_access"] [class="ant-descriptions-item-label"]').eq(2).contains('Study Contact').should('exist'); + cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(2).contains('Virtual Biorepository Contact; dsresearch@cuanschutz.edu').should('exist'); + cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(2).contains('Angela Rachubinski; dsresearch@cuanschutz.edu').should('exist'); + cy.get('[id="data_access"] [class="ant-descriptions-item-label"]').eq(3).contains('Study Website').should('exist'); + cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(3).contains('https://www.trisome.org').should('exist'); + cy.get('[id="data_access"] [class="ant-descriptions-item-label"]').eq(4).contains('Virtual Biorepository Email').should('exist'); + cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(4).contains('dsresearch@cuanschutz.edu').should('exist'); + cy.get('[id="data_access"] [class="ant-descriptions-item-label"]').eq(5).contains('Virtual Biorepository URL').should('exist'); + cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(5).contains('https://redcap.link/HTPVBRrequest').should('exist'); }); it('Panneau HTP Whole Blood RNAseq (2020)', () => { diff --git a/cypress/e2e/Consultation/PageStudy_3.cy.ts b/cypress/e2e/Consultation/PageStudy_3.cy.ts index ac4d4015..5544b549 100644 --- a/cypress/e2e/Consultation/PageStudy_3.cy.ts +++ b/cypress/e2e/Consultation/PageStudy_3.cy.ts @@ -11,44 +11,46 @@ beforeEach(() => { }); describe('Page d\'une étude - Valider les liens disponibles', () => { - it('Lien dbGaP du panneau Summary', () => { - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(3).invoke('text').then((invokeText) => { - if (!invokeText.includes('-')) { - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(3).find('[href]') - .should('have.attr', 'href').and('match', /https:\/\/www\.ncbi\.nlm\.nih\.gov\/projects\/gap\/cgi-bin\/study\.cgi\?study_id\=phs002981/); - }; - }); + it('Lien Clinical Trial du panneau Summary', () => { + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(1).find('[href]') + .should('have.attr', 'href').and('match', /http:\/\/clinicaltrials.gov\/study\/NCT04048759/); }); - it('Lien Study Website du panneau Summary', () => { - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(12).find('[href]') - .should('have.attr', 'href').and('match', /https:\/\/www.trisome.org/); + it('Lien \'See more\' de Description du panneau Summary', () => { + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(5).contains('See more').clickAndWait({force: true}); + cy.get('[id="summary"] [class="ant-descriptions-item-content"] [style*="webkit-line-clamp: unset"]').contains('The Human Trisome Project (HTP)').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(5).contains('See less').clickAndWait({force: true}); + cy.get('[id="summary"] [class="ant-descriptions-item-content"] [style*="webkit-line-clamp: 2"]').contains('The Human Trisome Project (HTP)').should('exist'); }); it('Lien Publication du panneau Summary', () => { - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[href]') + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).find('[href]') .should('have.attr', 'href').and('match', /https:\/\/pubmed.ncbi.nlm.nih.gov\/38942750(|\/)/); }); it('Lien \'See more\' de Publication du panneau Summary', () => { cy.get('[class*="PubModal_modalWrapper"]').should('not.exist'); - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).contains('See more').clickAndWait({force: true}); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(10).contains('See more').clickAndWait({force: true}); cy.get('[class*="PubModal_modalWrapper"]').should('exist'); }); it('Lien DOI Citation du panneau Summary', () => { - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(14).find('[href]') + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(11).find('[href]') .should('have.attr', 'href').and('match', /https:\/\/doi.org\/10.71738\/p0a9-2v09/); }); - it('Lien Virtual Biorepository Email du panneau Summary', () => { - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(18).find('[href]') - .should('have.attr', 'href', 'mailto:dsresearch@cuanschutz.edu'); + it('Lien \'See more\' de Citation Statement du panneau Summary', () => { + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(14).contains('See more').clickAndWait({force: true}); + cy.get('[id="summary"] [class="ant-descriptions-item-content"] [style*="webkit-line-clamp: unset"]').contains('This is the end of the Citation Statement text.').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(14).contains('See less').clickAndWait({force: true}); + cy.get('[id="summary"] [class="ant-descriptions-item-content"] [style*="webkit-line-clamp: 2"]').contains('This is the end of the Citation Statement text.').should('exist'); }); - it('Lien Virtual Biorepository URL du panneau Summary', () => { - cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(19).find('[href]') - .should('have.attr', 'href', 'https://redcap.link/HTPVBRrequest'); + it('Lien \'See more\' de Acknowledgement du panneau Summary', () => { + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(15).contains('See more').clickAndWait({force: true}); + cy.get('[id="summary"] [class="ant-descriptions-item-content"] [style*="webkit-line-clamp: unset"]').contains('This is the end of the Acknowledgement text.').should('exist'); + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(15).contains('See less').clickAndWait({force: true}); + cy.get('[id="summary"] [class="ant-descriptions-item-content"] [style*="webkit-line-clamp: 2"]').contains('This is the end of the Acknowledgement text.').should('exist'); }); it('Lien Duo de l\'Access Limitation du panneau Data Access', () => { @@ -56,6 +58,21 @@ describe('Page d\'une étude - Valider les liens disponibles', () => { .should('have.attr', 'href', 'http://purl.obolibrary.org/obo/DUO_0000042'); }); + it('Lien Study Website du panneau Data Access', () => { + cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(3).find('[href]') + .should('have.attr', 'href').and('match', /https:\/\/www.trisome.org/); + }); + + it('Lien Virtual Biorepository Email du panneau Data Access', () => { + cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(4).find('[href]') + .should('have.attr', 'href', 'mailto:dsresearch@cuanschutz.edu'); + }); + + it('Lien Virtual Biorepository URL du panneau Data Access', () => { + cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(5).find('[href]') + .should('have.attr', 'href', 'https://redcap.link/HTPVBRrequest'); + }); + it('Lien DataExploration du panneau HTP Whole Blood RNAseq (2020)', () => { cy.get('[id="HTP-RNAseq-WholeBlood-2020"] [class="ant-collapse-extra"] button').eq(0).clickAndWait({force: true}); cy.get('[class*="DataFiles_dataFilesTabWrapper"]').should('exist'); // data-cy="ProTable_Participants" diff --git a/cypress/e2e/ManifestButton/PageDataExploration_3.cy.ts b/cypress/e2e/ManifestButton/PageDataExploration_3.cy.ts index 773606a2..ee1164db 100644 --- a/cypress/e2e/ManifestButton/PageDataExploration_3.cy.ts +++ b/cypress/e2e/ManifestButton/PageDataExploration_3.cy.ts @@ -30,7 +30,7 @@ describe('Page Data Exploration (Data Files) - Api', () => { }); }); - it('Valider la réponse reçue - Bouton Manifest [SJIP-1520]', () => { + it.skip('Valider la réponse reçue - Bouton Manifest [SJIP-1520]', () => { cy.fixture('RequestBody/FileManifestStats.json').then((mockRequestBody) => { cy.intercept('POST', '**/reports/file-manifest/stats', (req) => { req.alias = 'postStats'; diff --git a/cypress/fixtures/ResponseBody/StudyEntity.json b/cypress/fixtures/ResponseBody/StudyEntity.json index 237458a0..231d0a9d 100644 --- a/cypress/fixtures/ResponseBody/StudyEntity.json +++ b/cypress/fixtures/ResponseBody/StudyEntity.json @@ -10,11 +10,46 @@ "study_id": "HTP", "study_code": "HTP", "study_name": "The Human Trisome Project", - "acknowledgement": "Acknowledgement", + "acknowledgement": "A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. This is the end of the Acknowledgement text.", "biobank_contact": "dsresearch@cuanschutz.edu", "biobank_request_link": "https://redcap.link/HTPVBRrequest", "biospecimen_count": 58049, - "citation_statement": "Citation Statement", + "citation_statement": "A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. A very long text to display the SeeMore button. This is the end of the Citation Statement text.", + "clinical_trials": { + "hits": { + "edges": [ + { + "node": { + "arm_allocation": "Randomized", + "arm_information": "Other: Remote Low", + "intervention": "Remote Low (Participants will attend 40 min remotely delivered group MVPA sessions once a week, receive a step counter, access to resources for increasing MVPA, and one 20-min remotely delivered individual support/education session/wk)", + "intervention_assignment_strategy": "Parallel", + "intervention_types": [ + "Behavioral" + ], + "primary_outcome_measures": [ + "Minutes of Moderate to Vigorous Physical Activity (MVPA) per day" + ], + "primary_purpose": "Prevention", + "registry_id": "NCT04048759", + "secondary_outcome_measures": [ + "Cognitive function", + "Cardiovascular fitness", + "Change in quality of life", + "Brain volume", + "Functional connectivity", + "Cerebral blood flow", + "Retention", + "Session attendance", + "Use of recorded exercise sessions", + "Reported Serious Adverse Events" + ], + "trial_phase": "Not Applicable" + } + } + ] + } + }, "contacts": { "hits": { "total": 2, diff --git a/package-lock.json b/package-lock.json index 3521e6b9..afc35dcc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@apollo/client": "^3.13.8", "@dnd-kit/core": "^4.0.3", "@dnd-kit/sortable": "^5.1.0", - "@ferlab/ui": "^10.35.2", + "@ferlab/ui": "^10.35.3", "@loadable/component": "^5.16.4", "@react-keycloak/core": "^3.2.0", "@react-keycloak/web": "^3.4.0", @@ -3272,9 +3272,9 @@ } }, "node_modules/@ferlab/ui": { - "version": "10.35.2", - "resolved": "https://registry.npmjs.org/@ferlab/ui/-/ui-10.35.2.tgz", - "integrity": "sha512-DOppWMKG7MGbSxvCoMX20+atDZgAqThth75xOWMIU/dTUOmF4Y1W95stTpnPN6z8zgbVnML0I+oCgE2PXK2vvA==", + "version": "10.35.3", + "resolved": "https://registry.npmjs.org/@ferlab/ui/-/ui-10.35.3.tgz", + "integrity": "sha512-c2BAkpla1+Mr+3icO2YwIydCCvIgJVbLaoqWP73voyDPDdJN0+LqooQWwKoZpTphKZzbN1zcyqkID0nIoJzdZg==", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@ant-design/icons": "^4.8.3", @@ -7658,7 +7658,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dev": true, "license": "MIT", "dependencies": { "clean-stack": "^2.0.0", @@ -9497,7 +9496,6 @@ "version": "4.4.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz", "integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==", - "devOptional": true, "funding": [ { "type": "github", @@ -9545,7 +9543,6 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -15770,7 +15767,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", - "dev": true, "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" @@ -15783,7 +15779,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "license": "ISC", "dependencies": { "yallist": "^4.0.0" @@ -15796,7 +15791,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, "license": "ISC" }, "node_modules/hpack.js": { @@ -16314,7 +16308,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "dev": true, "license": "ISC", "engines": { "node": ">=10" @@ -23330,7 +23323,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", - "dev": true, "license": "MIT", "dependencies": { "aggregate-error": "^3.0.0" @@ -30710,14 +30702,12 @@ "version": "2.5.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", - "dev": true, "license": "CC-BY-3.0" }, "node_modules/spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, "license": "MIT", "dependencies": { "spdx-exceptions": "^2.1.0", @@ -30728,7 +30718,6 @@ "version": "3.0.23", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.23.tgz", "integrity": "sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==", - "dev": true, "license": "CC0-1.0" }, "node_modules/spdy": { diff --git a/package.json b/package.json index eb931ff3..eb519836 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@apollo/client": "^3.13.8", "@dnd-kit/core": "^4.0.3", "@dnd-kit/sortable": "^5.1.0", - "@ferlab/ui": "^10.35.2", + "@ferlab/ui": "^10.35.3", "@loadable/component": "^5.16.4", "@react-keycloak/core": "^3.2.0", "@react-keycloak/web": "^3.4.0", diff --git a/src/components/ExpandableText/index.module.css b/src/components/ExpandableText/index.module.css new file mode 100644 index 00000000..091aa1bc --- /dev/null +++ b/src/components/ExpandableText/index.module.css @@ -0,0 +1,35 @@ +.container { + position: relative; +} + +.text { + line-height: 1.5; + word-wrap: break-word; + overflow-wrap: break-word; +} + +.text.clamped { + display: -webkit-box; + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; +} + +.hiddenText { + position: absolute; + top: -9999px; + left: -9999px; + width: 100%; + visibility: hidden; + pointer-events: none; + line-height: 1.5; + word-wrap: break-word; + overflow-wrap: break-word; +} + +.toggleButton { + padding: 0; + margin-top: 8px; + height: auto; + font-size: 12px; +} diff --git a/src/components/ExpandableText/index.tsx b/src/components/ExpandableText/index.tsx new file mode 100644 index 00000000..18472fdc --- /dev/null +++ b/src/components/ExpandableText/index.tsx @@ -0,0 +1,73 @@ +import React, { useEffect, useRef, useState } from 'react'; +import intl from 'react-intl-universal'; +import { Button } from 'antd'; + +import styles from './index.module.css'; + +interface ExpandableTextProps { + text: string; + maxLines?: number; + className?: string; +} + +const ExpandableText: React.FC = ({ text, maxLines = 2, className = '' }) => { + const [isExpanded, setIsExpanded] = useState(false); + const [isOverflowing, setIsOverflowing] = useState(false); + const textRef = useRef(null); + const hiddenTextRef = useRef(null); + + useEffect(() => { + const checkOverflow = () => { + if (textRef.current && hiddenTextRef.current) { + const lineHeight = parseInt(window.getComputedStyle(textRef.current).lineHeight); + const maxHeight = lineHeight * maxLines; + const actualHeight = hiddenTextRef.current.scrollHeight; + + setIsOverflowing(actualHeight > maxHeight); + } + }; + + checkOverflow(); + window.addEventListener('resize', checkOverflow); + + return () => { + window.removeEventListener('resize', checkOverflow); + }; + }, [text, maxLines]); + + const handleToggle = (event: React.MouseEvent) => { + setIsExpanded(!isExpanded); + event.currentTarget.blur(); + }; + + if (!text) { + return null; + } + + return ( +
+
+ {text} +
+ + + + {isOverflowing && ( + + )} +
+ ); +}; + +export default ExpandableText; diff --git a/src/graphql/models.ts b/src/graphql/models.ts index 44f34dab..cd67f67f 100644 --- a/src/graphql/models.ts +++ b/src/graphql/models.ts @@ -73,4 +73,4 @@ export interface IQueryResults { data: T; loading: boolean; total: number; -} \ No newline at end of file +} diff --git a/src/graphql/studies/models.ts b/src/graphql/studies/models.ts index e6c683ff..42f06385 100644 --- a/src/graphql/studies/models.ts +++ b/src/graphql/studies/models.ts @@ -84,6 +84,20 @@ export interface IContact { name?: string; } +export interface IClinicalTrial { + id: string; + arm_allocation?: string; + arm_information?: string; + intervention?: string; + intervention_assignment_strategy?: string; + intervention_types?: string[]; + primary_outcome_measures?: string[]; + primary_purpose?: string; + registry_id?: string; + secondary_outcome_measures?: string[]; + trial_phase?: string; +} + export interface IStudyEntity { id: string; study_id: string; @@ -94,6 +108,7 @@ export interface IStudyEntity { biobank_request_link?: string; biospecimen_count: number; citation_statement?: string; + clinical_trials?: ArrangerResultsTree; contacts?: ArrangerResultsTree; controlled_access?: string[]; data_category: string[]; diff --git a/src/graphql/studies/queries.ts b/src/graphql/studies/queries.ts index a648ca0a..9c0349ab 100644 --- a/src/graphql/studies/queries.ts +++ b/src/graphql/studies/queries.ts @@ -73,6 +73,24 @@ export const GET_STUDY = gql` biobank_request_link biospecimen_count citation_statement + clinical_trials { + hits { + edges { + node { + arm_allocation + arm_information + intervention + intervention_assignment_strategy + intervention_types + primary_outcome_measures + primary_purpose + registry_id + secondary_outcome_measures + trial_phase + } + } + } + } contacts { hits { total diff --git a/src/locales/en.ts b/src/locales/en.ts index 17038cbc..7de8cd8a 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -34,6 +34,8 @@ const en = { pleaseDescribe: 'Please describe', connect: 'Connect', viewInExploration: 'View in exploration', + seeMore: 'See more', + seeLess: 'See less', search: { genes: { emptyText: 'No gene found', @@ -2241,6 +2243,12 @@ const en = { }, acknowledgement: 'Acknowledgement', citation_statement: 'Citation Statement', + clinical_trials: { + primary_purpose: 'Primary Purpose', + registry_id: 'Clinical Trial Registry ID', + tag: 'Clinical Trial', + trial_phase: 'Trial Phase', + }, code: 'Code', count: '{count, plural, =0 {Study} =1 {Study} other {Studies}}', dataset: { @@ -2346,6 +2354,7 @@ const en = { selection_criteria: 'Selection Criteria', study: 'Study', study_code: 'Study Code', + study_code_tooltip: 'Study code', study_contact: 'Study Contact', study_design: 'Study Design', study_designs_table: 'Design', diff --git a/src/locales/es.ts b/src/locales/es.ts index 5f5afc70..3f7ec5dc 100644 --- a/src/locales/es.ts +++ b/src/locales/es.ts @@ -33,6 +33,8 @@ const es = { pleaseDescribe: 'Por favor, describa', connect: 'Conectar', viewInExploration: 'Ver en exploración', + seeMore: 'Ver más', + seeLess: 'Ver menos', search: { genes: { emptyText: 'No se encontró ningún gen', @@ -2192,6 +2194,12 @@ const es = { }, acknowledgement: 'Reconocimiento', citation_statement: 'Declaración de citación', + clinical_trials: { + primary_purpose: 'Propósito principal', + registry_id: 'ID del registro de ensayo clínico', + tag: 'Ensayo clínico', + trial_phase: 'Fase del ensayo', + }, code: 'Código', count: '{count, plural, =0 {Estudio} =1 {Estudio} other {Estudios}}', dataset: { @@ -2297,6 +2305,7 @@ const es = { selection_criteria: 'Criterios de selección', study: 'Estudio', study_code: 'Código de estudio', + study_code_tooltip: 'Código de estudio', study_contact: 'Contacto de estudio', study_design: 'Diseño de estudio', study_designs_table: 'Diseño', diff --git a/src/views/PublicStudyEntity/index.tsx b/src/views/PublicStudyEntity/index.tsx index 8c83e173..6d92bcb4 100644 --- a/src/views/PublicStudyEntity/index.tsx +++ b/src/views/PublicStudyEntity/index.tsx @@ -109,7 +109,14 @@ const PublicStudyEntity = () => { const flatDataset = getFlatDataset(studyData?.datasets); const hasDataAccess = - flatDataset?.accessLimitations.size || flatDataset?.accessRequirements.size ? true : false; + flatDataset?.accessLimitations.size || + flatDataset?.accessRequirements.size || + (studyData?.contacts?.length ?? 0) > 0 || + studyData?.study_websites?.length || + studyData?.biobank_contact || + studyData?.biobank_request_link + ? true + : false; const hasFiles = (studyData?.file_count ?? 0) > 0; @@ -193,6 +200,11 @@ const PublicStudyEntity = () => { loading={loadingData} logo={getLogoByStudyCode(studyData?.study_code)} title={studyData?.study_name} + titleTags={ + studyData?.study_designs?.includes('Clinical Trial') ? ( + {intl.get('entities.study.clinical_trials.tag')} + ) : undefined + } /> { {hasDataAccess && ( { const flatDataset = getFlatDataset(study?.datasets); const hasDataAccess = - flatDataset?.accessLimitations.size || flatDataset?.accessRequirements.size ? true : false; + flatDataset?.accessLimitations.size || + flatDataset?.accessRequirements.size || + (study?.contacts?.hits?.edges?.length ?? 0) > 0 || + study?.study_websites?.length || + study?.biobank_contact || + study?.biobank_request_link + ? true + : false; const hasFiles = (study?.file_count ?? 0) > 0; @@ -419,6 +426,11 @@ const StudyEntity = () => { loading={loading} logo={getLogoByStudyCode(study?.study_code)} title={study?.study_name} + titleTags={ + study?.study_designs?.includes('Clinical Trial') ? ( + {intl.get('entities.study.clinical_trials.tag')} + ) : undefined + } /> { {hasDataAccess && ( ; @@ -52,19 +56,87 @@ const renderAccess = (data?: Set): ReactNode => { return <>{formattedData}; }; -const getDataAccessDescriptions = (flatDataset?: TFlatDataset): IEntityDescriptionsItem[] => [ - { +interface IGetDataAccessDescriptions { + flatDataset?: TFlatDataset; + study?: IStudyEntity | IPublicStudyEntity; + isPublic?: boolean; +} + +const getDataAccessDescriptions = ({ + flatDataset, + study, + isPublic = false, +}: IGetDataAccessDescriptions): IEntityDescriptionsItem[] => { + const result: IEntityDescriptionsItem[] = []; + result.push({ label: intl.get('entities.study.access_limitation'), value: flatDataset?.accessLimitations.size ? renderAccess(flatDataset?.accessLimitations) : TABLE_EMPTY_PLACE_HOLDER, - }, - { + }); + result.push({ label: intl.get('entities.study.access_requirement'), value: flatDataset?.accessRequirements.size ? renderAccess(flatDataset.accessRequirements) : TABLE_EMPTY_PLACE_HOLDER, - }, -]; + }); + + if (!isPublic && study && (study as IStudyEntity).contacts?.hits?.edges?.length) { + result.push({ + label: intl.get('entities.study.study_contact'), + value: (study as IStudyEntity)?.contacts?.hits.edges.map((contact, index) => ( +
+ {contact.node.name && {contact.node.name}; } + {contact.node.email && {contact.node.email}} +
+ )), + }); + } + + if (isPublic && study && (study as IPublicStudyEntity).contacts?.length) { + result.push({ + label: intl.get('entities.study.study_contact'), + value: (study as IPublicStudyEntity)?.contacts?.map((contact, index) => ( +
+ {contact.name && {contact.name}; } + {contact.email && {contact.email}} +
+ )), + }); + } + + if (study?.study_websites?.length) { + result.push({ + label: intl.get('entities.study.study_website'), + value: study.study_websites.map((website, index) => ( +
+ {website} +
+ )), + }); + } + + if (study?.biobank_contact) { + result.push({ + label: intl.get('entities.study.virtual_biorepository_email'), + value: ( + + {study.biobank_contact} + + ), + }); + } + + if (study?.biobank_request_link) { + result.push({ + label: intl.get('entities.study.virtual_biorepository_url'), + value: ( + {study.biobank_request_link} + ), + }); + } + + return result; +}; export default getDataAccessDescriptions; diff --git a/src/views/StudyEntity/utils/summary.tsx b/src/views/StudyEntity/utils/summary.tsx index 14a885ae..9aedf7c5 100644 --- a/src/views/StudyEntity/utils/summary.tsx +++ b/src/views/StudyEntity/utils/summary.tsx @@ -10,6 +10,7 @@ import copy from 'copy-to-clipboard'; import { IStudyEntity } from 'graphql/studies/models'; import { IPublicStudyEntity } from 'views/PublicStudyEntity/types'; +import ExpandableText from 'components/ExpandableText'; import Publication from 'components/Publication'; import PublicPublication from 'components/Publication/PublicPublication'; import { globalActions } from 'store/global'; @@ -74,28 +75,51 @@ const getSummaryDescriptions = ({ ), ].filter((institution) => institution); - const result: IEntityDescriptionsItem[] = []; + const clinicalTrial = isPublic + ? (study?.clinical_trials as IPublicStudyEntity['clinical_trials'])?.[0] + : (study as IStudyEntity)?.clinical_trials?.hits?.edges?.[0]?.node; - if (study?.study_code) { - result.push({ - label: intl.get('entities.study.study_code'), - value: study.study_code, - }); - } + const result: IEntityDescriptionsItem[] = []; if (study?.study_name) { result.push({ label: intl.get('entities.study.study_name'), value: ( - - {study.study_name} + <> + {study.study_name} + + ({study.study_code}) + {study.is_harmonized ? ( - {intl.get('entities.study.harmonized')} + {intl.get('entities.study.harmonized')} ) : ( - {intl.get('entities.study.unharmonized')} + {intl.get('entities.study.unharmonized')} + + )} + + ), + }); + } + + if (clinicalTrial) { + result.push({ + label: intl.get('entities.study.clinical_trials.registry_id'), + value: ( + + + {clinicalTrial.registry_id} + + {clinicalTrial.primary_purpose && ( + + {clinicalTrial.primary_purpose} + + )} + {clinicalTrial.trial_phase && ( + + {clinicalTrial.trial_phase} )} @@ -150,21 +174,22 @@ const getSummaryDescriptions = ({ ), }); - if (study?.part_lifespan_stages) { - result.push({ - label: intl.get('entities.study.participant_life_span'), - value: study.part_lifespan_stages.map((lifespan, index) => ( - - {lifespan} - - )), - }); - } + // TODO SJIP-1519 - move to design section + // if (study?.part_lifespan_stages) { + // result.push({ + // label: intl.get('entities.study.participant_life_span'), + // value: study.part_lifespan_stages.map((lifespan, index) => ( + // + // {lifespan} + // + // )), + // }); + // } if (study?.description) { result.push({ label: intl.get('entities.study.description'), - value: study.description, + value: , }); } @@ -189,13 +214,15 @@ const getSummaryDescriptions = ({ }); } - if (study?.selection_criteria?.length) { - result.push({ - label: intl.get('entities.study.selection_criteria'), - value: study?.selection_criteria?.join(', '), - }); - } + // TODO SJIP-1519 - move to design section + // if (study?.selection_criteria?.length) { + // result.push({ + // label: intl.get('entities.study.selection_criteria'), + // value: study?.selection_criteria?.join(', '), + // }); + // } + // TODO SJIP-1519 - add also in design section if (study?.study_designs?.length) { result.push({ label: intl.get('entities.study.study_design'), @@ -203,17 +230,6 @@ const getSummaryDescriptions = ({ }); } - if (study?.study_websites?.length) { - result.push({ - label: intl.get('entities.study.study_website'), - value: study.study_websites.map((website, index) => ( -
- {website} -
- )), - }); - } - if (!isPublic && study?.publications?.length) { result.push({ label: ( @@ -275,61 +291,17 @@ const getSummaryDescriptions = ({ }); } - if (!isPublic && study && (study as IStudyEntity).contacts?.hits?.edges?.length) { - result.push({ - label: intl.get('entities.study.study_contact'), - value: (study as IStudyEntity)?.contacts?.hits.edges.map((contact, index) => ( -
- {contact.node.name && {contact.node.name}; } - {contact.node.email && {contact.node.email}} -
- )), - }); - } - - if (isPublic && study && (study as IPublicStudyEntity).contacts?.length) { - result.push({ - label: intl.get('entities.study.study_contact'), - value: (study as IPublicStudyEntity)?.contacts?.map((contact, index) => ( -
- {contact.name && {contact.name}; } - {contact.email && {contact.email}} -
- )), - }); - } - - if (study?.biobank_contact) { - result.push({ - label: intl.get('entities.study.virtual_biorepository_email'), - value: ( - - {study.biobank_contact} - - ), - }); - } - - if (study?.biobank_request_link) { - result.push({ - label: intl.get('entities.study.virtual_biorepository_url'), - value: ( - {study.biobank_request_link} - ), - }); - } - if (study?.citation_statement) { result.push({ label: intl.get('entities.study.citation_statement'), - value: study.citation_statement, + value: , }); } if (study?.acknowledgement) { result.push({ label: intl.get('entities.study.acknowledgement'), - value: study.acknowledgement, + value: , }); }