move app to src

This commit is contained in:
tmshv committed 2026-04-24 20:36:06 +03:00
1 parent ef80f5366c
commit 8bd52cabd6
10 files changed
+2 -1

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
export default function Loading() {
return <div>loading...</div>
}
+71
View File
@@ -0,0 +1,71 @@
import type { Metadata } from "next"
import { notFound } from "next/navigation"
import { App } from "@/components/App"
import { PageContent } from "@/components/PageContent"
import { MetaBuilder, buildMetadata } from "@/lib/meta"
import { getPageBySlug, getUrls } from "@/remote/api"
import { tail } from "@/lib/array"
export const revalidate = 30
export const dynamicParams = true
export async function generateStaticParams() {
const urls = await getUrls()
return urls.map(path => ({
slug: tail(path.split("/")),
}))
}
type Props = {
params: Promise<{ slug: string[] }>
}
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { slug } = await params
const slugPath = `/${slug.join("/")}`
const page = await getPageBySlug(slugPath)
if (!page) {
return {}
}
const m = new MetaBuilder()
.setImage(page.cover)
.setTitle(page.title)
.setDescription(page.description ?? undefined)
.build()
return buildMetadata(m)
}
export default async function SlugPage({ params }: Props) {
const { slug } = await params
const slugPath = `/${slug.join("/")}`
const page = await getPageBySlug(slugPath)
if (!page) {
notFound()
}
const breadcrumbSize = page.breadcrumb?.length ?? 0
const breadcrumbs = breadcrumbSize < 2 ? [] : page.breadcrumb ?? []
return (
<App
contentStyle={{
marginTop: "var(--size-l)",
marginBottom: "var(--size-xl)",
}}
breadcrumbs={breadcrumbs}
>
<PageContent
tags={page.tags}
date={page.date}
tokens={page.tokens}
documentSignature={{
date: "20.01.2021г.",
person: "Тимашева Марина Геннадьевна",
position: "Директор",
signature: "0ac4ea89753a4ba9893799442325fb41",
}}
/>
</App>
)
}
+23
View File
@@ -0,0 +1,23 @@
import { NextResponse } from "next/server"
import { siteUrl } from "@/const"
import { getRecentPages } from "@/remote/api"
export async function GET() {
const pages = await getRecentPages()
const feed = {
version: "https://jsonfeed.org/version/1.1",
title: "Шлиссельбургская ДХШ",
home_page_url: siteUrl,
feed_url: `${siteUrl}/feed.json`,
items: pages.map((page) => ({
id: `${siteUrl}${page.url}`,
url: `${siteUrl}${page.url}`,
title: page.title,
date_published: new Date(page.date).toISOString(),
summary: page.excerpt,
})),
}
return NextResponse.json(feed)
}
+75
View File
@@ -0,0 +1,75 @@
import "src/style/style.css"
import "src/style/content.css"
import "src/style/article.css"
import "src/style/marker/marker-table.css"
import "src/style/kazimir/video.css"
import type { Metadata, Viewport } from "next"
import Script from "next/script"
import { Roboto } from "next/font/google"
import { YMetrika } from "@/components/YMetrika"
const roboto = Roboto({
weight: ["300", "900"],
subsets: ["cyrillic", "latin"],
display: "swap",
})
export const metadata: Metadata = {
verification: {
google: [
"8BxOTw-Q02DS2KAdcGcnIMwiPZ58DVB18XpOfRibCcg",
"A-TEemUw4hHpULUDCd6xhxfHnyRbgKtss90JGKXnSpw",
],
other: {
"yandex-verification": "643c7dac144b9dac",
"msvalidate.01": "E878301FE3E3F12D233A6B1156889601",
"proculture-verification": "79110940fd847c3cfe52392ed68f3210",
},
},
icons: {
icon: { url: "/static/graphics/favicon-32.png", type: "image/png" },
apple: [
{ url: "/static/graphics/favicon-57.png", sizes: "57x57" },
{ url: "/static/graphics/favicon-72.png", sizes: "72x72" },
{ url: "/static/graphics/favicon-114.png", sizes: "114x114" },
{ url: "/static/graphics/favicon-144.png", sizes: "144x144" },
],
},
other: {
"apple-mobile-web-app-capable": "yes",
"referrer": "unsafe-url",
},
alternates: {
types: {
"application/feed+json": "/feed.json",
},
},
}
export const viewport: Viewport = {
width: "device-width",
maximumScale: 1,
themeColor: [
{ media: "(prefers-color-scheme: light)", color: "white" },
{ media: "(prefers-color-scheme: dark)", color: "hsl(240, 10%, 10%)" },
],
}
export const revalidate = 30
export default async function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="ru" className={roboto.className}>
<head>
{process.env.NEXT_PUBLIC_YMETRIKA_ACCOUNT && (
<YMetrika account={Number(process.env.NEXT_PUBLIC_YMETRIKA_ACCOUNT)} />
)}
</head>
<body>
{children}
<Script src="https://culturaltracking.ru/static/js/spxl.js?pixelId=27154" data-pixel-id="27154" />
</body>
</html>
)
}
+10
View File
@@ -0,0 +1,10 @@
import { App } from "@/components/App"
import { NotFound } from "@/components/NotFound"
export default function NotFoundPage() {
return (
<App>
<NotFound />
</App>
)
}
+26
View File
@@ -0,0 +1,26 @@
import type { Metadata } from "next"
import { App } from "@/components/App"
import { HomeContent } from "@/components/HomeContent"
import { MetaBuilder, buildMetadata } from "@/lib/meta"
import { getHomeCards } from "@/remote/api"
export const revalidate = 30
export async function generateMetadata(): Promise<Metadata> {
const title = "Шлиссельбургская ДХШ"
const m = new MetaBuilder()
.setTitle(title)
.setData({ url: "/" })
.build()
return buildMetadata(m)
}
export default async function HomePage() {
const items = await getHomeCards()
return (
<App showAuthor>
<HomeContent items={items} />
</App>
)
}
+13
View File
@@ -0,0 +1,13 @@
import type { MetadataRoute } from "next"
import { siteUrl } from "@/const"
export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: "*",
allow: "/",
},
host: siteUrl,
sitemap: `${siteUrl}/sitemap.xml`,
}
}
+25
View File
@@ -0,0 +1,25 @@
import type { MetadataRoute } from "next"
import { siteUrl } from "@/const"
import { getUrls } from "@/remote/api"
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const urls = await getUrls()
const staticPages: MetadataRoute.Sitemap = [
{
url: siteUrl,
changeFrequency: "daily",
},
{
url: `${siteUrl}/collective`,
changeFrequency: "daily",
},
]
const dynamicPages: MetadataRoute.Sitemap = urls.map((path) => ({
url: `${siteUrl}${path}`,
changeFrequency: "daily",
}))
return [...staticPages, ...dynamicPages]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

+2 -1
View File
@@ -2,12 +2,13 @@ import s from "./error.module.css"
import Link from "next/link"
import Image from "next/image"
import skull from "@/assets/graphics/skull.jpg"
export const NotFound: React.FC = () => (
<section className={s.section}>
<div>
<h1>Страница не найдена</h1>
<Image src="/static/graphics/skull.jpg" alt="Not found" />
<Image src={skull} alt="Not found" />
</div>
<div>