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 { ThanksPage } from './Pages/about/ThanksPage'
|
||||||
import { CreatePage } from './Pages/CreatePage'
|
import { CreatePage } from './Pages/CreatePage'
|
||||||
import { ConnectPage } from './Pages/ConnectPage'
|
import { ConnectPage } from './Pages/ConnectPage'
|
||||||
|
import { InboxPage } from './Pages/InboxPage'
|
||||||
import { LayoutShoutsPage } from './Pages/LayoutShoutsPage'
|
import { LayoutShoutsPage } from './Pages/LayoutShoutsPage'
|
||||||
import { SessionProvider } from '../context/session'
|
import { SessionProvider } from '../context/session'
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ import { SessionProvider } from '../context/session'
|
||||||
// const SomePage = lazy(() => import('./Pages/SomePage'))
|
// const SomePage = lazy(() => import('./Pages/SomePage'))
|
||||||
|
|
||||||
const pagesMap: Record<keyof Routes, Component<PageProps>> = {
|
const pagesMap: Record<keyof Routes, Component<PageProps>> = {
|
||||||
|
inbox: InboxPage,
|
||||||
expo: LayoutShoutsPage,
|
expo: LayoutShoutsPage,
|
||||||
connect: ConnectPage,
|
connect: ConnectPage,
|
||||||
create: CreatePage,
|
create: CreatePage,
|
||||||
|
|
|
@ -4,12 +4,10 @@ import { Root } from '../components/Root'
|
||||||
import { apiClient } from '../utils/apiClient'
|
import { apiClient } from '../utils/apiClient'
|
||||||
import { initRouter } from '../stores/router'
|
import { initRouter } from '../stores/router'
|
||||||
|
|
||||||
const chatrooms = await apiClient.getChats()
|
|
||||||
|
|
||||||
const { pathname, search } = Astro.url
|
const { pathname, search } = Astro.url
|
||||||
initRouter(pathname, search)
|
initRouter(pathname, search)
|
||||||
---
|
---
|
||||||
|
|
||||||
<Prerendered>
|
<Prerendered>
|
||||||
<Root chats={chatrooms} client:load />
|
<Root client:load />
|
||||||
</Prerendered>
|
</Prerendered>
|
||||||
|
|
|
@ -26,12 +26,14 @@ export interface Routes {
|
||||||
termsOfUse: void
|
termsOfUse: void
|
||||||
thanks: void
|
thanks: void
|
||||||
expo: 'layout'
|
expo: 'layout'
|
||||||
|
inbox: void // TODO: добавить ID текущего юзера
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchParamsStore = createSearchParams()
|
const searchParamsStore = createSearchParams()
|
||||||
const routerStore = createRouter<Routes>(
|
const routerStore = createRouter<Routes>(
|
||||||
{
|
{
|
||||||
home: '/',
|
home: '/',
|
||||||
|
inbox: '/inbox',
|
||||||
connect: '/connect',
|
connect: '/connect',
|
||||||
create: '/create',
|
create: '/create',
|
||||||
topics: '/topics',
|
topics: '/topics',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user