import { For, Show, createMemo } from 'solid-js' import type { Shout, Topic } from '../../graphql/types.gen' import Row3 from '../Feed/Row3' import Row2 from '../Feed/Row2' import Beside from '../Feed/Beside' import { ArticleCard } from '../Feed/Card' import '../../styles/Topic.scss' import { FullTopic } from '../Topic/Full' import { t } from '../../utils/intl' import { useRouter } from '../../stores/router' import { useTopicsStore } from '../../stores/zine/topics' import { useArticlesStore } from '../../stores/zine/articles' import { useAuthorsStore } from '../../stores/zine/authors' type TopicsPageSearchParams = { by: 'comments' | '' | 'recent' | 'viewed' | 'rating' | 'commented' } interface TopicProps { topic: Topic topicArticles: Shout[] } export const TopicView = (props: TopicProps) => { const { getSearchParams, changeSearchParam } = useRouter() const { sortedArticles } = useArticlesStore({ sortedArticles: props.topicArticles }) const { topicEntities } = useTopicsStore({ topics: [props.topic] }) const { authorsByTopic } = useAuthorsStore() const topic = createMemo(() => topicEntities()[props.topic.slug]) /* const slug = createMemo(() => { let slug = props?.slug if (props?.slug.startsWith('@')) slug = slug.replace('@', '') return slug }) */ const title = createMemo(() => { // FIXME // 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('Show')} `} {t('All posts')}

{title()}

{(article) => (
)}
5}>
) }