Skip to content

Commit

Permalink
adjust citation preview to show contacts with only a last name
Browse files Browse the repository at this point in the history
  • Loading branch information
fostermh committed Nov 21, 2024
1 parent f398e14 commit 0add78b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/FormComponents/ApaPreview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ export function generateCitation(record, language, format) {
(contact) =>
// citation-js crashes sometimes with single letter input for a name
contact.inCitation &&
((contact.givenNames?.length > 1 && contact.lastName?.length > 1) ||
((contact.givenNames?.length !== 1 && contact.lastName?.length > 1) ||
contact.orgName?.length > 1)
)

.map((contact) => {
if (contact.givenNames?.length === 0 && contact.lastName?.length > 1)
return {
family: contact.lastName,
};
if (contact.givenNames?.length > 1 && contact.lastName?.length > 1)
return {
given: contact.givenNames,
Expand Down

0 comments on commit 0add78b

Please sign in to comment.