diff --git a/src/components/Views/Author.tsx b/src/components/Views/Author.tsx index 8eba28d9..a2aa1e99 100644 --- a/src/components/Views/Author.tsx +++ b/src/components/Views/Author.tsx @@ -1,4 +1,4 @@ -import { Show, createMemo, createSignal, For, onMount } from 'solid-js' +import { Show, createMemo, createSignal, Switch, onMount, For, Match, createEffect } from 'solid-js' import type { Author, Shout } from '../../graphql/types.gen' import { Row1 } from '../Feed/Row1' import { Row2 } from '../Feed/Row2' @@ -17,6 +17,9 @@ import { clsx } from 'clsx' import Userpic from '../Author/Userpic' import { Popup } from '../_shared/Popup' import { AuthorCard } from '../Author/Card' +import { loadReactionsBy, REACTIONS_AMOUNT_PER_PAGE } from '../../stores/zine/reactions' +import { apiClient } from '../../utils/apiClient' +import Comment from '../Article/Comment' // TODO: load reactions on client type AuthorProps = { @@ -28,7 +31,7 @@ type AuthorProps = { } type AuthorPageSearchParams = { - by: '' | 'viewed' | 'rating' | 'commented' | 'recent' | 'followed' + by: '' | 'viewed' | 'rating' | 'commented' | 'recent' | 'followed' | 'about' | 'popular' } export const PRERENDERED_ARTICLES_COUNT = 12 @@ -75,6 +78,23 @@ export const AuthorView = (props: AuthorProps) => { splitToPages(sortedArticles(), PRERENDERED_ARTICLES_COUNT, LOAD_MORE_PAGE_SIZE) ) + console.log('!!! authorEntities():', author()) + const [commented, setCommented] = createSignal([]) + createEffect(async () => { + if (searchParams().by === 'commented') { + try { + const data = await apiClient.getReactionsBy({ + by: { comment: true, createdBy: props.authorSlug }, + limit: 100, + offset: 0 + }) + setCommented(data) + } catch (error) { + console.log('!!! error:', error) + } + } + }) + return (
{t('Loading')}
}> @@ -95,7 +115,17 @@ export const AuthorView = (props: AuthorProps) => {
  • +
  • +
  • + +
  • +
  • +
  • @@ -115,7 +145,7 @@ export const AuthorView = (props: AuthorProps) => { >