4 files changed
+499
-5452
No files matched your search
Generated
+495
-5369
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -22,13 +22,13 @@
|
|||||||
"date-fns": "^2.11.1",
|
"date-fns": "^2.11.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"markdown-it": "^10.0.0",
|
"markdown-it": "^10.0.0",
|
||||||
"next": "^11.1.3",
|
"next": "^12.1.6",
|
||||||
"rc-tooltip": "^5.1.0",
|
"rc-tooltip": "^5.1.0",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
"react-icons": "^4.2.0",
|
"react-icons": "^4.2.0",
|
||||||
"react-use": "^17.2.1",
|
"react-use": "^17.2.1",
|
||||||
"sharp": "^0.29.1",
|
"sharp": "^0.30.6",
|
||||||
"sitemap": "^1.5.0",
|
"sitemap": "^1.5.0",
|
||||||
"typograf": "^6.11.1",
|
"typograf": "^6.11.1",
|
||||||
"use-media": "^1.4.0"
|
"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",
|
"moduleResolution": "node",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "preserve"
|
"jsx": "preserve",
|
||||||
|
"incremental": true
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|||||||
Reference in new issue
Block a user