Skip to content

Commit

Permalink
fix(openalex): Add missing attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Nov 8, 2024
1 parent b28ebd0 commit 9714a89
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
4 changes: 2 additions & 2 deletions client/src/pages/openalex-ror/export-errors-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useSearchParams } from 'react-router-dom';

import ButtonDropdown from '../../components/button-dropdown';

export default function ActionsOpenalex({
export default function ExportErrorsButton({
allOpenalexCorrections,
}) {
const [searchParams] = useSearchParams();
Expand All @@ -18,7 +18,7 @@ export default function ActionsOpenalex({
);
}

ActionsOpenalex.propTypes = {
ExportErrorsButton.propTypes = {
allOpenalexCorrections: PropTypes.arrayOf(PropTypes.shape({
correctedRors: PropTypes.string.isRequired,
rawAffiliationString: PropTypes.string.isRequired,
Expand Down
35 changes: 23 additions & 12 deletions client/src/pages/openalex-ror/openalexTab.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import {
Button,
Container, Row, Col,
Col,
Container,
Modal, ModalContent, ModalFooter, ModalTitle,
TagGroup, Tag,
Row,
TextInput,
} from '@dataesr/dsfr-plus';
import PropTypes from 'prop-types';
import { useEffect, useState } from 'react';

import ExportErrorsButton from './export-errors-button';
import SendFeedbackButton from './send-feedback-button';
import { status } from '../../config';
import { getAffiliationsCorrections } from '../../utils/curations';
import { isRor } from '../../utils/ror';
import { capitalize, removeDiacritics } from '../../utils/strings';
import ExportErrorsButton from './export-errors-button';
import OpenalexView from './openalexView';
import SendFeedbackButton from './send-feedback-button';

export default function OpenalexTab({
affiliations,
allOpenalexCorrections,
options,
setAllOpenalexCorrections,
allOpenalexCorrections,
undo,
}) {
const [action, setAction] = useState();
Expand Down Expand Up @@ -88,10 +89,10 @@ export default function OpenalexTab({
<ModalContent>
<TextInput
label={`Which ROR do you want to ${action} ?`}
onChange={(e) => setRor(e.target.value)}
required
message={isRor(ror) ? 'ROR valid' : 'ROR invalid'}
messageType={isRor(ror) ? 'valid' : 'error'}
onChange={(e) => setRor(e.target.value)}
required
/>
</ModalContent>
<ModalFooter>
Expand All @@ -116,7 +117,6 @@ export default function OpenalexTab({
<span>{selectedOpenAlex.length}</span>
{` selected affiliation${selectedOpenAlex.length === 1 ? '' : 's'}`}
</span>

<Button
className="fr-ml-5w fr-mr-1w"
color="beige-gris-galet"
Expand All @@ -132,7 +132,6 @@ export default function OpenalexTab({
>
Add ROR
</Button>

<Button
className="fr-mr-1w"
color="beige-gris-galet"
Expand All @@ -148,12 +147,10 @@ export default function OpenalexTab({
>
Remove ROR
</Button>

<ExportErrorsButton
allOpenalexCorrections={allOpenalexCorrections}
options={options}
/>

<SendFeedbackButton
allOpenalexCorrections={allOpenalexCorrections}
/>
Expand All @@ -162,7 +159,6 @@ export default function OpenalexTab({
actions relatives au tableau du dessous
</div>
</div>

<OpenalexView
allAffiliations={filteredAffiliations}
filteredAffiliationName={filteredAffiliationName}
Expand All @@ -189,6 +185,21 @@ OpenalexTab.propTypes = {
worksNumber: PropTypes.number.isRequired,
}),
).isRequired,
allOpenalexCorrections: PropTypes.arrayOf(PropTypes.shape({
correctedRors: PropTypes.string.isRequired,
rawAffiliationString: PropTypes.string.isRequired,
rorsInOpenAlex: PropTypes.arrayOf(PropTypes.shape({
rorCountry: PropTypes.string.isRequired,
rorId: PropTypes.string.isRequired,
rorName: PropTypes.string.isRequired,
})).isRequired,
worksExample: PropTypes.arrayOf(PropTypes.shape({
id_type: PropTypes.string.isRequired,
id_value: PropTypes.string.isRequired,
})).isRequired,
worksOpenAlex: PropTypes.arrayOf(PropTypes.string).isRequired,
})).isRequired,
options: PropTypes.object.isRequired,
setAllOpenalexCorrections: PropTypes.func.isRequired,
undo: PropTypes.func.isRequired,
};
8 changes: 4 additions & 4 deletions client/src/pages/openalex-ror/openalexView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,26 +170,26 @@ OpenalexView.propTypes = {
allAffiliations: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.string.isRequired,
source: PropTypes.string.isRequired,
nameHtml: PropTypes.string.isRequired,
source: PropTypes.string.isRequired,
status: PropTypes.string.isRequired,
works: PropTypes.arrayOf(PropTypes.string).isRequired,
worksNumber: PropTypes.number.isRequired,
}),
).isRequired,
setAllOpenalexCorrections: PropTypes.func.isRequired,
setFilteredAffiliationName: PropTypes.func.isRequired,
filteredAffiliationName: PropTypes.string.isRequired,
selectedOpenAlex: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.string.isRequired,
source: PropTypes.string.isRequired,
nameHtml: PropTypes.string.isRequired,
source: PropTypes.string.isRequired,
status: PropTypes.string.isRequired,
works: PropTypes.arrayOf(PropTypes.string).isRequired,
worksNumber: PropTypes.number.isRequired,
}),
).isRequired,
setAllOpenalexCorrections: PropTypes.func.isRequired,
setFilteredAffiliationName: PropTypes.func.isRequired,
setSelectedOpenAlex: PropTypes.func.isRequired,
undo: PropTypes.func.isRequired,
};
2 changes: 1 addition & 1 deletion client/src/pages/openalex-ror/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export default function Affiliations() {
</Col>
</Row>
)}

{!isFetching && isFetched && (
<>
<Row className="wm-bg">
Expand All @@ -134,6 +133,7 @@ export default function Affiliations() {
affiliations={affiliations.filter(
(affiliation) => affiliation.source === 'OpenAlex',
)}
allOpenalexCorrections={allOpenalexCorrections}
options={options}
setAllOpenalexCorrections={setAllOpenalexCorrections}
undo={undo}
Expand Down

0 comments on commit 9714a89

Please sign in to comment.