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