Skip to content

Commit

Permalink
fix(publications): Restore tag affiliations
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Dec 13, 2024
1 parent ff33d5b commit 82b8c29
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions client/src/pages/affiliationsTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
Expand Down Expand Up @@ -43,7 +43,7 @@ export default function AffiliationsTab({ affiliations, selectedAffiliations, se
<span className="number">
{selectedAffiliations.length}
</span>
{`selected affiliation${selectedAffiliations.length === 1 ? '' : 's'}`}
{` selected affiliation${selectedAffiliations.length === 1 ? '' : 's'}`}
</div>
{renderButtons(selectedAffiliations, tagAffiliations)}
<div className="text-right">
Expand Down
4 changes: 1 addition & 3 deletions client/src/pages/affiliationsView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => (
Expand Down
5 changes: 4 additions & 1 deletion client/src/pages/datasets/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
};
Expand Down
5 changes: 4 additions & 1 deletion client/src/pages/publications/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
};
Expand Down
1 change: 1 addition & 0 deletions client/src/pages/views/publications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function Publications({
if (allPublications?.length === 0) {
return <div>No publications detected.</div>;
}

return (
<div>
{options.datasets ? (
Expand Down
6 changes: 3 additions & 3 deletions client/src/utils/templates.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => (
Expand All @@ -24,9 +25,8 @@ const affiliations2Template = (rowData) => {
)
.join('');
if (rowData.affiliations.length > 3) {
affiliationsHtml += `<li class="ellipsis">and others (${
rowData.affiliations.length - 3
})</li>`;
affiliationsHtml += `<li class="ellipsis">and others (${rowData.affiliations.length - 3
})</li>`;
}
affiliationsHtml += '</ul>';
let affiliationsTooltip = '<ul>';
Expand Down
2 changes: 1 addition & 1 deletion client/src/utils/works.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ const range = (startYear, endYear = new Date().getFullYear()) => {
const renderButtons = (selected, fn) => Object.values(status).map((st) => (
<Button
className="fr-mb-1w fr-pl-1w button"
color="blue-ecume"
disabled={!selected.length}
key={st.id}
onClick={() => fn(selected, st.id)}
size="lg"
style={{ display: 'block', width: '100%', textAlign: 'left' }}
color="blue-ecume"
>
<i
className={`${st.buttonIcon} fr-mr-2w`}
Expand Down

0 comments on commit 82b8c29

Please sign in to comment.