From 8332e5764da49b0c05af728838789402bade93c9 Mon Sep 17 00:00:00 2001 From: selvi Date: Wed, 24 Dec 2025 21:26:57 +0530 Subject: [PATCH] sitemap, contact, selenium updated --- app/contact/page.tsx | 142 +++++++++- app/layout.tsx | 6 + components/Hero.module.css | 22 +- components/Navbar.module.css | 9 +- components/Navbar.tsx | 11 +- components/ScrollToTop.module.css | 45 +++ components/ScrollToTop.tsx | 39 +++ package-lock.json | 446 ++++++++++++++++++++++++++++-- package.json | 13 +- public/sitemap.xml | 1 + scripts/generate-sitemap.js | 124 +++++++++ scripts/image_alt_issues.csv | 69 +++++ scripts/seo-test-selenium.js | 261 +++++++++++++++++ 13 files changed, 1147 insertions(+), 41 deletions(-) create mode 100644 components/ScrollToTop.module.css create mode 100644 components/ScrollToTop.tsx create mode 100644 public/sitemap.xml create mode 100644 scripts/generate-sitemap.js create mode 100644 scripts/image_alt_issues.csv create mode 100644 scripts/seo-test-selenium.js diff --git a/app/contact/page.tsx b/app/contact/page.tsx index 2bc5c57..9fa3def 100644 --- a/app/contact/page.tsx +++ b/app/contact/page.tsx @@ -1,12 +1,33 @@ 'use client'; -import { useState } from 'react'; +import { useState, useEffect, ChangeEvent, FormEvent } from 'react'; import type { Metadata } from 'next'; import { Phone, Mail, MapPin, Instagram, Facebook, Twitter, Youtube } from 'lucide-react'; +import ReCAPTCHA from "react-google-recaptcha"; +import axios from "axios"; import styles from './contact.module.css'; +interface FormData { + name: string; + phone: string; + email: string; + subject: string; + message: string; + company: string; +} + +interface FormErrors { + name?: string; + phone?: string; + email?: string; + subject?: string; + message?: string; + company?: string; + captcha?: string; +} + export default function ContactPage() { - const [formData, setFormData] = useState({ + const [formData, setFormData] = useState({ name: '', email: '', company: '', @@ -15,20 +36,85 @@ export default function ContactPage() { phone: '', }); - const handleChange = (e: React.ChangeEvent) => { + const [formErrors, setFormErrors] = useState({}); + const [captchaToken, setCaptchaToken] = useState(null); + const [alert, setAlert] = useState<{ show: boolean; type: string; message: string }>({ + show: false, + type: "", + message: "", + }); + + const handleChange = (e: ChangeEvent) => { setFormData({ ...formData, [e.target.name]: e.target.value, }); }; - const handleSubmit = (e: React.FormEvent) => { - e.preventDefault(); - // Handle form submission - console.log('Form submitted:', formData); - alert('Thank you for your message! We\'ll get back to you soon.'); + const handleCaptchaChange = (token: string | null) => { + setCaptchaToken(token); }; + const handleSubmit = async (e: FormEvent) => { + e.preventDefault(); + + const errors: FormErrors = {}; + if (!formData.name.trim()) errors.name = "Name is required."; + if (!formData.phone.trim()) errors.phone = "Phone number is required."; + if (!formData.email.trim()) errors.email = "Email is required."; + if (!formData.subject.trim()) errors.subject = "Subject is required."; + if (!formData.message.trim()) errors.message = "Message is required."; + if (!captchaToken) errors.captcha = "Please verify the CAPTCHA."; + + setFormErrors(errors); + if (Object.keys(errors).length > 0) return; + + const emailData = { + ...formData, + message: ` + Name: ${formData.name}
+ Phone: ${formData.phone}
+ Email: ${formData.email}
+ Subject: ${formData.subject}

+ Message:
${formData.message} + `, + to: "info@metatroncubesolutions.com", + senderName: "SocialBuddy Contact Form", + recaptchaToken: captchaToken, + }; + + try { + const res = await axios.post("https://mailserver.metatronnest.com/send", emailData, { + headers: { "Content-Type": "application/json" }, + }); + + setAlert({ + show: true, + type: "success", + message: res?.data?.message || "Message sent successfully!", + }); + + setFormData({ name: "", phone: "", email: "", subject: "", message: "", company: "" }); + setCaptchaToken(null); + setFormErrors({}); + } catch { + setAlert({ + show: true, + type: "danger", + message: "Failed to send message. Please try again later.", + }); + } + }; + + useEffect(() => { + if (alert.show) { + const timer = setTimeout(() => { + setAlert(prev => ({ ...prev, show: false })); + }, 5000); + return () => clearTimeout(timer); + } + }, [alert.show]); + const contactInfoCards = [ { icon: , @@ -133,6 +219,11 @@ export default function ContactPage() { {/* Right Side: Form */}
+ {alert.show && ( +
+ {alert.message} +
+ )}
@@ -145,8 +236,8 @@ export default function ContactPage() { value={formData.email} onChange={handleChange} className={styles.input} - required /> + {formErrors.email && {formErrors.email}}
@@ -158,8 +249,8 @@ export default function ContactPage() { value={formData.name} onChange={handleChange} className={styles.input} - required /> + {formErrors.name && {formErrors.name}}
@@ -168,10 +259,27 @@ export default function ContactPage() { + {formErrors.phone && {formErrors.phone}} +
+ +
+ + + {formErrors.subject && {formErrors.subject}}
@@ -184,12 +292,20 @@ export default function ContactPage() { onChange={handleChange} className={styles.textarea} rows={5} - required /> + {formErrors.message && {formErrors.message}} +
+ +
+ + {formErrors.captcha && {formErrors.captcha}}
diff --git a/app/layout.tsx b/app/layout.tsx index c55d0a8..076a656 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -2,8 +2,13 @@ import type { Metadata } from "next"; import "./globals.css"; import Navbar from "@/components/Navbar"; import Footer from "@/components/Footer"; +import ScrollToTop from "@/components/ScrollToTop"; export const metadata: Metadata = { + metadataBase: new URL("https://socialbuddy-marketing.metatronnest.com"), + alternates: { + canonical: "./", + }, title: "SocialBuddy - Manage All Your Social Media in One Place", description: "Empowering businesses and creators to schedule posts, analyze performance, engage with audiences, and grow their social presence with powerful tools and analytics.", keywords: ["social media management", "social media scheduler", "social media analytics", "content calendar", "social media tools"], @@ -47,6 +52,7 @@ export default function RootLayout({ {children} +