commit
2cc066e2ce
13
src/components/Pages/CreatePage.tsx
Normal file
13
src/components/Pages/CreatePage.tsx
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import { MainLayout } from '../Layouts/MainLayout'
|
||||||
|
import { CreateView } from '../Views/Create'
|
||||||
|
|
||||||
|
export const CreatePage = () => {
|
||||||
|
return (
|
||||||
|
<MainLayout>
|
||||||
|
<CreateView />
|
||||||
|
</MainLayout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// for lazy loading
|
||||||
|
export default CreatePage
|
|
@ -26,6 +26,7 @@ import { PartnersPage } from './Pages/about/PartnersPage'
|
||||||
import { ProjectsPage } from './Pages/about/ProjectsPage'
|
import { ProjectsPage } from './Pages/about/ProjectsPage'
|
||||||
import { TermsOfUsePage } from './Pages/about/TermsOfUsePage'
|
import { TermsOfUsePage } from './Pages/about/TermsOfUsePage'
|
||||||
import { ThanksPage } from './Pages/about/ThanksPage'
|
import { ThanksPage } from './Pages/about/ThanksPage'
|
||||||
|
import { CreatePage } from './Pages/CreatePage'
|
||||||
|
|
||||||
// TODO: lazy load
|
// TODO: lazy load
|
||||||
// const HomePage = lazy(() => import('./Pages/HomePage'))
|
// const HomePage = lazy(() => import('./Pages/HomePage'))
|
||||||
|
@ -49,6 +50,7 @@ import { ThanksPage } from './Pages/about/ThanksPage'
|
||||||
const log = getLogger('root')
|
const log = getLogger('root')
|
||||||
|
|
||||||
const pagesMap: Record<keyof Routes, Component<PageProps>> = {
|
const pagesMap: Record<keyof Routes, Component<PageProps>> = {
|
||||||
|
create: CreatePage,
|
||||||
home: HomePage,
|
home: HomePage,
|
||||||
topics: AllTopicsPage,
|
topics: AllTopicsPage,
|
||||||
topic: TopicPage,
|
topic: TopicPage,
|
||||||
|
|
|
@ -7,6 +7,9 @@ import Editor from '../Editor'
|
||||||
import { Sidebar } from '../Editor/Sidebar'
|
import { Sidebar } from '../Editor/Sidebar'
|
||||||
import ErrorView from '../Editor/Error'
|
import ErrorView from '../Editor/Error'
|
||||||
import { newState } from '../Editor/store'
|
import { newState } from '../Editor/store'
|
||||||
|
import { getLogger } from '../../utils/logger'
|
||||||
|
|
||||||
|
const log = getLogger('CreateView')
|
||||||
|
|
||||||
export const CreateView = () => {
|
export const CreateView = () => {
|
||||||
const [store, ctrl] = createCtrl(newState())
|
const [store, ctrl] = createCtrl(newState())
|
||||||
|
|
|
@ -110,7 +110,7 @@ export const HomeView = (props: HomeProps) => {
|
||||||
|
|
||||||
<Hero />
|
<Hero />
|
||||||
|
|
||||||
<Show when={sortedArticles().length > 5}>
|
<Show when={sortedArticles().length > PRERENDERED_ARTICLES_COUNT}>
|
||||||
<Beside
|
<Beside
|
||||||
beside={sortedArticles()[5]}
|
beside={sortedArticles()[5]}
|
||||||
title={t('Top viewed')}
|
title={t('Top viewed')}
|
||||||
|
|
|
@ -5,8 +5,9 @@ import { apiClient } from '../utils/apiClient'
|
||||||
import { initRouter } from '../stores/router'
|
import { initRouter } from '../stores/router'
|
||||||
|
|
||||||
const slug = Astro.params.slug?.toString()
|
const slug = Astro.params.slug?.toString()
|
||||||
const routepaths = ['craete', 'search', 'inbox', 'topics', 'authors', 'robots.txt']
|
if (slug.endsWith('.map')) {
|
||||||
if (routepaths.includes(slug) || Boolean(slug) === false || slug.includes('.map')) return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const article = await apiClient.getArticle({ slug })
|
const article = await apiClient.getArticle({ slug })
|
||||||
if (!article) {
|
if (!article) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { useStore } from '@nanostores/solid'
|
||||||
// TODO: more
|
// TODO: more
|
||||||
export interface Routes {
|
export interface Routes {
|
||||||
home: void
|
home: void
|
||||||
|
create: void
|
||||||
topics: void
|
topics: void
|
||||||
topic: 'slug'
|
topic: 'slug'
|
||||||
authors: void
|
authors: void
|
||||||
|
@ -27,6 +28,7 @@ const searchParamsStore = createSearchParams()
|
||||||
const routerStore = createRouter<Routes>(
|
const routerStore = createRouter<Routes>(
|
||||||
{
|
{
|
||||||
home: '/',
|
home: '/',
|
||||||
|
create: '/create',
|
||||||
topics: '/topics',
|
topics: '/topics',
|
||||||
topic: '/topic/:slug',
|
topic: '/topic/:slug',
|
||||||
authors: '/authors',
|
authors: '/authors',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user