import { useState, useEffect } from 'react' import { Header } from './components/Header' import { Footer } from './components/Footer' import { ContactModal } from './components/ContactModal' import { HomePage } from './pages/HomePage' import { CloudPage } from './pages/CloudPage' import { RussianSoftwarePage } from './pages/RussianSoftwarePage' import { CybersecurityPage } from './pages/CybersecurityPage' import { AISolutionsPage } from './pages/AISolutionsPage' import { RussianHardwarePage } from './pages/RussianHardwarePage' import { HardwareSolutionsPage } from './pages/HardwareSolutionsPage' import { CADandGISPage } from './pages/CADandGISPage' import { IndustrialSolutionsPage } from './pages/IndustrialSolutionsPage' import { GovernmentPage } from './pages/GovernmentPage' import { BusinessPage } from './pages/BusinessPage' import { ConsultingPage } from './pages/ConsultingPage' import { ImplementationPage } from './pages/ImplementationPage' import { ManagedServicesPage } from './pages/ManagedServicesPage' import { IntegrationPage } from './pages/IntegrationPage' import { SpecializedServicesPage } from './pages/SpecializedServicesPage' import { SupportPage } from './pages/SupportPage' import { SubscriptionPage } from './pages/SubscriptionPage' export default function App() { const [currentPage, setCurrentPage] = useState('home') const [pendingScroll, setPendingScroll] = useState(null) const [isContactModalOpen, setIsContactModalOpen] = useState(false) const scrollToSection = (sectionId: string) => { // Даем странице время отрендериться setTimeout(() => { const section = document.getElementById(sectionId) console.log('Trying to scroll to:', sectionId, 'Found element:', section) if (section) { const headerHeight = 85 // Header высота + минимальный отступ const targetPosition = section.offsetTop - headerHeight console.log('Scrolling to position:', targetPosition) window.scrollTo({ top: targetPosition, behavior: 'smooth', }) } else { console.error('Section not found:', sectionId) } }, 100) } const handleNavigate = (page: string, section?: string) => { if (section) { // Клик на Кейсы/О компании/Контакты if (currentPage !== 'home') { // Если не на главной - переходим туда setCurrentPage('home') setPendingScroll(section) } else { // Уже на главной - скроллим сразу scrollToSection(section) } } else { // Обычная навигация на другие страницы setCurrentPage(page) setPendingScroll(null) window.scrollTo({ top: 0, behavior: 'smooth' }) } } useEffect(() => { // Когда вернулись на главную с отложенным скроллом if (currentPage === 'home' && pendingScroll) { scrollToSection(pendingScroll) setPendingScroll(null) } }, [currentPage, pendingScroll]) const handleBackToHome = () => { setCurrentPage('home') setPendingScroll(null) window.scrollTo({ top: 0, behavior: 'smooth' }) } const renderPage = () => { switch (currentPage) { case 'cloud': return case 'russian-software': return case 'cybersecurity': return case 'ai-solutions': return case 'russian-hardware': return case 'hardware-solutions': return case 'cad-gis': return case 'industrial-solutions': return case 'government': return case 'business': return case 'consulting': return case 'implementation': return case 'managed-services': return case 'integration': return case 'specialized-services': return case 'support': return case 'subscription': return default: return setIsContactModalOpen(true)} /> } } return (
{renderPage()}
) }