Удален файл конфигурации Next.js и несколько SVG-изображений. В компоненте ContactForm и ContactModal улучшена обработка ошибок и добавлена динамическая классовая логика для отображения состояния ошибки. В компоненте Hero также обновлена логика классов. Упрощен компонент Input. Удалены неиспользуемые импорты в компоненте Contacts.

This commit is contained in:
Bivekich
2025-04-03 17:28:15 +03:00
parent 9b75339c1e
commit 8657c49026
19 changed files with 142 additions and 48 deletions

View File

@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { formatPhoneNumber, validatePhoneNumber } from '@/lib/utils';
import { sendTelegramNotification } from '@/lib/telegram';
import { cn } from '@/lib/utils';
const ContactForm = () => {
const [phone, setPhone] = useState('');
@ -47,7 +48,7 @@ const ContactForm = () => {
'Произошла ошибка при отправке заявки. Пожалуйста, попробуйте позже.'
);
}
} catch (error) {
} catch {
setError(
'Произошла ошибка при отправке заявки. Пожалуйста, попробуйте позже.'
);
@ -184,7 +185,7 @@ const ContactForm = () => {
placeholder="+7 (999) 999-99-99"
value={phone}
onChange={handlePhoneChange}
className="pl-10"
className={cn('pl-10', error && 'border-red-500')}
required
disabled={isLoading || isSubmitted}
/>

View File

@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { formatPhoneNumber, validatePhoneNumber } from '@/lib/utils';
import { sendTelegramNotification } from '@/lib/telegram';
import { cn } from '@/lib/utils';
interface ContactModalProps {
isOpen: boolean;
@ -51,7 +52,7 @@ const ContactModal = ({ isOpen, onClose }: ContactModalProps) => {
'Произошла ошибка при отправке заявки. Пожалуйста, попробуйте позже.'
);
}
} catch (error) {
} catch {
setError(
'Произошла ошибка при отправке заявки. Пожалуйста, попробуйте позже.'
);
@ -124,7 +125,7 @@ const ContactModal = ({ isOpen, onClose }: ContactModalProps) => {
placeholder="+7 (999) 999-99-99"
value={phone}
onChange={handlePhoneChange}
className="pl-10"
className={cn('pl-10', error && 'border-red-500')}
required
disabled={isLoading || isSubmitted}
/>

View File

@ -11,7 +11,6 @@ import {
MessagesSquare,
FileText,
} from 'lucide-react';
import { Button } from '@/components/ui/button';
const cityContacts = {
Москва: {

View File

@ -8,6 +8,7 @@ import { Phone, CheckCircle2, AlertCircle } from 'lucide-react';
import { formatPhoneNumber, validatePhoneNumber } from '@/lib/utils';
import { sendTelegramNotification } from '@/lib/telegram';
import ContactModal from './ContactModal';
import { cn } from '@/lib/utils';
const Hero = () => {
const [phone, setPhone] = useState('');
@ -47,7 +48,7 @@ const Hero = () => {
'Произошла ошибка при отправке заявки. Пожалуйста, попробуйте позже.'
);
}
} catch (error) {
} catch {
setError(
'Произошла ошибка при отправке заявки. Пожалуйста, попробуйте позже.'
);
@ -134,7 +135,10 @@ const Hero = () => {
placeholder="+7 (999) 999-99-99"
value={phone}
onChange={handlePhoneChange}
className="pl-10 bg-white/10 border-white/20 text-white placeholder:text-blue-200 focus:border-white"
className={cn(
'pl-10 bg-white/10 border-white/20 text-white placeholder:text-blue-200 focus:border-white',
error && 'border-red-300'
)}
required
disabled={isLoading || isSubmitted}
/>

View File

@ -94,17 +94,6 @@ const WorkFlow = () => {
},
};
const lineVariants = {
hidden: { width: 0 },
visible: {
width: '100%',
transition: {
duration: 0.8,
ease: 'easeInOut',
},
},
};
return (
<section ref={ref} className="py-20 bg-gray-50" id="workflow">
<div className="container mx-auto px-4">