From b21d06809f3b5c407628e49ac18ac8f473b8d519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anne=20L=27H=C3=B4te?= Date: Wed, 20 Nov 2024 10:40:52 +0100 Subject: [PATCH] feat(openalex): Enable the Add of ROR --- .../src/pages/openalex-ror/results/index.jsx | 88 ++++++++++++++++--- .../pages/openalex-ror/results/list-view.jsx | 5 +- .../openalex-ror/results/views-selector.jsx | 9 +- client/src/utils/ror.jsx | 1 + 4 files changed, 83 insertions(+), 20 deletions(-) diff --git a/client/src/pages/openalex-ror/results/index.jsx b/client/src/pages/openalex-ror/results/index.jsx index 241ec52..5cc7b0d 100644 --- a/client/src/pages/openalex-ror/results/index.jsx +++ b/client/src/pages/openalex-ror/results/index.jsx @@ -1,12 +1,13 @@ import { Badge, Button, - Container, Row, Col, + Col, + Container, Modal, ModalContent, ModalFooter, ModalTitle, + Row, Tag, Text, TextInput, - Link, Title, } from '@dataesr/dsfr-plus'; import { useQuery } from '@tanstack/react-query'; @@ -18,12 +19,12 @@ import useToast from '../../../hooks/useToast'; import Header from '../../../layout/header'; import { getAffiliationsCorrections } from '../../../utils/curations'; import { getRorData, isRor } from '../../../utils/ror'; -import { capitalize, normalize, removeDiacritics } from '../../../utils/strings'; -import { getWorks } from '../../../utils/works'; +import { normalize, removeDiacritics } from '../../../utils/strings'; import { getTagColor } from '../../../utils/tags'; +import { getWorks } from '../../../utils/works'; import ExportErrorsButton from '../components/export-errors-button'; -import ViewsSelector from './views-selector'; import SendFeedbackButton from '../components/send-feedback-button'; +import ViewsSelector from './views-selector'; import 'primereact/resources/primereact.min.css'; import 'primereact/resources/themes/lara-light-indigo/theme.css'; @@ -294,7 +295,7 @@ export default function Affiliations() { <span className="fr-icon-arrow-right-fill" aria-hidden="true" /> - Add a ror to selected affiliations + Add a ROR to selected affiliations @@ -308,6 +309,12 @@ export default function Affiliations() { @@ -324,7 +331,7 @@ export default function Affiliations() { <span className="fr-icon-arrow-right-fill" aria-hidden="true" /> - Remove a ror from selected affiliations + Remove a ROR from selected affiliations
@@ -334,7 +341,7 @@ export default function Affiliations() { Name - id + ROR {/* Actions */} @@ -377,7 +384,6 @@ export default function Affiliations() { color="blue-ecume" icon="arrow-go-back-line" onClick={() => setRemoveList((prevList) => prevList.filter((item) => item !== rorItem.rorId))} - // actionToOpenAlex('remove', selectedOpenAlex, rorItem) size="sm" /> @@ -398,6 +404,64 @@ export default function Affiliations() { ))} + {addList.map((add) => ( + + + {`${add.country} + + { + removeList.includes(add.rorId) ? ( + {add.names[0]} + ) : ( + add.names[0] + ) + } + + + + ROR logo + { + removeList.includes(add.rorId) ? ( + {` https://ror.org/${add.rorId}`} + ) : ( + ` https://ror.org/${add.rorId}` + ) + } + + + { + removeList.includes(add.rorId) ? ( + <> +
@@ -408,11 +472,11 @@ export default function Affiliations() { - Once you have made your changes (add or remove Ror id), you can apply the changes using the "apply corrections" button, + Once you have made your changes (add or remove ROR id), you can apply the changes using the "Apply corrections" button, continue with your corrections and submit them to openAlex using the "Send feedback to OpenAlex" button. diff --git a/client/src/pages/openalex-ror/results/list-view.jsx b/client/src/pages/openalex-ror/results/list-view.jsx index 1c5e237..e3a4b18 100644 --- a/client/src/pages/openalex-ror/results/list-view.jsx +++ b/client/src/pages/openalex-ror/results/list-view.jsx @@ -5,11 +5,10 @@ import WorksList from '../components/works-list'; import RorBadge from '../components/ror-badge'; export default function ListView({ - onRowEditComplete, - setSelectedOpenAlex, - selectedOpenAlex, allAffiliations, + selectedOpenAlex, setFilteredAffiliationName, + setSelectedOpenAlex, }) { const defineRorColor = []; const dsColors = ['ror-1', 'ror-2', 'ror-3', 'ror-4', 'ror-5']; diff --git a/client/src/pages/openalex-ror/results/views-selector.jsx b/client/src/pages/openalex-ror/results/views-selector.jsx index 3c1f5ae..624f434 100644 --- a/client/src/pages/openalex-ror/results/views-selector.jsx +++ b/client/src/pages/openalex-ror/results/views-selector.jsx @@ -102,19 +102,18 @@ export default function OpenalexView({
{searchParams.get('view') === 'table' ? ( ) : ( )} diff --git a/client/src/utils/ror.jsx b/client/src/utils/ror.jsx index 306f66c..6c434e3 100644 --- a/client/src/utils/ror.jsx +++ b/client/src/utils/ror.jsx @@ -24,6 +24,7 @@ const getRorData = async (affiliation, getChildren = false) => { ...response.aliases, ...response.labels.map((item) => item.label), ], + country: response?.country?.country_code, }, ]; if (!getChildren) {