merged
This commit is contained in:
commit
7f5553316c
|
@ -23,6 +23,8 @@ type AllAuthorsPageSearchParams = {
|
|||
|
||||
type Props = {
|
||||
authors: Author[]
|
||||
topFollowedAuthors?: Author[]
|
||||
topWritingAuthors?: Author[]
|
||||
isLoaded: boolean
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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>(Boolean(props.allAuthors))
|
||||
const [isLoaded, setIsLoaded] = createSignal<boolean>(
|
||||
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 (
|
||||
<PageLayout title={t('Authors')}>
|
||||
<AllAuthors isLoaded={isLoaded()} authors={props.allAuthors} />
|
||||
<AllAuthors
|
||||
isLoaded={isLoaded()}
|
||||
authors={props.allAuthors}
|
||||
topWritingAuthors={props.topWritingAuthors}
|
||||
topFollowedAuthors={props.topFollowedAuthors}
|
||||
/>
|
||||
</PageLayout>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ export type PageProps = {
|
|||
homeShouts?: Shout[]
|
||||
author?: Author
|
||||
allAuthors?: Author[]
|
||||
topWritingAuthors?: Author[]
|
||||
topFollowedAuthors?: Author[]
|
||||
topic?: Topic
|
||||
allTopics?: Topic[]
|
||||
searchQuery?: string
|
||||
|
|
Loading…
Reference in New Issue
Block a user