Routes to /inbox
This commit is contained in:
parent
f3eccb1ff2
commit
d708347a95
14
src/components/Pages/InboxPage.tsx
Normal file
14
src/components/Pages/InboxPage.tsx
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { PageWrap } from '../_shared/PageWrap'
|
||||
import { InboxView } from '../Views/Inbox'
|
||||
import type { PageProps } from '../types'
|
||||
|
||||
export const InboxPage = (props: PageProps) => {
|
||||
return (
|
||||
<PageWrap>
|
||||
<InboxView />
|
||||
</PageWrap>
|
||||
)
|
||||
}
|
||||
|
||||
// for lazy loading
|
||||
export default InboxPage
|
|
@ -29,6 +29,7 @@ import { TermsOfUsePage } from './Pages/about/TermsOfUsePage'
|
|||
import { ThanksPage } from './Pages/about/ThanksPage'
|
||||
import { CreatePage } from './Pages/CreatePage'
|
||||
import { ConnectPage } from './Pages/ConnectPage'
|
||||
import { InboxPage } from './Pages/InboxPage'
|
||||
import { LayoutShoutsPage } from './Pages/LayoutShoutsPage'
|
||||
import { SessionProvider } from '../context/session'
|
||||
|
||||
|
@ -36,6 +37,7 @@ import { SessionProvider } from '../context/session'
|
|||
// const SomePage = lazy(() => import('./Pages/SomePage'))
|
||||
|
||||
const pagesMap: Record<keyof Routes, Component<PageProps>> = {
|
||||
inbox: InboxPage,
|
||||
expo: LayoutShoutsPage,
|
||||
connect: ConnectPage,
|
||||
create: CreatePage,
|
||||
|
|
|
@ -4,12 +4,10 @@ import { Root } from '../components/Root'
|
|||
import { apiClient } from '../utils/apiClient'
|
||||
import { initRouter } from '../stores/router'
|
||||
|
||||
const chatrooms = await apiClient.getChats()
|
||||
|
||||
const { pathname, search } = Astro.url
|
||||
initRouter(pathname, search)
|
||||
---
|
||||
|
||||
<Prerendered>
|
||||
<Root chats={chatrooms} client:load />
|
||||
<Root client:load />
|
||||
</Prerendered>
|
||||
|
|
|
@ -26,12 +26,14 @@ export interface Routes {
|
|||
termsOfUse: void
|
||||
thanks: void
|
||||
expo: 'layout'
|
||||
inbox: void // TODO: добавить ID текущего юзера
|
||||
}
|
||||
|
||||
const searchParamsStore = createSearchParams()
|
||||
const routerStore = createRouter<Routes>(
|
||||
{
|
||||
home: '/',
|
||||
inbox: '/inbox',
|
||||
connect: '/connect',
|
||||
create: '/create',
|
||||
topics: '/topics',
|
||||
|
|
Loading…
Reference in New Issue
Block a user