webapp/src/pages/inbox.page.tsx

34 lines
1012 B
TypeScript
Raw Normal View History

2023-02-17 09:21:02 +00:00
import { PageLayout } from '../components/_shared/PageLayout'
import { ShowOnlyOnClient } from '../components/_shared/ShowOnlyOnClient'
2023-02-17 09:21:02 +00:00
import { InboxView } from '../components/Views/Inbox'
import { InboxProvider } from '../context/inbox'
import { useLocalize } from '../context/localize'
2023-12-26 23:28:26 +00:00
import type { PageProps } from './types'
import { createSignal, onMount } from 'solid-js'
import { loadAllAuthors } from '../stores/zine/authors'
2023-02-17 09:21:02 +00:00
2023-12-26 23:28:26 +00:00
export const InboxPage = (props: PageProps) => {
const { t } = useLocalize()
2023-12-26 23:28:26 +00:00
const [isLoaded, setIsLoaded] = createSignal<boolean>(Boolean(props.allAuthors))
2023-12-26 23:28:26 +00:00
onMount(async () => {
if (isLoaded()) {
return
}
await loadAllAuthors()
setIsLoaded(true)
})
2023-02-17 09:21:02 +00:00
return (
<PageLayout hideFooter={true} title={t('Inbox')}>
2023-02-17 09:21:02 +00:00
<ShowOnlyOnClient>
<InboxProvider>
2023-12-26 23:28:26 +00:00
<InboxView isLoaded={isLoaded()} authors={props.allAuthors} />
2023-02-17 09:21:02 +00:00
</InboxProvider>
</ShowOnlyOnClient>
</PageLayout>
)
}
export const Page = InboxPage