From 8ca38a6fd902311957c5dfd7c86a5e8431dfa2e6 Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Sat, 4 Nov 2023 17:09:29 +0100 Subject: [PATCH] fixed --- src/components/Views/AllAuthors.tsx | 34 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/components/Views/AllAuthors.tsx b/src/components/Views/AllAuthors.tsx index 3898bf24..4bd74962 100644 --- a/src/components/Views/AllAuthors.tsx +++ b/src/components/Views/AllAuthors.tsx @@ -46,28 +46,26 @@ export const AllAuthorsView = (props: AllAuthorsViewProps) => { }) const byLetter = createMemo<{ [letter: string]: Author[] }>(() => { - return sortedAuthors() - .slice(0, 1) - .reduce( - (acc, author) => { - let letter = '' - if (author && author.name) { - const nameParts = author.name.trim().split(' ') - const lastName = nameParts.pop() - if (lastName && lastName.length > 0) { - letter = lastName[0].toUpperCase() - } + return sortedAuthors().reduce( + (acc, author) => { + let letter = '' + if (author && author.name) { + const nameParts = author.name.trim().split(' ') + const lastName = nameParts.pop() + if (lastName && lastName.length > 0) { + letter = lastName[0].toUpperCase() } + } - if (/[^ËА-яё]/.test(letter) && lang() === 'ru') letter = '@' + if (/[^ËА-яё]/.test(letter) && lang() === 'ru') letter = '@' - if (!acc[letter]) acc[letter] = [] + if (!acc[letter]) acc[letter] = [] - acc[letter].push(author) - return acc - }, - {} as { [letter: string]: Author[] } - ) + acc[letter].push(author) + return acc + }, + {} as { [letter: string]: Author[] } + ) }) const sortedKeys = createMemo(() => {