webapp/src/components/Pages/AllAuthorsPage.tsx

31 lines
783 B
TypeScript
Raw Normal View History

2022-09-22 09:37:49 +00:00
import { MainLayout } from '../Layouts/MainLayout'
import { AllAuthorsView } from '../Views/AllAuthors'
import type { PageProps } from '../types'
2022-10-05 15:11:14 +00:00
import { createSignal, onMount, Show } from 'solid-js'
import { loadAllAuthors } from '../../stores/zine/authors'
import { t } from '../../utils/intl'
2022-09-22 09:37:49 +00:00
export const AllAuthorsPage = (props: PageProps) => {
2022-10-05 15:11:14 +00:00
const [isLoaded, setIsLoaded] = createSignal<boolean>(Boolean(props.allAuthors))
onMount(async () => {
if (isLoaded()) {
return
}
await loadAllAuthors()
setIsLoaded(true)
})
2022-09-22 09:37:49 +00:00
return (
<MainLayout>
2022-10-05 15:11:14 +00:00
<Show when={isLoaded()} fallback={t('Loading')}>
<AllAuthorsView authors={props.allAuthors} />
</Show>
2022-09-22 09:37:49 +00:00
</MainLayout>
)
}
// for lazy loading
export default AllAuthorsPage