From 82b8c2911cdb372b6fcb9ff023ff779759770717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anne=20L=27H=C3=B4te?= Date: Fri, 13 Dec 2024 13:21:39 +0100 Subject: [PATCH] fix(publications): Restore tag affiliations --- client/src/pages/affiliationsTab.jsx | 4 ++-- client/src/pages/affiliationsView.jsx | 4 +--- client/src/pages/datasets/results.jsx | 5 ++++- client/src/pages/publications/results.jsx | 5 ++++- client/src/pages/views/publications.jsx | 1 + client/src/utils/templates.jsx | 6 +++--- client/src/utils/works.jsx | 2 +- 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/client/src/pages/affiliationsTab.jsx b/client/src/pages/affiliationsTab.jsx index 484e9cc..69cc606 100644 --- a/client/src/pages/affiliationsTab.jsx +++ b/client/src/pages/affiliationsTab.jsx @@ -6,11 +6,11 @@ import { import PropTypes from 'prop-types'; import { useEffect, useState } from 'react'; -import AffiliationsView from './affiliationsView'; import Gauge from '../components/gauge'; import { status } from '../config'; import { removeDiacritics } from '../utils/strings'; import { renderButtons } from '../utils/works'; +import AffiliationsView from './affiliationsView'; export default function AffiliationsTab({ affiliations, selectedAffiliations, setSelectedAffiliations, tagAffiliations }) { const [filteredAffiliations, setFilteredAffiliations] = useState([]); @@ -43,7 +43,7 @@ export default function AffiliationsTab({ affiliations, selectedAffiliations, se {selectedAffiliations.length} - {`selected affiliation${selectedAffiliations.length === 1 ? '' : 's'}`} + {` selected affiliation${selectedAffiliations.length === 1 ? '' : 's'}`} {renderButtons(selectedAffiliations, tagAffiliations)}
diff --git a/client/src/pages/affiliationsView.jsx b/client/src/pages/affiliationsView.jsx index db27500..e90569e 100644 --- a/client/src/pages/affiliationsView.jsx +++ b/client/src/pages/affiliationsView.jsx @@ -20,9 +20,7 @@ export default function AffiliationsView({ setFilteredAffiliationName, setSelectedAffiliations, }) { - const [filters] = useState({ - status: { value: null, matchMode: FilterMatchMode.IN }, - }); + const [filters] = useState({ status: { matchMode: FilterMatchMode.IN, value: null } }); const [selectionPageOnly, setSelectionPageOnly] = useState(true); const paginatorLeft = () => ( diff --git a/client/src/pages/datasets/results.jsx b/client/src/pages/datasets/results.jsx index 965cebd..9027861 100644 --- a/client/src/pages/datasets/results.jsx +++ b/client/src/pages/datasets/results.jsx @@ -55,7 +55,10 @@ export default function Affiliations() { setAffiliations( _affiliations ?.filter((affiliation) => affiliationIds.includes(affiliation.id)) - .map((affiliation) => (affiliation.status = action)), + .map((affiliation) => ({ + ...affiliation, + status: action, + })), ); setSelectedAffiliations([]); }; diff --git a/client/src/pages/publications/results.jsx b/client/src/pages/publications/results.jsx index f628920..e621d73 100644 --- a/client/src/pages/publications/results.jsx +++ b/client/src/pages/publications/results.jsx @@ -47,7 +47,10 @@ export default function Affiliations() { setAffiliations( _affiliations ?.filter((affiliation) => affiliationIds.includes(affiliation.id)) - .map((affiliation) => (affiliation.status = action)), + .map((affiliation) => ({ + ...affiliation, + status: action, + })), ); setSelectedAffiliations([]); }; diff --git a/client/src/pages/views/publications.jsx b/client/src/pages/views/publications.jsx index aa57e20..da53169 100644 --- a/client/src/pages/views/publications.jsx +++ b/client/src/pages/views/publications.jsx @@ -31,6 +31,7 @@ export default function Publications({ if (allPublications?.length === 0) { return
No publications detected.
; } + return (
{options.datasets ? ( diff --git a/client/src/utils/templates.jsx b/client/src/utils/templates.jsx index bc7f02c..7f19b1a 100644 --- a/client/src/utils/templates.jsx +++ b/client/src/utils/templates.jsx @@ -4,6 +4,7 @@ import { Badge, Button } from '@dataesr/dsfr-plus'; import { MultiSelect } from 'primereact/multiselect'; import { Tooltip } from 'react-tooltip'; +import { status } from '../config'; import { getIdLink } from './works'; const affiliationsTemplate = (rowData) => ( @@ -24,9 +25,8 @@ const affiliations2Template = (rowData) => { ) .join(''); if (rowData.affiliations.length > 3) { - affiliationsHtml += `
  • and others (${ - rowData.affiliations.length - 3 - })
  • `; + affiliationsHtml += `
  • and others (${rowData.affiliations.length - 3 + })
  • `; } affiliationsHtml += ''; let affiliationsTooltip = '
      '; diff --git a/client/src/utils/works.jsx b/client/src/utils/works.jsx index 6435a19..ad7c344 100644 --- a/client/src/utils/works.jsx +++ b/client/src/utils/works.jsx @@ -130,12 +130,12 @@ const range = (startYear, endYear = new Date().getFullYear()) => { const renderButtons = (selected, fn) => Object.values(status).map((st) => (