- simplify main navigation and hide extra menu items - make home page more sales-focused with updated hero, benefits and fleet teaser - add RU/EN handling for home and contacts, including SEO defaults - integrate basic Strapi homepage API client (no breaking changes) - update contacts page with messenger buttons and dynamic footer year Made-with: Cursor
70 lines
3.3 KiB
TypeScript
70 lines
3.3 KiB
TypeScript
import React, { useEffect, useState } from 'react';
|
||
import Hero from '../components/Hero';
|
||
import Benefits from '../components/Benefits';
|
||
import Services from '../components/Services';
|
||
import Projects from '../components/Projects';
|
||
import Laboratories from '../components/Laboratories';
|
||
import Process from '../components/Process';
|
||
import FleetTeaser from '../components/FleetTeaser';
|
||
import Seo from '../components/Seo';
|
||
import { getHomepage, HomepageData } from '../src/api/strapiClient';
|
||
import { useLocation } from 'react-router-dom';
|
||
|
||
const Home: React.FC = () => {
|
||
const [homepage, setHomepage] = useState<HomepageData | null>(null);
|
||
const location = useLocation();
|
||
|
||
const isEnglish = location.pathname.startsWith('/en');
|
||
const locale = isEnglish ? 'en' : 'ru';
|
||
|
||
useEffect(() => {
|
||
getHomepage(locale)
|
||
.then((data) => setHomepage(data))
|
||
.catch(() => {
|
||
// Молча используем дефолтные тексты при ошибке
|
||
});
|
||
}, [locale]);
|
||
|
||
const defaultSeoTitleRu = 'Инженерные изыскания и проектирование для сложных объектов';
|
||
const defaultSeoTitleEn = 'Engineering surveys and design for complex construction projects';
|
||
|
||
const defaultSeoDescriptionRu =
|
||
'ООО «ГеоВектор» выполняет полный комплекс инженерных изысканий и проектных работ для девелоперов, промышленных предприятий и госзаказчиков в России и других странах.';
|
||
const defaultSeoDescriptionEn =
|
||
'GeoVector provides a full range of engineering surveys and design services for developers, industrial companies and public sector clients in Russia and other regions.';
|
||
|
||
const seoTitle =
|
||
homepage?.seoTitle || (isEnglish ? defaultSeoTitleEn : defaultSeoTitleRu);
|
||
const seoDescription =
|
||
homepage?.seoDescription || (isEnglish ? defaultSeoDescriptionEn : defaultSeoDescriptionRu);
|
||
|
||
const defaultHeroTitleRu = 'Инженерные изыскания и проектирование для сложных и ответственных объектов';
|
||
const defaultHeroTitleEn = 'Engineering surveys and design for complex and demanding projects';
|
||
|
||
const defaultHeroSubtitleRu =
|
||
'ООО «ГеоВектор» — полный комплекс инженерных изысканий и проектных решений для девелоперов, промышленных предприятий и госзаказчиков в России и других странах.';
|
||
const defaultHeroSubtitleEn =
|
||
'GeoVector provides end-to-end engineering surveys and design solutions for developers, industrial companies and public sector clients in Russia and other regions.';
|
||
|
||
const heroTitle = homepage?.heroTitle || (isEnglish ? defaultHeroTitleEn : defaultHeroTitleRu);
|
||
const heroSubtitle =
|
||
homepage?.heroSubtitle || (isEnglish ? defaultHeroSubtitleEn : defaultHeroSubtitleRu);
|
||
|
||
return (
|
||
<>
|
||
<Seo
|
||
title={seoTitle}
|
||
description={seoDescription}
|
||
/>
|
||
<Hero title={heroTitle} subtitle={heroSubtitle} />
|
||
<Benefits />
|
||
<Services />
|
||
<Projects />
|
||
<Laboratories />
|
||
<FleetTeaser />
|
||
<Process />
|
||
</>
|
||
);
|
||
};
|
||
|
||
export default Home; |