2023-02-17 09:21:02 +00:00
|
|
|
import { PageLayout } from '../components/_shared/PageLayout'
|
|
|
|
import { AllTopicsView } from '../components/Views/AllTopics'
|
|
|
|
import type { PageProps } from './types'
|
2022-11-15 09:38:12 +00:00
|
|
|
import { createSignal, onMount, Show } from 'solid-js'
|
2023-02-17 09:21:02 +00:00
|
|
|
import { loadAllTopics } from '../stores/zine/topics'
|
|
|
|
import { Loading } from '../components/_shared/Loading'
|
2022-09-22 09:37:49 +00:00
|
|
|
|
|
|
|
export const AllTopicsPage = (props: PageProps) => {
|
2022-11-15 09:38:12 +00:00
|
|
|
const [isLoaded, setIsLoaded] = createSignal<boolean>(Boolean(props.allTopics))
|
|
|
|
|
|
|
|
onMount(async () => {
|
|
|
|
if (isLoaded()) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
await loadAllTopics()
|
|
|
|
setIsLoaded(true)
|
|
|
|
})
|
|
|
|
|
2022-09-22 09:37:49 +00:00
|
|
|
return (
|
2023-09-15 14:41:11 +00:00
|
|
|
<PageLayout>
|
2022-11-15 09:38:12 +00:00
|
|
|
<Show when={isLoaded()} fallback={<Loading />}>
|
2022-10-05 15:11:14 +00:00
|
|
|
<AllTopicsView topics={props.allTopics} />
|
2022-11-15 09:38:12 +00:00
|
|
|
</Show>
|
2023-02-17 09:21:02 +00:00
|
|
|
</PageLayout>
|
2022-09-22 09:37:49 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2023-02-17 09:21:02 +00:00
|
|
|
export const Page = AllTopicsPage
|