Routes to /inbox

This commit is contained in:
ilya-bkv 2022-11-16 16:44:41 +03:00
parent f3eccb1ff2
commit d708347a95
5 changed files with 10152 additions and 3 deletions

View 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

View File

@ -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,

View File

@ -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>

View File

@ -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',

10133
yarn.lock Normal file

File diff suppressed because it is too large Load Diff