import type { Author } from '../../../graphql/schema/core.gen' import { Meta } from '@solidjs/meta' import { clsx } from 'clsx' import { For, Show, createEffect, createMemo, createSignal } from 'solid-js' import { useLocalize } from '../../../context/localize' import { useRouter } from '../../../stores/router' import { setAuthorsSort, useAuthorsStore } from '../../../stores/zine/authors' import { getImageUrl } from '../../../utils/getImageUrl' import { scrollHandler } from '../../../utils/scroll' import { authorLetterReduce, translateAuthor } from '../../../utils/translate' import { AuthorsList } from '../../AuthorsList' import { Loading } from '../../_shared/Loading' import { SearchField } from '../../_shared/SearchField' import styles from './AllAuthors.module.scss' type AllAuthorsPageSearchParams = { by: '' | 'name' | 'shouts' | 'followers' } type Props = { authors: Author[] isLoaded: boolean } export const AllAuthors = (props: Props) => { const { t, lang } = useLocalize() const [searchQuery, setSearchQuery] = createSignal('') const ALPHABET = lang() === 'ru' ? [...'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ@'] : [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ@'] const { searchParams, changeSearchParams } = useRouter() const { sortedAuthors } = useAuthorsStore({ authors: props.authors, sortBy: searchParams().by || 'name', }) const filteredAuthors = createMemo(() => { const query = searchQuery().toLowerCase() return sortedAuthors().filter((author) => { return author.name.toLowerCase().includes(query) // Предполагаем, что у автора есть свойство name }) }) const byLetterFiltered = createMemo<{ [letter: string]: Author[] }>(() => { return filteredAuthors().reduce( (acc, author) => authorLetterReduce(acc, author, lang()), {} as { [letter: string]: Author[] }, ) }) const sortedKeys = createMemo(() => { const keys = Object.keys(byLetterFiltered()) keys.sort() keys.push(keys.shift()) return keys }) const ogImage = getImageUrl('production/image/logo_image.png') const ogTitle = t('Authors') const description = t('List of authors of the open editorial community') return (
}>

{t('Authors')}

{t('Subscribe who you like to tune your personal feed')}

{(letter) => (

{letter}

{(author) => (
{translateAuthor(author, lang())} {author.stat.shouts}
)}
)}
) }