diff --git a/src/components/Article/CommentDate/CommentDate.module.scss b/src/components/Article/CommentDate/CommentDate.module.scss index b492cb84..18caedde 100644 --- a/src/components/Article/CommentDate/CommentDate.module.scss +++ b/src/components/Article/CommentDate/CommentDate.module.scss @@ -2,7 +2,7 @@ @include font-size(1.2rem); color: var(--secondary-color); - + // align-self: center; display: flex; align-items: flex-start; diff --git a/src/components/Views/AllAuthors/AllAuthors.tsx b/src/components/Views/AllAuthors/AllAuthors.tsx index 3934a73d..9509b7bf 100644 --- a/src/components/Views/AllAuthors/AllAuthors.tsx +++ b/src/components/Views/AllAuthors/AllAuthors.tsx @@ -23,6 +23,8 @@ type AllAuthorsPageSearchParams = { type Props = { authors: Author[] + topFollowedAuthors?: Author[] + topWritingAuthors?: Author[] isLoaded: boolean } diff --git a/src/components/Views/AllTopics/AllTopics.tsx b/src/components/Views/AllTopics/AllTopics.tsx index 36548a33..3fe6243d 100644 --- a/src/components/Views/AllTopics/AllTopics.tsx +++ b/src/components/Views/AllTopics/AllTopics.tsx @@ -28,7 +28,7 @@ type Props = { isLoaded: boolean } -const PAGE_SIZE = 20 +export const PAGE_SIZE = 20 export const AllTopics = (props: Props) => { const { t, lang } = useLocalize() diff --git a/src/pages/allAuthors.page.server.ts b/src/pages/allAuthors.page.server.ts index dcc8681b..cefcdb28 100644 --- a/src/pages/allAuthors.page.server.ts +++ b/src/pages/allAuthors.page.server.ts @@ -1,12 +1,22 @@ import type { PageContext } from '../renderer/types' import type { PageProps } from './types' +import { PAGE_SIZE } from '../components/Views/AllTopics/AllTopics' import { apiClient } from '../graphql/client/core' export const onBeforeRender = async (_pageContext: PageContext) => { const allAuthors = await apiClient.getAllAuthors() - - const pageProps: PageProps = { allAuthors, seo: { title: '' } } + const topWritingAuthors = await apiClient.loadAuthorsBy({ + by: { order: 'shouts' }, + limit: PAGE_SIZE, + offset: 0, + }) + const topFollowedAuthors = await apiClient.loadAuthorsBy({ + by: { order: 'followers' }, + limit: PAGE_SIZE, + offset: 0, + }) + const pageProps: PageProps = { allAuthors, seo: { title: '' }, topWritingAuthors, topFollowedAuthors } return { pageContext: { diff --git a/src/pages/allAuthors.page.tsx b/src/pages/allAuthors.page.tsx index 7079e8af..c49dc26e 100644 --- a/src/pages/allAuthors.page.tsx +++ b/src/pages/allAuthors.page.tsx @@ -3,12 +3,15 @@ import type { PageProps } from './types' import { createEffect, createSignal, onMount } from 'solid-js' import { AllAuthors } from '../components/Views/AllAuthors/' +import { PAGE_SIZE } from '../components/Views/AllTopics/AllTopics' import { PageLayout } from '../components/_shared/PageLayout' import { useLocalize } from '../context/localize' -import { loadAllAuthors } from '../stores/zine/authors' +import { loadAllAuthors, loadAuthors } from '../stores/zine/authors' export const AllAuthorsPage = (props: PageProps) => { - const [isLoaded, setIsLoaded] = createSignal(Boolean(props.allAuthors)) + const [isLoaded, setIsLoaded] = createSignal( + Boolean(props.allAuthors && props.topFollowedAuthors && props.topWritingAuthors), + ) const { t } = useLocalize() @@ -18,12 +21,19 @@ export const AllAuthorsPage = (props: PageProps) => { } await loadAllAuthors() + await loadAuthors({ by: { order: 'shouts' }, limit: PAGE_SIZE, offset: 0 }) + await loadAuthors({ by: { order: 'followers' }, limit: PAGE_SIZE, offset: 0 }) setIsLoaded(true) }) return ( - + ) } diff --git a/src/pages/types.ts b/src/pages/types.ts index 96701c6c..af588d9f 100644 --- a/src/pages/types.ts +++ b/src/pages/types.ts @@ -10,6 +10,8 @@ export type PageProps = { homeShouts?: Shout[] author?: Author allAuthors?: Author[] + topWritingAuthors?: Author[] + topFollowedAuthors?: Author[] topic?: Topic allTopics?: Topic[] searchQuery?: string