import { Show, createMemo } from 'solid-js' import type { Author, Shout } from '../../graphql/types.gen' import Row2 from '../Feed/Row2' import Row3 from '../Feed/Row3' // import Beside from '../Feed/Beside' import AuthorFull from '../Author/Full' import { t } from '../../utils/intl' import { useAuthorsStore } from '../../stores/zine/authors' import { useArticlesStore } from '../../stores/zine/articles' import '../../styles/Topic.scss' // import { useTopicsStore } from '../../stores/zine/topics' import { useRouter } from '../../stores/router' // TODO: load reactions on client type AuthorProps = { authorArticles: Shout[] author: Author // FIXME author topics fro server // topics: Topic[] } type AuthorPageSearchParams = { by: '' | 'viewed' | 'rating' | 'commented' | 'recent' } export const AuthorView = (props: AuthorProps) => { const { sortedArticles } = useArticlesStore({ sortedArticles: props.authorArticles }) const { authorEntities } = useAuthorsStore({ authors: [props.author] }) const author = createMemo(() => authorEntities()[props.author.slug]) const { getSearchParams, changeSearchParam } = useRouter() //const slug = createMemo(() => author().slug) /* const slug = createMemo(() => { let slug = props?.slug if (props?.slug.startsWith('@')) slug = slug.replace('@', '') return slug }) */ const title = createMemo(() => { const m = getSearchParams().by if (m === 'viewed') return t('Top viewed') if (m === 'rating') return t('Top rated') if (m === 'commented') return t('Top discussed') return t('Top recent') }) return (
{t('Loading')}
}>
{`${t('Show')} `} {t('All posts')}

{title()}

0}> {/*FIXME*/} {/**/}
) }