menu moved to config and context
This commit is contained in:
1 parent
e8fb2e817b
commit
1dbbe04d59
20 files changed
+62
-249
No files matched your search
@@ -2,8 +2,6 @@ import Head from 'next/head'
|
||||
import { App } from 'src/components/App'
|
||||
import { tail } from 'lodash'
|
||||
import { Page } from 'src/components/Page'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import { meta } from 'src/lib/meta'
|
||||
import { createApiUrl, requestGet, wrapInitialProps, IResponseItems } from 'src/next-lib'
|
||||
@@ -16,7 +14,6 @@ function array<T>(value: T | T[]) {
|
||||
|
||||
const Index = props => (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
contentStyle={{
|
||||
marginTop: 'var(--size-l)'
|
||||
@@ -51,7 +48,6 @@ export const unstable_getStaticProps = async (ctx: any) => {
|
||||
return {
|
||||
props: {
|
||||
content: page.data,
|
||||
pageUrl: slug,
|
||||
title: page.title,
|
||||
meta: meta({
|
||||
title: page.title,
|
||||
|
||||
@@ -2,13 +2,10 @@ import Head from 'next/head'
|
||||
import { App } from 'src/components/App'
|
||||
import { Article } from 'src/components/Article'
|
||||
import { Html } from 'src/components/Html'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { createApiUrl, requestGet, IResponseItems } from 'src/next-lib'
|
||||
import { NextPage } from 'next'
|
||||
|
||||
type Props = {
|
||||
pageUrl: string
|
||||
data: any //(album)
|
||||
}
|
||||
|
||||
@@ -21,7 +18,6 @@ const Page: NextPage<Props> = props => {
|
||||
|
||||
return (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
>
|
||||
<Head>
|
||||
@@ -43,7 +39,6 @@ const Page: NextPage<Props> = props => {
|
||||
}
|
||||
|
||||
export const unstable_getStaticProps = async (ctx: any) => {
|
||||
const pageUrl = '/gallery'
|
||||
// const id = ctx.query.slug
|
||||
const id = ctx.params.slug
|
||||
const data = await requestGet(createApiUrl(`/api/albums/${id}`), null)
|
||||
@@ -55,7 +50,6 @@ export const unstable_getStaticProps = async (ctx: any) => {
|
||||
return {
|
||||
props: {
|
||||
data,
|
||||
pageUrl,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ import { get } from 'lodash'
|
||||
import { App } from 'src/components/App'
|
||||
import { Article } from 'src/components/Article'
|
||||
import { Html } from 'src/components/Html'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import { meta } from 'src/lib/meta'
|
||||
import { createApiUrl, requestGet, IResponseItems } from 'src/next-lib'
|
||||
@@ -12,7 +10,6 @@ import { NextPage } from 'next'
|
||||
import { IArticle } from 'src/types'
|
||||
|
||||
type Props = {
|
||||
pageUrl: string
|
||||
meta: any
|
||||
data: IArticle
|
||||
}
|
||||
@@ -25,7 +22,6 @@ const Page: NextPage<Props> = props => {
|
||||
|
||||
return (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
>
|
||||
<Head>
|
||||
@@ -59,7 +55,6 @@ export const unstable_getStaticProps = async (ctx: any) => {
|
||||
return {
|
||||
props: {
|
||||
data,
|
||||
pageUrl,
|
||||
meta: meta({
|
||||
title: data.title,
|
||||
image: image.src,
|
||||
|
||||
@@ -2,8 +2,6 @@ import Head from 'next/head'
|
||||
import { range } from 'lodash'
|
||||
import { App } from 'src/components/App'
|
||||
import { ArticleGrid } from 'src/components/ArticleGrid'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { meta } from 'src/lib/meta'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import { createApiUrl, requestGet, IResponseItems } from 'src/next-lib'
|
||||
@@ -12,7 +10,6 @@ import { NextPage } from 'next'
|
||||
const pageSize = Number(process.env.APP_ARTICLES_PAGE_SIZE)
|
||||
|
||||
type Props = {
|
||||
pageUrl: string
|
||||
meta: any
|
||||
title: string
|
||||
data: any //(list of article)
|
||||
@@ -28,7 +25,6 @@ const Page: NextPage<Props> = props => {
|
||||
|
||||
return (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
wide={true}
|
||||
>
|
||||
@@ -46,7 +42,6 @@ const Page: NextPage<Props> = props => {
|
||||
}
|
||||
|
||||
export const unstable_getStaticProps = async (ctx: any) => {
|
||||
const pageUrl = '/'
|
||||
// const page = parseInt(ctx.query.page)
|
||||
const page = parseInt(ctx.params.slug)
|
||||
const res = await requestGet<IResponseItems<any[]>>(
|
||||
@@ -67,7 +62,6 @@ export const unstable_getStaticProps = async (ctx: any) => {
|
||||
data,
|
||||
nextPage,
|
||||
prevPage,
|
||||
pageUrl,
|
||||
title,
|
||||
meta: meta({
|
||||
title,
|
||||
|
||||
@@ -3,8 +3,6 @@ import { get } from 'lodash'
|
||||
import { App } from 'src/components/App'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import { CollectiveImage } from 'src/components/CollectiveImage'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { meta } from 'src/lib/meta'
|
||||
import { IMeta, IImage } from 'src/types'
|
||||
import { createApiUrl, requestGet, IResponseItems } from 'src/next-lib'
|
||||
@@ -20,7 +18,6 @@ interface IPerson {
|
||||
}
|
||||
|
||||
type Props = {
|
||||
pageUrl: string
|
||||
title: string
|
||||
image: string
|
||||
meta: IMeta
|
||||
@@ -35,7 +32,6 @@ const Page: NextPage<Props> = props => {
|
||||
|
||||
return (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
wide={true}
|
||||
>
|
||||
@@ -83,7 +79,6 @@ const Page: NextPage<Props> = props => {
|
||||
|
||||
export const unstable_getStaticProps = async (ctx: NextPageContext) => {
|
||||
// const pageUrl = ctx.req.url
|
||||
const pageUrl = '/collective'
|
||||
|
||||
const res = await requestGet<IResponseItems<IPerson>>(createApiUrl('/api/persons'), null)
|
||||
const data = res?.items || []
|
||||
@@ -96,11 +91,9 @@ export const unstable_getStaticProps = async (ctx: NextPageContext) => {
|
||||
props: {
|
||||
data,
|
||||
image,
|
||||
pageUrl,
|
||||
title,
|
||||
meta: meta({
|
||||
title,
|
||||
url: pageUrl,
|
||||
description: 'Преподаватели Шлиссельбургской ДХШ',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ import Head from 'next/head'
|
||||
import { App } from 'src/components/App'
|
||||
import Document from 'src/components/Document'
|
||||
import { Share } from 'src/components/Share'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { meta } from 'src/lib/meta'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import { createApiUrl, requestGet, IResponseItems } from 'src/next-lib'
|
||||
@@ -12,7 +10,6 @@ import { NextPage } from 'next'
|
||||
import { IMeta } from 'src/types'
|
||||
|
||||
type Props = {
|
||||
pageUrl: string
|
||||
data: any //(file)
|
||||
meta: IMeta
|
||||
}
|
||||
@@ -26,7 +23,6 @@ const Page: NextPage<Props> = props => {
|
||||
|
||||
return (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
>
|
||||
<Head>
|
||||
@@ -40,14 +36,12 @@ const Page: NextPage<Props> = props => {
|
||||
}
|
||||
|
||||
export const unstable_getStaticProps = async (ctx: any) => {
|
||||
const pageUrl = '/documents'
|
||||
const id = ctx.params.slug
|
||||
const data = await requestGet(createApiUrl(`/api/files/${id}`), {})
|
||||
|
||||
return {
|
||||
props: {
|
||||
data,
|
||||
pageUrl,
|
||||
meta: meta({
|
||||
// title: file.meta,
|
||||
})
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import Head from 'next/head'
|
||||
import { App } from 'src/components/App'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { meta } from 'src/lib/meta'
|
||||
import { IDocument } from 'src/types'
|
||||
import { DocumentList } from 'src/components/DocumentList'
|
||||
@@ -94,14 +92,12 @@ function getSorted(documents: IDocument[]): IDocumentCategory[] {
|
||||
|
||||
interface IProps {
|
||||
collections: IDocumentCategory[]
|
||||
pageUrl: string
|
||||
title: string
|
||||
meta: any
|
||||
}
|
||||
|
||||
const Page: NextPage<IProps> = props => (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
>
|
||||
<Head>
|
||||
@@ -122,7 +118,6 @@ const Page: NextPage<IProps> = props => (
|
||||
)
|
||||
|
||||
export const unstable_getStaticProps = async (ctx) => {
|
||||
const pageUrl = '/documents'
|
||||
const res = await requestGet<IResponseItems<IDocument>>(createApiUrl('/api/files'), null)
|
||||
const files = res.items
|
||||
const title = 'Документы'
|
||||
@@ -131,7 +126,6 @@ export const unstable_getStaticProps = async (ctx) => {
|
||||
return {
|
||||
props: {
|
||||
collections,
|
||||
pageUrl,
|
||||
title,
|
||||
meta: meta({
|
||||
title,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import Head from 'next/head'
|
||||
import { App } from 'src/components/App'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { splitBy } from 'src/lib/array'
|
||||
import { meta } from 'src/lib/meta'
|
||||
import { createApiUrl, requestGet } from 'src/next-lib'
|
||||
@@ -64,14 +62,12 @@ const ACollection = ({ title, albums }) => (
|
||||
|
||||
interface IProps {
|
||||
meta: any
|
||||
pageUrl: string
|
||||
title: string
|
||||
collections: any[]
|
||||
}
|
||||
|
||||
const Page: NextPage<IProps> = props => (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
wide={true}
|
||||
>
|
||||
@@ -96,7 +92,6 @@ const Page: NextPage<IProps> = props => (
|
||||
|
||||
export const unstable_getStaticProps = async (ctx: any) => {
|
||||
// const pageUrl = ctx.req.url
|
||||
const pageUrl = '/gallery'
|
||||
const res = await requestGet<any>(createApiUrl(`/api/albums`), null)
|
||||
if (!res) {
|
||||
return null
|
||||
@@ -108,7 +103,6 @@ export const unstable_getStaticProps = async (ctx: any) => {
|
||||
return {
|
||||
props: {
|
||||
collections: [...albumCollections.entries()],
|
||||
pageUrl,
|
||||
title,
|
||||
meta: meta({
|
||||
title,
|
||||
|
||||
+1
-7
@@ -3,15 +3,12 @@ import { App } from 'src/components/App'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import { ArticleGrid } from 'src/components/ArticleGrid'
|
||||
import { HudozkaTitle } from 'src/components/HudozkaTitle'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { meta } from 'src/lib/meta'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { createApiUrl, requestGet, IResponseItems } from 'src/next-lib'
|
||||
import { NextPage } from 'next'
|
||||
import { IArticle } from 'src/types'
|
||||
|
||||
interface IProps {
|
||||
pageUrl: string
|
||||
title: string
|
||||
meta: any
|
||||
prevPage: number
|
||||
@@ -21,7 +18,6 @@ interface IProps {
|
||||
|
||||
const Page: NextPage<IProps> = props => (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
wide={true}
|
||||
>
|
||||
@@ -45,7 +41,6 @@ const Page: NextPage<IProps> = props => (
|
||||
)
|
||||
|
||||
export const unstable_getStaticProps = async () => {
|
||||
const pageUrl = '/'
|
||||
const page = 1
|
||||
const pageSize = process.env.APP_ARTICLES_PAGE_SIZE
|
||||
const res = await requestGet<IResponseItems<IArticle>>(createApiUrl(`/api/articles?page=${page}&pageSize=${pageSize}`), null)
|
||||
@@ -63,11 +58,10 @@ export const unstable_getStaticProps = async () => {
|
||||
articles,
|
||||
nextPage,
|
||||
prevPage,
|
||||
pageUrl,
|
||||
title,
|
||||
meta: meta({
|
||||
title,
|
||||
url: pageUrl,
|
||||
url: '/',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,16 @@ import Head from 'next/head'
|
||||
import { App } from 'src/components/App'
|
||||
import { Schedule } from 'src/components/Schedule'
|
||||
import { Share } from 'src/components/Share'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { createApiUrl, requestGet } from 'src/next-lib'
|
||||
import { NextPage } from 'next'
|
||||
|
||||
type Props = {
|
||||
pageUrl: string
|
||||
title: string
|
||||
data: any //(schedule)
|
||||
}
|
||||
|
||||
const Page: NextPage<Props> = props => (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
wide={true}
|
||||
>
|
||||
@@ -30,8 +26,6 @@ const Page: NextPage<Props> = props => (
|
||||
)
|
||||
|
||||
export const unstable_getStaticProps = async (ctx: any) => {
|
||||
// const pageUrl = ctx.req.url
|
||||
const pageUrl = '/schedule'
|
||||
const period = '2016-2017'
|
||||
const semester = 'spring'
|
||||
const data = await requestGet(createApiUrl(`/api/schedule?period=${period}&semester=${semester}`), null)
|
||||
@@ -42,7 +36,6 @@ export const unstable_getStaticProps = async (ctx: any) => {
|
||||
return {
|
||||
props: {
|
||||
data,
|
||||
pageUrl,
|
||||
title: 'Расписание',
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ import Head from 'next/head'
|
||||
import { App } from 'src/components/App'
|
||||
import { Article } from 'src/components/Article'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { meta } from 'src/lib/meta'
|
||||
import { createApiUrl, requestGet, IResponseItems } from 'src/next-lib'
|
||||
import { NextPage } from 'next'
|
||||
@@ -11,7 +9,6 @@ import { IMeta } from 'src/types'
|
||||
import { Html } from 'src/components/Html'
|
||||
|
||||
interface IProps {
|
||||
pageUrl: string
|
||||
title: string
|
||||
meta: IMeta
|
||||
person: any
|
||||
@@ -26,7 +23,6 @@ const Index: NextPage<IProps> = props => {
|
||||
|
||||
return (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
>
|
||||
<Head>
|
||||
@@ -53,7 +49,6 @@ const Index: NextPage<IProps> = props => {
|
||||
export const unstable_getStaticProps = async (ctx: any) => {
|
||||
console.log('call unstable_getStaticProps', ctx)
|
||||
|
||||
const pageUrl = '/collective'
|
||||
// const id = ctx.query.person
|
||||
// const id = ctx.params.person ?? 'va-sarzhin'
|
||||
const id = ctx.params.person //?? 'mg-timasheva'
|
||||
@@ -73,7 +68,6 @@ export const unstable_getStaticProps = async (ctx: any) => {
|
||||
|
||||
return {
|
||||
props: {
|
||||
pageUrl,
|
||||
person,
|
||||
title,
|
||||
meta: meta({
|
||||
|
||||
Reference in new issue
Block a user