-
+
{/* Desktop nav */}
diff --git a/src/components/ScrollToTop.jsx b/src/components/ScrollToTop.jsx
new file mode 100644
index 0000000..28b9e2d
--- /dev/null
+++ b/src/components/ScrollToTop.jsx
@@ -0,0 +1,24 @@
+import React, { useEffect, useState } from 'react'
+import { ChevronUp } from 'lucide-react'
+
+export default function ScrollToTop() {
+ const [visible, setVisible] = useState(false)
+
+ useEffect(() => {
+ const onScroll = () => setVisible(window.scrollY > 400)
+ window.addEventListener('scroll', onScroll, { passive: true })
+ return () => window.removeEventListener('scroll', onScroll)
+ }, [])
+
+ if (!visible) return null
+
+ return (
+
+ )
+}
diff --git a/src/config.js b/src/config.js
new file mode 100644
index 0000000..7a59350
--- /dev/null
+++ b/src/config.js
@@ -0,0 +1,5 @@
+// Настройки для связи и формы
+export const WHATSAPP_PHONE = '74953637476' // без +
+export const TELEGRAM_USERNAME = 'sag24ru' // @username без @
+export const FORM_ENDPOINT = '' // https://formspree.io/f/XXXXXXX — оставить пустым, будет mailto:
+export const EMAIL = 'info@sag24.ru'
diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx
index b455d5a..228c670 100644
--- a/src/pages/Home.jsx
+++ b/src/pages/Home.jsx
@@ -1,7 +1,8 @@
import React, { useState } from 'react'
-import { ChevronRight, Server, Shield, Headphones, Phone, Mail, MapPin, CheckCircle2 } from 'lucide-react'
+import { ChevronRight, Server, Shield, Headphones, Phone, Mail, MapPin, CheckCircle2, ChevronDown } from 'lucide-react'
import { useLanguage } from '../contexts/LanguageContext.jsx'
import { useReveal } from '../components/useReveal.js'
+import { FORM_ENDPOINT, EMAIL } from '../config.js'
const serviceIcons = [Server, Shield, Headphones]
@@ -26,20 +27,69 @@ function ServiceCard({ icon: Icon, title, description, points }) {
)
}
+function FaqItem({ q, a }) {
+ const [open, setOpen] = useState(false)
+ return (
+
+
+ {open && (
+
+ {a}
+
+ )}
+
+ )
+}
+
export default function Home() {
const { t } = useLanguage()
- const [formState, setFormState] = useState({ name: '', company: '', message: '' })
+ const [formState, setFormState] = useState({ name: '', company: '', phone: '', message: '' })
const [submitted, setSubmitted] = useState(false)
+ const [sending, setSending] = useState(false)
+ const [error, setError] = useState('')
const aboutRef = useReveal()
const contactRef = useReveal()
+ const faqRef = useReveal()
const services = t('services.items')
const stats = [t('about.stat1'), t('about.stat2'), t('about.stat3')]
+ const faqItems = t('faq.items')
+ const firstPhone = t('contact.phones')[0]
- const handleSubmit = (e) => {
+ const handleSubmit = async (e) => {
e.preventDefault()
- setSubmitted(true)
+ setSending(true)
+ setError('')
+
+ if (FORM_ENDPOINT) {
+ try {
+ const res = await fetch(FORM_ENDPOINT, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
+ body: JSON.stringify(formState),
+ })
+ if (res.ok) {
+ setSubmitted(true)
+ } else {
+ setError(t('contact.formError'))
+ }
+ } catch {
+ setError(t('contact.formError'))
+ }
+ } else {
+ // Fallback: mailto
+ const body = `Имя: ${formState.name}\nКомпания: ${formState.company}\nТелефон: ${formState.phone}\n\n${formState.message}`
+ window.location.href = `mailto:${EMAIL}?subject=Заявка с сайта sag24.ru&body=${encodeURIComponent(body)}`
+ setSubmitted(true)
+ }
+ setSending(false)
}
return (
@@ -61,7 +111,7 @@ export default function Home() {
{t('hero.subtitle')}
-
@@ -165,6 +219,23 @@ export default function Home() {
+ {/* FAQ */}
+