From 75dd33119b5c9917b37da791fe8c8564ae5fe024 Mon Sep 17 00:00:00 2001 From: Marc Farra Date: Thu, 28 Sep 2023 15:02:26 +0300 Subject: [PATCH 1/7] center title in journal PDF --- .../scripts/components/documents/journal-pdf-preview/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/scripts/components/documents/journal-pdf-preview/index.js b/app/assets/scripts/components/documents/journal-pdf-preview/index.js index 0603940d..afa5a388 100644 --- a/app/assets/scripts/components/documents/journal-pdf-preview/index.js +++ b/app/assets/scripts/components/documents/journal-pdf-preview/index.js @@ -105,6 +105,7 @@ const PreviewContainer = styled.div` `; const DocumentHeading = styled.h1` + text-align: center; margin: 0; `; From 3d58f2a79f4670d54efa03d0cecc911a91b3db8c Mon Sep 17 00:00:00 2001 From: Marc Farra Date: Thu, 28 Sep 2023 15:06:44 +0300 Subject: [PATCH 2/7] rm Version, Release Date and DOI from journal PDF --- .../documents/journal-pdf-preview/index.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/app/assets/scripts/components/documents/journal-pdf-preview/index.js b/app/assets/scripts/components/documents/journal-pdf-preview/index.js index afa5a388..401f428f 100644 --- a/app/assets/scripts/components/documents/journal-pdf-preview/index.js +++ b/app/assets/scripts/components/documents/journal-pdf-preview/index.js @@ -560,20 +560,6 @@ function JournalPdfPreview() { ))} -
- -
Version
-
{version}
-
- -
Release Date
-
TBD
-
- -
DOI
-
TBD
-
-
From 26efc4d1a7b37f1f3d54287a4d7dd052c53f9e4c Mon Sep 17 00:00:00 2001 From: Marc Farra Date: Thu, 28 Sep 2023 15:09:41 +0300 Subject: [PATCH 3/7] rm double colon in keywords --- .../scripts/components/documents/journal-pdf-preview/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/scripts/components/documents/journal-pdf-preview/index.js b/app/assets/scripts/components/documents/journal-pdf-preview/index.js index 401f428f..e1a3c3fd 100644 --- a/app/assets/scripts/components/documents/journal-pdf-preview/index.js +++ b/app/assets/scripts/components/documents/journal-pdf-preview/index.js @@ -571,7 +571,7 @@ function JournalPdfPreview() { {keywords && keywords.length > 0 && ( -
Keywords:
+
Keywords
{keywords.map(({ label }) => label).join(', ')}
)} From d7567cc4615e9b801f509dec6d227808fb6322cc Mon Sep 17 00:00:00 2001 From: Marc Farra Date: Thu, 28 Sep 2023 18:15:49 +0300 Subject: [PATCH 4/7] Fix affiliations section in header - journal --- .../documents/journal-pdf-preview/index.js | 72 ++++++++++++------- app/assets/scripts/utils/references.js | 2 + 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/app/assets/scripts/components/documents/journal-pdf-preview/index.js b/app/assets/scripts/components/documents/journal-pdf-preview/index.js index e1a3c3fd..02cb64f2 100644 --- a/app/assets/scripts/components/documents/journal-pdf-preview/index.js +++ b/app/assets/scripts/components/documents/journal-pdf-preview/index.js @@ -112,9 +112,11 @@ const DocumentHeading = styled.h1` const AuthorsSection = styled.div` display: flex; flex-direction: column; - align-items: center; gap: 2rem; `; +const AuthorsSectionHeader = styled.div` + text-align: center; +`; const SectionContainer = styled.section` display: flex; @@ -405,34 +407,56 @@ function JournalPdfPreview() { .slice(0, 3); const contacts = useMemo(() => { - return contacts_link?.reduce( - (acc, contact_link, i) => { - const { contact, affiliations } = contact_link; + // Get list of unique affiliations + let affiliations = new Set(); + contacts_link?.forEach(({ affiliations: contactAffiliations }) => { + contactAffiliations?.forEach((affiliation) => { + affiliations.add(affiliation); + }); + }); + + // create contacts list component with superscripts + let contacts = []; + contacts_link?.forEach( + ({ contact, affiliations: contactAffiliations }, i) => { + const hasAffiliation = + contactAffiliations && contactAffiliations.length > 0; - const hasAffiliation = affiliations && affiliations.length > 0; - if (hasAffiliation) { - acc.affiliations_list.push(affiliations); - } + let contactEmail = contact.mechanisms.find( + (mechanism) => mechanism.mechanism_type === 'Email' + )?.mechanism_value; const item = ( - {getContactName(contact, { full: true })} - {hasAffiliation && {acc.affiliations_list.length}} - {i < acc.maxIndex && , } - {i === acc.maxIndex - 1 && and } + + {getContactName(contact, { full: true })} + {contactEmail && ` (${contactEmail})`} + + {hasAffiliation && + contactAffiliations.map((affiliation, j) => { + return ( + <> + + {Array.from(affiliations).indexOf(affiliation) + 1} + + + {j < contactAffiliations.length - 1 && , } + + + ); + })} + {i < contacts_link.length - 1 && , } + {i === contacts_link.length - 2 && and } ); - - acc.items.push(item); - - return acc; - }, - { - affiliations_list: [], - items: [], - maxIndex: (contacts_link.length ?? 0) - 1 + contacts.push(item); } ); + return { + items: contacts, + affiliations_list: Array.from(affiliations), + maxIndex: (contacts_link?.length ?? 0) - 1 + }; }, [contacts_link]); const referencesUseIndex = useMemo( @@ -543,12 +567,12 @@ function JournalPdfPreview() { {resolveTitle(atbd.title)} -
{contacts?.items}
+ {contacts?.items}
- {contacts?.affiliations_list.map((affiliations, i) => ( + {contacts?.affiliations_list.map((affiliation, i) => ( // eslint-disable-next-line react/no-array-index-key
- {i + 1} {affiliations.join(', ')} + {i + 1} {affiliation}
))}
diff --git a/app/assets/scripts/utils/references.js b/app/assets/scripts/utils/references.js index 8d884f80..cfd71c3b 100644 --- a/app/assets/scripts/utils/references.js +++ b/app/assets/scripts/utils/references.js @@ -126,6 +126,7 @@ function formatAuthors(authors, type = 'reference') { } export function sortReferences(refA, refB) { + if (!refA || !refB) return 0; const hasAuthorsA = 'authors' in refA && refA.authors.length > 0; const hasAuthorsB = 'authors' in refB && refB.authors.length > 0; const hasYearA = 'year' in refA; @@ -232,6 +233,7 @@ export const formatReference = (reference, type = 'jsx') => { }; export function formatCitation(reference) { + if (!reference) return ''; const { authors, year, title } = reference; const authorsStr = formatAuthors(authors, 'citation') || title; const yearStr = year || 'n.d.'; From eb6313a3178eb960a83205b85e1fc3f02fa533b4 Mon Sep 17 00:00:00 2001 From: Marc Farra Date: Thu, 28 Sep 2023 18:34:19 +0300 Subject: [PATCH 5/7] bullet point after line breaks in journal --- .../components/documents/journal-pdf-preview/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/scripts/components/documents/journal-pdf-preview/index.js b/app/assets/scripts/components/documents/journal-pdf-preview/index.js index 02cb64f2..479c3a7b 100644 --- a/app/assets/scripts/components/documents/journal-pdf-preview/index.js +++ b/app/assets/scripts/components/documents/journal-pdf-preview/index.js @@ -118,6 +118,10 @@ const AuthorsSectionHeader = styled.div` text-align: center; `; +const KeyPoint = styled.li` + list-style: disc; +`; + const SectionContainer = styled.section` display: flex; flex-direction: column; @@ -579,8 +583,8 @@ function JournalPdfPreview() {
    - {threeKeyPoints?.map((keyPoint) => ( -
  • {keyPoint}
  • + {threeKeyPoints.map((keyPoint) => ( + {keyPoint} ))}
From 6acc581620078cfbf4e596eafea6bd5f4bb114f9 Mon Sep 17 00:00:00 2001 From: Marc Farra Date: Thu, 28 Sep 2023 18:40:45 +0300 Subject: [PATCH 6/7] add a break before the abstract --- .../scripts/components/documents/journal-pdf-preview/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/scripts/components/documents/journal-pdf-preview/index.js b/app/assets/scripts/components/documents/journal-pdf-preview/index.js index 479c3a7b..bd593537 100644 --- a/app/assets/scripts/components/documents/journal-pdf-preview/index.js +++ b/app/assets/scripts/components/documents/journal-pdf-preview/index.js @@ -588,7 +588,7 @@ function JournalPdfPreview() { ))} -
+
Date: Wed, 4 Oct 2023 17:16:13 +0300 Subject: [PATCH 7/7] Use same style for view mode & edit mode in lists --- .../components/slate/plugins/list/index.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/assets/scripts/components/slate/plugins/list/index.js b/app/assets/scripts/components/slate/plugins/list/index.js index fa654891..2d6f469e 100644 --- a/app/assets/scripts/components/slate/plugins/list/index.js +++ b/app/assets/scripts/components/slate/plugins/list/index.js @@ -153,10 +153,23 @@ const VUl = styled.ul` `; const VOl = styled.ol` - padding-left: ${glsp(1)}!important; + counter-reset: item; + margin: 0; + padding: 0; > li { - padding-left: ${glsp(1 / 2)}; + display: table; + counter-increment: item; + + &::before { + content: counters(item, '.') '. '; + display: table-cell; + padding-right: ${glsp(1 / 2)}; + } + } + + li ol > li:before { + content: counters(item, '.') ' '; } `;