Files
geovektor/pages/Home.tsx

70 lines
3.3 KiB
TypeScript
Raw Normal View History

import React, { useEffect, useState } from 'react';
2026-02-10 16:22:14 +05:00
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';
2026-02-10 16:22:14 +05:00
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);
2026-02-10 16:22:14 +05:00
return (
<>
<Seo
title={seoTitle}
description={seoDescription}
/>
<Hero title={heroTitle} subtitle={heroSubtitle} />
2026-02-10 16:22:14 +05:00
<Benefits />
<Services />
<Projects />
<Laboratories />
<FleetTeaser />
2026-02-10 16:22:14 +05:00
<Process />
</>
);
};
export default Home;