This commit is contained in:
belikovme 2024-11-25 13:05:22 +07:00
parent e650e52386
commit 9d3f51aa05
3 changed files with 51 additions and 10 deletions

View File

@ -134,15 +134,55 @@ export default function ContactBlock() {
const { language } = useLanguage(); const { language } = useLanguage();
const t = translations.contacts[language]; const t = translations.contacts[language];
function sendMessage(text)
{
const url = `https://api.telegram.org/bot8190149729:AAH1n6QXzaU__EwRhrPbEn9fqrFbPRRLFaI/sendMessage` // The url to request
const obj = {
chat_id: 1017685666, // Telegram chat id
text: text // The text to send
};
const xht = new XMLHttpRequest();
xht.open("POST", url, true);
xht.setRequestHeader("Content-type", "application/json; charset=UTF-8");
xht.send(JSON.stringify(obj));
}
const [formData, setFormData] = useState({ const [formData, setFormData] = useState({
name: '', name: '',
email: '', email: '',
message: '' message: ''
}); });
// const handleSubmit = (e) => {
// e.preventDefault();
// console.log('Form submitted:', formData);
// };
const handleSubmit = (e) => { const handleSubmit = (e) => {
e.preventDefault(); e.preventDefault();
console.log('Form submitted:', formData);
// Формируем текст сообщения для Telegram
const messageText = `
Новое сообщение с сайта:
👤 Имя: ${formData.name}
📧 Email: ${formData.email}
💬 Сообщение: ${formData.message}
`.trim();
// Отправляем сообщение в Telegram
sendMessage(messageText);
// Очищаем форму после отправки
setFormData({
name: '',
email: '',
message: ''
});
// Показываем уведомление об успешной отправке
// alert(language === 'ru' ? 'Сообщение успешно отправлено!' : 'Message sent successfully!');
}; };
const handleChange = (e) => { const handleChange = (e) => {
@ -242,7 +282,6 @@ export default function ContactBlock() {
/> />
</div> </div>
<button <button
type="submit" type="submit"
className="w-full bg-[#000000] text-white font-medium py-2 px-4 rounded-md hover:bg-[#90c95c] transition-colors duration-200" className="w-full bg-[#000000] text-white font-medium py-2 px-4 rounded-md hover:bg-[#90c95c] transition-colors duration-200"
> >

View File

@ -2,6 +2,7 @@ import React, { useState } from 'react';
import { Minus, Plus } from 'lucide-react'; import { Minus, Plus } from 'lucide-react';
import translations from '../translations.json'; import translations from '../translations.json';
import { useLanguage } from '../contexts/LanguageContext'; import { useLanguage } from '../contexts/LanguageContext';
import {Button} from 'antd';
const DynamicPricing = () => { const DynamicPricing = () => {
const { language } = useLanguage(); const { language } = useLanguage();
@ -79,7 +80,6 @@ const DynamicPricing = () => {
<div className="flex items-center"> <div className="flex items-center">
<span className="mr-2">{t.accounts}</span> <span className="mr-2">{t.accounts}</span>
<button <button
href="http://app.qwickpost.com/"
onClick={decreaseAccounts} onClick={decreaseAccounts}
className="p-1 rounded-full hover:bg-white transition-colors" className="p-1 rounded-full hover:bg-white transition-colors"
disabled={accountCount <= 5} disabled={accountCount <= 5}
@ -118,11 +118,12 @@ const DynamicPricing = () => {
/{t.mounth} /{t.mounth}
</span> </span>
</div> </div>
<button <Button
href="http://app.qwickpost.com/"
className="w-full py-3 px-4 rounded-lg bg-green-500 text-white font-medium mb-8" className="w-full py-3 px-4 rounded-lg bg-green-500 text-white font-medium mb-8"
> >
{plan === 'premium' ? t.startButton : t.tryButton} {plan === 'premium' ? t.startButton : t.tryButton}
</button> </Button>
<ul className="space-y-3"> <ul className="space-y-3">
{t.features[plan].features.map((feature, index) => ( {t.features[plan].features.map((feature, index) => (
<li key={index} className="flex items-center gap-2"> <li key={index} className="flex items-center gap-2">

View File

@ -159,15 +159,16 @@ const PricingPlans = () => {
))} ))}
</ul> </ul>
</div> </div>
<button <a
className={`w-full py-2 px-4 rounded-md text-lg font-semibold transition-colors ${ href='http://app.qwickpost.com/'
className={`w-full py-2 px-4 rounded-md text-lg text-center font-semibold transition-colors ${
plan.popular plan.popular
? 'bg-green-500 text-white hover:bg-green-600' ? 'bg-green-500 text-white hover:bg-green-600'
: 'bg-white text-green-500 border border-green-500 hover:bg-green-50' : 'bg-white text-green-500 border border-green-500 hover:bg-green-50'
}`} }`}
> >
{plan.buttonText} {plan.buttonText}
</button> </a>
</div> </div>
))} ))}
</div> </div>