From 30e7706f793d9339349bdfc00041dd4b7183f270 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Tue, 16 Feb 2021 21:00:45 +0300 Subject: [PATCH] rm collective page (will be strapi based) --- pages/collective.tsx | 138 ------------------------------------------- 1 file changed, 138 deletions(-) delete mode 100644 pages/collective.tsx diff --git a/pages/collective.tsx b/pages/collective.tsx deleted file mode 100644 index 0fcc63f3..00000000 --- a/pages/collective.tsx +++ /dev/null @@ -1,138 +0,0 @@ -import Head from 'next/head' -import { App } from 'src/components/App' -import { Meta } from 'src/components/Meta' -import { meta } from 'src/lib/meta' -import { IMeta, IPage, ImageSize } from 'src/types' -import { createApiUrl, requestGet } from 'src/next-lib' -import { NextPage, NextPageContext } from 'next' -import { CardGrid } from 'src/components/CardGrid' -import { Card } from 'src/components/Card' -import { Block } from 'src/components/Block' -import { Image } from 'src/components/Image' -import { imageSrcSet } from 'src/lib/image' - -const persons = [ - '/teacher/mg-timasheva', - '/teacher/va-sarzhin', - '/teacher/od-gogoleva', - '/teacher/nv-andreeva', - '/teacher/vv-voronova', - '/teacher/ea-burovtseva', - '/teacher/sa-latipova', - //'/teacher/iv-khramov', - //'/teacher/ma-khramova', - '/teacher/av-belyaeva', - '/teacher/aa-khopryaninova', - '/teacher/ay-orlova', - '/teacher/ms-strukova', - // АС Тимашева - // ЕЮ Тарасова - // ИН Втюрина - // МЮ Валькова - // РК Тимашев -] - -type CardData = { - title: string - caption?: string - imageSrc: string - imageAlt: string - imageSrcSet: string - href: string -} - -type Props = { - title: string - meta: IMeta - data: CardData[] -} - -const Index: NextPage = props => { - if (!props.data) { - console.log('collective kek error') - return - } - - const src = 'https://art.shlisselburg.org/static/img/collective2019.jpg' - const srcSet = imageSrcSet(src, [ImageSize.big, ImageSize.large, ImageSize.medium, ImageSize.small]) - - return ( - - - {props.title} - - - - - - - {props.data.map(item => ( - - - {item.title} - - {item.caption} - - - - ))} - - - ) -} - -export const getStaticProps = async (ctx: NextPageContext) => { - const title = 'Преподаватели Шлиссельбургской ДХШ' - const pages = await Promise.all(persons - .map(page => requestGet(createApiUrl(`/api/page?page=${page}`), null)) - ) - const data: CardData[] = pages - .filter(Boolean) - .map(x => { - return { - title: x.title, - caption: x.description, - href: x.url, - imageAlt: title, - imageSrc: x.cover.src, - imageSrcSet: imageSrcSet(x.cover.src, [ImageSize.medium, ImageSize.small]) - } - }) - - return { - props: { - data, - title, - meta: meta({ - title, - description: 'Преподаватели Шлиссельбургской ДХШ', - }) - } - } -} - -export default Index