merged
This commit is contained in:
commit
7f5553316c
|
@ -2,7 +2,7 @@
|
||||||
@include font-size(1.2rem);
|
@include font-size(1.2rem);
|
||||||
|
|
||||||
color: var(--secondary-color);
|
color: var(--secondary-color);
|
||||||
|
|
||||||
// align-self: center;
|
// align-self: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
|
|
@ -23,6 +23,8 @@ type AllAuthorsPageSearchParams = {
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
authors: Author[]
|
authors: Author[]
|
||||||
|
topFollowedAuthors?: Author[]
|
||||||
|
topWritingAuthors?: Author[]
|
||||||
isLoaded: boolean
|
isLoaded: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ type Props = {
|
||||||
isLoaded: boolean
|
isLoaded: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const PAGE_SIZE = 20
|
export const PAGE_SIZE = 20
|
||||||
|
|
||||||
export const AllTopics = (props: Props) => {
|
export const AllTopics = (props: Props) => {
|
||||||
const { t, lang } = useLocalize()
|
const { t, lang } = useLocalize()
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
import type { PageContext } from '../renderer/types'
|
import type { PageContext } from '../renderer/types'
|
||||||
import type { PageProps } from './types'
|
import type { PageProps } from './types'
|
||||||
|
|
||||||
|
import { PAGE_SIZE } from '../components/Views/AllTopics/AllTopics'
|
||||||
import { apiClient } from '../graphql/client/core'
|
import { apiClient } from '../graphql/client/core'
|
||||||
|
|
||||||
export const onBeforeRender = async (_pageContext: PageContext) => {
|
export const onBeforeRender = async (_pageContext: PageContext) => {
|
||||||
const allAuthors = await apiClient.getAllAuthors()
|
const allAuthors = await apiClient.getAllAuthors()
|
||||||
|
const topWritingAuthors = await apiClient.loadAuthorsBy({
|
||||||
const pageProps: PageProps = { allAuthors, seo: { title: '' } }
|
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 {
|
return {
|
||||||
pageContext: {
|
pageContext: {
|
||||||
|
|
|
@ -3,12 +3,15 @@ import type { PageProps } from './types'
|
||||||
import { createEffect, createSignal, onMount } from 'solid-js'
|
import { createEffect, createSignal, onMount } from 'solid-js'
|
||||||
|
|
||||||
import { AllAuthors } from '../components/Views/AllAuthors/'
|
import { AllAuthors } from '../components/Views/AllAuthors/'
|
||||||
|
import { PAGE_SIZE } from '../components/Views/AllTopics/AllTopics'
|
||||||
import { PageLayout } from '../components/_shared/PageLayout'
|
import { PageLayout } from '../components/_shared/PageLayout'
|
||||||
import { useLocalize } from '../context/localize'
|
import { useLocalize } from '../context/localize'
|
||||||
import { loadAllAuthors } from '../stores/zine/authors'
|
import { loadAllAuthors, loadAuthors } from '../stores/zine/authors'
|
||||||
|
|
||||||
export const AllAuthorsPage = (props: PageProps) => {
|
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()
|
const { t } = useLocalize()
|
||||||
|
|
||||||
|
@ -18,12 +21,19 @@ export const AllAuthorsPage = (props: PageProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
await loadAllAuthors()
|
await loadAllAuthors()
|
||||||
|
await loadAuthors({ by: { order: 'shouts' }, limit: PAGE_SIZE, offset: 0 })
|
||||||
|
await loadAuthors({ by: { order: 'followers' }, limit: PAGE_SIZE, offset: 0 })
|
||||||
setIsLoaded(true)
|
setIsLoaded(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageLayout title={t('Authors')}>
|
<PageLayout title={t('Authors')}>
|
||||||
<AllAuthors isLoaded={isLoaded()} authors={props.allAuthors} />
|
<AllAuthors
|
||||||
|
isLoaded={isLoaded()}
|
||||||
|
authors={props.allAuthors}
|
||||||
|
topWritingAuthors={props.topWritingAuthors}
|
||||||
|
topFollowedAuthors={props.topFollowedAuthors}
|
||||||
|
/>
|
||||||
</PageLayout>
|
</PageLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ export type PageProps = {
|
||||||
homeShouts?: Shout[]
|
homeShouts?: Shout[]
|
||||||
author?: Author
|
author?: Author
|
||||||
allAuthors?: Author[]
|
allAuthors?: Author[]
|
||||||
|
topWritingAuthors?: Author[]
|
||||||
|
topFollowedAuthors?: Author[]
|
||||||
topic?: Topic
|
topic?: Topic
|
||||||
allTopics?: Topic[]
|
allTopics?: Topic[]
|
||||||
searchQuery?: string
|
searchQuery?: string
|
||||||
|
|
Loading…
Reference in New Issue
Block a user