From 86673ada88a7e428e79868e2b9d99081915af0e4 Mon Sep 17 00:00:00 2001 From: nsantacruz Date: Sun, 20 Mar 2022 13:10:22 +0200 Subject: [PATCH] add comma-space between author names --- static/js/AboutBox.jsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/static/js/AboutBox.jsx b/static/js/AboutBox.jsx index e3108fdb74..a2d0c3b193 100644 --- a/static/js/AboutBox.jsx +++ b/static/js/AboutBox.jsx @@ -103,12 +103,12 @@ class AboutBox extends Component { let detailSection = null; if (d) { - let authorsEn, authorsHe; + let authorsElems = {}; if (d.authors && d.authors.length) { - const authorArrayEn = d.authors.filter((elem) => !!elem.en); - const authorArrayHe = d.authors.filter((elem) => !!elem.he); - authorsEn = authorArrayEn.map(author => {author.en} ); - authorsHe = authorArrayHe.map(author => {author.he} ); + for (let lang of ['en', 'he']) { + const authorArray = d.authors.filter((elem) => !!elem[lang]); + authorsElems[lang] = authorArray.map((author, iauthor) => {iauthor > 0 ? ", " : ""}{author[lang]} ); + } } // use compPlaceString and compDateString if available. then use compPlace o/w use pubPlace o/w nothing let placeTextEn, placeTextHe; @@ -154,14 +154,14 @@ class AboutBox extends Component { - { authorsEn && authorsEn.length ? + { authorsElems?.en?.length ?
- +
: null