feat: migrate to Next.js 15 App Router with i18n and multi-page SEO

- Replace Vite+React SPA with Next.js 15, TypeScript, App Router
- Static export (output: 'export'), deploy via npm run deploy
- i18n routing: /ru/... and /en/... with generateStaticParams
- New pages: /uslugi/ (catalog), /uslugi/[slug]/ (8 service pages), /faq/, /kontakty/
- SEO: generateMetadata on all pages, JSON-LD Service schema, hreflang alternates
- ContactForm: 'use client', Turnstile + POST to /api/contact.php
- Fonts: Manrope via next/font/google (CSS variable)
- Remove: vite.config.js, entry-server.jsx, prerender scripts, LanguageContext

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 21:19:18 +03:00
parent 18fff2e3f6
commit a0ebac1544
46 changed files with 1454 additions and 1960 deletions

View File

@@ -0,0 +1,125 @@
import type { Metadata } from 'next'
import Link from 'next/link'
import { notFound } from 'next/navigation'
import { getDictionary, LOCALES, type Locale } from '@/lib/i18n'
import { SERVICE_SLUGS } from '@/lib/services'
import { Server, Shield, Headphones, Camera, Network, HardDrive, Phone, Cloud, CheckCircle2, ChevronRight } from 'lucide-react'
const ICONS = [Server, Shield, Headphones, Camera, Network, HardDrive, Phone, Cloud]
export function generateStaticParams() {
return LOCALES.flatMap(lang =>
SERVICE_SLUGS.map(slug => ({ lang, slug }))
)
}
export async function generateMetadata({ params }: { params: Promise<{ lang: string; slug: string }> }): Promise<Metadata> {
const { lang, slug } = await params
const d = getDictionary(lang)
const svc = d.services.items.find(s => s.slug === slug)
if (!svc) return {}
return {
title: svc.title,
description: svc.description,
alternates: {
canonical: `https://sag24.ru/${lang}/uslugi/${slug}/`,
languages: {
'ru': `https://sag24.ru/ru/uslugi/${slug}/`,
'en': `https://sag24.ru/en/uslugi/${slug}/`,
},
},
openGraph: {
title: `${svc.title} | Сисадмингрупп`,
description: svc.description,
images: [{ url: '/og-image.png' }],
},
}
}
export default async function ServicePage({ params }: { params: Promise<{ lang: string; slug: string }> }) {
const { lang: langStr, slug } = await params
const lang = langStr as Locale
const d = getDictionary(lang)
const idx = d.services.items.findIndex(s => s.slug === slug)
if (idx === -1) notFound()
const svc = d.services.items[idx]
const Icon = ICONS[idx]
return (
<div className="pt-16">
<section className="py-24 bg-gradient-to-br from-slate-900 via-blue-950 to-slate-900">
<div className="max-w-4xl mx-auto px-4 sm:px-6 text-center">
<div className="w-16 h-16 bg-blue-500/20 rounded-2xl flex items-center justify-center mx-auto mb-6">
<Icon size={32} className="text-blue-400" />
</div>
<h1 className="text-4xl sm:text-5xl font-bold text-white mb-6">{svc.title}</h1>
<p className="text-xl text-slate-300 max-w-2xl mx-auto mb-10">{svc.description}</p>
<Link href={`/${lang}/kontakty/`}
className="inline-flex items-center gap-2 px-8 py-4 bg-blue-600 hover:bg-blue-500 text-white font-semibold rounded-lg transition-colors">
{lang === 'ru' ? 'Обсудить проект' : 'Discuss project'}
<ChevronRight size={20} />
</Link>
</div>
</section>
<section className="py-16 bg-white">
<div className="max-w-4xl mx-auto px-4 sm:px-6">
<h2 className="text-2xl font-bold text-slate-900 mb-8">
{lang === 'ru' ? 'Что включено' : 'What is included'}
</h2>
<ul className="grid md:grid-cols-2 gap-4">
{svc.points.map((point, i) => (
<li key={i} className="flex items-start gap-3 p-4 bg-slate-50 rounded-lg border border-slate-100">
<CheckCircle2 size={20} className="text-blue-600 flex-shrink-0 mt-0.5" />
<span className="text-slate-700">{point}</span>
</li>
))}
</ul>
</div>
</section>
<section className="py-16 bg-slate-50 border-t border-slate-100">
<div className="max-w-4xl mx-auto px-4 sm:px-6 text-center">
<h2 className="text-2xl font-bold text-slate-900 mb-4">
{lang === 'ru' ? 'Нужна консультация?' : 'Need a consultation?'}
</h2>
<p className="text-slate-600 mb-8">
{lang === 'ru' ? 'Свяжитесь с нами — обсудим детали и рассчитаем стоимость.' : 'Contact us — we will discuss details and calculate the cost.'}
</p>
<div className="flex flex-col sm:flex-row gap-4 justify-center">
<a href="tel:+74953637476" className="px-6 py-3 bg-blue-600 hover:bg-blue-500 text-white font-semibold rounded-lg transition-colors">
+7 495 363-74-76
</a>
<Link href={`/${lang}/kontakty/`}
className="px-6 py-3 border border-slate-300 hover:border-blue-300 text-slate-700 font-semibold rounded-lg transition-colors">
{lang === 'ru' ? 'Написать нам' : 'Write to us'}
</Link>
</div>
</div>
</section>
<div className="max-w-4xl mx-auto px-4 sm:px-6 py-8">
<Link href={`/${lang}/uslugi/`} className="text-blue-600 hover:text-blue-800 text-sm font-medium">
{lang === 'ru' ? 'Все услуги' : 'All services'}
</Link>
</div>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'Service',
'name': svc.title,
'description': svc.description,
'provider': {
'@type': 'Organization',
'name': 'Сисадмингрупп',
'url': 'https://sag24.ru',
},
}),
}}
/>
</div>
)
}