home contact section correction updated

This commit is contained in:
akash 2026-01-22 00:46:43 +05:30
parent 08c3ebb39d
commit 43acd616a5
2 changed files with 26 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import styles from './BookTable.module.css'
interface FormErrors { interface FormErrors {
name?: string; name?: string;
email?: string;
phone?: string; phone?: string;
date?: string; date?: string;
captcha?: string; captcha?: string;
@ -24,6 +25,7 @@ export default function BookTable() {
const [formData, setFormData] = useState({ const [formData, setFormData] = useState({
name: "", name: "",
email: "",
phone: "", phone: "",
date: "", date: "",
message: "", message: "",
@ -52,6 +54,7 @@ export default function BookTable() {
const errors: FormErrors = {}; const errors: FormErrors = {};
if (!formData.name.trim()) errors.name = "Name is required."; if (!formData.name.trim()) errors.name = "Name is required.";
if (!formData.email.trim()) errors.email = "Email is required.";
if (!formData.phone.trim()) errors.phone = "Phone is required."; if (!formData.phone.trim()) errors.phone = "Phone is required.";
if (!formData.date.trim()) errors.date = "Date is required."; if (!formData.date.trim()) errors.date = "Date is required.";
if (!captchaToken) errors.captcha = "Please verify the CAPTCHA."; if (!captchaToken) errors.captcha = "Please verify the CAPTCHA.";
@ -62,11 +65,12 @@ export default function BookTable() {
const emailData = { const emailData = {
name: formData.name, name: formData.name,
phone: formData.phone, phone: formData.phone,
email: email, email: formData.email,
subject: `Table Reservation - ${formData.name} on ${formData.date}`, subject: `Table Reservation - ${formData.name} on ${formData.date}`,
message: ` message: `
<strong>Reservation Details:</strong><br/> <strong>Reservation Details:</strong><br/>
Name: ${formData.name}<br/> Name: ${formData.name}<br/>
Email: ${formData.email}<br/>
Phone: ${formData.phone}<br/> Phone: ${formData.phone}<br/>
Date: ${formData.date}<br/><br/> Date: ${formData.date}<br/><br/>
<strong>Message:</strong><br/> <strong>Message:</strong><br/>
@ -92,6 +96,7 @@ export default function BookTable() {
setFormData({ setFormData({
name: "", name: "",
email: "",
phone: "", phone: "",
date: "", date: "",
message: "", message: "",
@ -166,6 +171,23 @@ export default function BookTable() {
{formErrors.name && <small className={styles.errorText}>{formErrors.name}</small>} {formErrors.name && <small className={styles.errorText}>{formErrors.name}</small>}
</div> </div>
{/* Email Input with Placeholder */}
<div className={styles.inputGroup}>
<label htmlFor="email" className={styles.label}>Email *</label>
<input
type="email"
id="email"
name="email"
required
className={styles.input}
placeholder="Email"
value={formData.email}
onChange={handleChange}
suppressHydrationWarning
/>
{formErrors.email && <small className={styles.errorText}>{formErrors.email}</small>}
</div>
{/* Phone Input with Placeholder */} {/* Phone Input with Placeholder */}
<div className={styles.inputGroup}> <div className={styles.inputGroup}>
<label htmlFor="phone" className={styles.label}>Phone *</label> <label htmlFor="phone" className={styles.label}>Phone *</label>

View File

@ -95,7 +95,9 @@ export default function Testimonials() {
const errorData = await res.json(); const errorData = await res.json();
details = errorData.details || errorData.error || "No details"; details = errorData.details || errorData.error || "No details";
} catch (e) { } } catch (e) { }
throw new Error(`HTTP error! status: ${res.status} - ${details}`); console.error(`HTTP error! status: ${res.status} - ${details}`);
setLoading(false);
return;
} }
const text = await res.text(); const text = await res.text();
let dataAt; let dataAt;