Skip to content

Commit

Permalink
Merge pull request #575 from NASA-IMPACT/fix/remove-sort
Browse files Browse the repository at this point in the history
Revert corresponding author being listed first
  • Loading branch information
wrynearson authored Mar 8, 2024
2 parents bc9cc5c + bcc5a7e commit 4d4ce68
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
import { applyNumberCaptionsToDocument } from '../../../utils/apply-number-captions-to-document';
import { VariableItem } from '../single-view/document-body';
import { variableNodeType } from '../../../types';
import { sortContacts } from '../../../utils/sort-contacts';

const ReferencesList = styled.ol`
&& {
Expand Down Expand Up @@ -451,36 +450,34 @@ function JournalPdfPreview() {
(c) => !c.roles?.includes('Document Reviewer')
); // Remove any reviewer from the authors list

authors
?.sort(sortContacts)
.forEach(({ contact, affiliations: contactAffiliations }, i) => {
const hasAffiliation =
contactAffiliations && contactAffiliations.length > 0;

const item = (
<span key={contact.id}>
<strong>
{getContactName(contact, { full: true })}
{hasAffiliation &&
contactAffiliations.map((affiliation, j) => {
return (
<>
<sup>
{Array.from(affiliations).indexOf(affiliation) + 1}
</sup>
<sup>
{j < contactAffiliations.length - 1 && <span>, </span>}
</sup>
</>
);
})}
{i < authors.length - 1 && <span>, </span>}
{i === authors.length - 2 && <span>and </span>}
</strong>
</span>
);
contacts.push(item);
});
authors?.forEach(({ contact, affiliations: contactAffiliations }, i) => {
const hasAffiliation =
contactAffiliations && contactAffiliations.length > 0;

const item = (
<span key={contact.id}>
<strong>
{getContactName(contact, { full: true })}
{hasAffiliation &&
contactAffiliations.map((affiliation, j) => {
return (
<>
<sup>
{Array.from(affiliations).indexOf(affiliation) + 1}
</sup>
<sup>
{j < contactAffiliations.length - 1 && <span>, </span>}
</sup>
</>
);
})}
{i < authors.length - 1 && <span>, </span>}
{i === authors.length - 2 && <span>and </span>}
</strong>
</span>
);
contacts.push(item);
});

// create corresponding authors list component
const correspondingAuthors =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { useCommentCenter } from '../../../context/comment-center';
import { isJournalPublicationIntended } from '../status';
import serializeSlateToString from '../../slate/serialize-to-string';
import { useContextualAbility } from '../../../a11n';
import { sortContacts } from '../../../utils/sort-contacts';

const PDFPreview = styled.iframe`
width: 100%;
Expand Down Expand Up @@ -1056,7 +1055,6 @@ const htmlAtbdContentSections = [
// Remove reviewers that have the role 'Document Reviewer'
!roles.includes('Document Reviewer')
)
.sort(sortContacts)
.map(({ contact, roles, affiliations }, idx) => ({
label: getContactName(contact),
id: `contacts_${idx + 1}`,
Expand Down Expand Up @@ -1117,7 +1115,6 @@ const htmlAtbdContentSections = [
// Include reviewers that have the role 'Document Reviewer'
roles.includes('Document Reviewer')
)
.sort(sortContacts)
.map(({ contact, roles, affiliations }, idx) => ({
label: getContactName(contact),
id: `contacts_${idx + 1}`,
Expand Down

0 comments on commit 4d4ce68

Please sign in to comment.