4 files changed
+505
-5458
No files matched your search
Generated
+501
-5375
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -22,13 +22,13 @@
|
||||
"date-fns": "^2.11.1",
|
||||
"lodash": "^4.17.21",
|
||||
"markdown-it": "^10.0.0",
|
||||
"next": "^11.1.3",
|
||||
"next": "^12.1.6",
|
||||
"rc-tooltip": "^5.1.0",
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1",
|
||||
"react-icons": "^4.2.0",
|
||||
"react-use": "^17.2.1",
|
||||
"sharp": "^0.29.1",
|
||||
"sharp": "^0.30.6",
|
||||
"sitemap": "^1.5.0",
|
||||
"typograf": "^6.11.1",
|
||||
"use-media": "^1.4.0"
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
import Head from 'next/head'
|
||||
import { App } from 'src/components/App'
|
||||
import { File } from 'src/components/File'
|
||||
import { Share } from 'src/components/Share'
|
||||
import { MetaBuilder } from 'src/lib/meta'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import { createApiUrl, requestGet, IResponseItems, apiGet } from 'src/next-lib'
|
||||
import { InferGetStaticPropsType, NextPage } from 'next'
|
||||
import { FileDefinition } from 'src/types'
|
||||
import { createMenu } from '@/remote/factory'
|
||||
|
||||
type Props = InferGetStaticPropsType<typeof getStaticProps>
|
||||
|
||||
const Index: NextPage<Props> = props => {
|
||||
if (!props.data) {
|
||||
console.log('document kek error', props)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<App
|
||||
showAuthor={true}
|
||||
menu={props.menu}
|
||||
>
|
||||
<Head>
|
||||
<title>{props.data.name}</title>
|
||||
<Meta meta={props.meta} />
|
||||
</Head>
|
||||
<File
|
||||
{...props.data}
|
||||
style={{
|
||||
marginTop: 'var(--size-l)',
|
||||
}}
|
||||
/>
|
||||
<Share />
|
||||
</App>
|
||||
)
|
||||
}
|
||||
|
||||
export const getStaticProps = async (ctx: any) => {
|
||||
const slug = ctx.params.slug
|
||||
const data = await requestGet<FileDefinition>(createApiUrl(`/api/files/${slug}`), null)
|
||||
const meta = (new MetaBuilder())
|
||||
.setImage(data.cover)
|
||||
.setTitle(data.name)
|
||||
.setDescription(data.name)
|
||||
.build()
|
||||
const menu = await apiGet(createMenu)('https://hudozka.tmshv.com/menu', () => [])
|
||||
|
||||
return {
|
||||
props: {
|
||||
data,
|
||||
meta,
|
||||
menu,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const getStaticPaths = async () => {
|
||||
const urls = await requestGet<IResponseItems<string>>(createApiUrl(`/api/files/urls`), null)
|
||||
if (!urls) {
|
||||
return null
|
||||
}
|
||||
|
||||
return {
|
||||
fallback: false,
|
||||
paths: urls.items
|
||||
.map(x => x.replace('/document/', ''))
|
||||
.map(slug => {
|
||||
return {
|
||||
params: {
|
||||
slug,
|
||||
},
|
||||
}
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
export default Index
|
||||
+2
-1
@@ -22,7 +22,8 @@
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve"
|
||||
"jsx": "preserve",
|
||||
"incremental": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
||||
Reference in new issue
Block a user