Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e7b2b8e27f | |||
| 9e3f5a8a9f | |||
| 7f169d392f | |||
| d163d36bea |
61
src/app/api/contact/route.ts
Normal file
61
src/app/api/contact/route.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
interface ContactRequest {
|
||||
email: string;
|
||||
}
|
||||
|
||||
interface ContactResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
email?: string;
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest): Promise<NextResponse<ContactResponse>> {
|
||||
try {
|
||||
const body: ContactRequest = await request.json();
|
||||
const { email } = body;
|
||||
|
||||
// Validation: email field is required
|
||||
if (!email) {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: 'Email is required' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
// Validation: basic email format check
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
if (!emailRegex.test(email)) {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: 'Please provide a valid email address' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: Integrate with actual backend service
|
||||
// This could be:
|
||||
// - Email service (SendGrid, Mailgun, AWS SES)
|
||||
// - Database storage
|
||||
// - CRM integration
|
||||
// - Webhook to external service
|
||||
|
||||
// For now, log the contact request
|
||||
console.log('Contact form submission:', { email, timestamp: new Date().toISOString() });
|
||||
|
||||
// Simulate successful submission
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: 'Thank you for your interest! We will be in touch shortly.',
|
||||
email
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('Contact form error:', error);
|
||||
return NextResponse.json(
|
||||
{ success: false, message: 'An error occurred while processing your request. Please try again.' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,18 @@ import FooterSimple from "@/components/sections/footer/FooterSimple";
|
||||
import { Award, CheckCircle, DollarSign, Heart, Shield, Zap } from "lucide-react";
|
||||
|
||||
export default function LandingPage() {
|
||||
// Form submission handler with validation
|
||||
const handleContactSubmit = (email: string) => {
|
||||
if (!email || !email.includes("@")) {
|
||||
console.error("Invalid email format");
|
||||
alert("Please enter a valid email address");
|
||||
return;
|
||||
}
|
||||
console.log("Contact form submitted with email:", email);
|
||||
// In production, this would send to a backend API
|
||||
alert("Thank you for subscribing! We'll send you plumbing tips soon.");
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
defaultButtonVariant="bounce-effect"
|
||||
@@ -87,17 +99,41 @@ export default function LandingPage() {
|
||||
useInvertedBackground={false}
|
||||
features={[
|
||||
{
|
||||
id: "1", title: "Plumbing Repairs", description: "Quick fixes for leaks, clogs, and broken fixtures. We identify and resolve issues efficiently.", tag: "Expert Service", imageSrc: "http://img.b2bpic.net/free-photo/handyman-helping-senior-woman-kitchen_1098-17865.jpg", imageAlt: "plumbing pipe repair maintenance work"},
|
||||
id: "1", title: "Plumbing Repairs", description: "Quick fixes for leaks, clogs, and broken fixtures. We identify and resolve issues efficiently.", tag: "Expert Service", imageSrc: "http://img.b2bpic.net/free-photo/handyman-helping-senior-woman-kitchen_1098-17865.jpg", imageAlt: "plumbing pipe repair maintenance work", buttons: [
|
||||
{
|
||||
text: "Get Quote", href: "tel:(309)685-3903"},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "2", title: "Water Heater Replacement", description: "Expert installation and replacement of water heaters. Hot water when you need it, reliability you can trust.", tag: "Quality Work", imageSrc: "http://img.b2bpic.net/free-photo/electrician-is-mounting-electric-sockets-white-wall-indoors_169016-17661.jpg", imageAlt: "water heater installation replacement residential"},
|
||||
id: "2", title: "Water Heater Replacement", description: "Expert installation and replacement of water heaters. Hot water when you need it, reliability you can trust.", tag: "Quality Work", imageSrc: "http://img.b2bpic.net/free-photo/electrician-is-mounting-electric-sockets-white-wall-indoors_169016-17661.jpg", imageAlt: "water heater installation replacement residential", buttons: [
|
||||
{
|
||||
text: "Get Quote", href: "tel:(309)685-3903"},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "3", title: "Leak Detection", description: "Advanced detection techniques to find hidden leaks before they cause expensive damage to your home.", tag: "Preventative Care", imageSrc: "http://img.b2bpic.net/free-photo/plumbing-professional-doing-his-job_23-2150721547.jpg", imageAlt: "detecting water leak detection equipment"},
|
||||
id: "3", title: "Leak Detection", description: "Advanced detection techniques to find hidden leaks before they cause expensive damage to your home.", tag: "Preventative Care", imageSrc: "http://img.b2bpic.net/free-photo/plumbing-professional-doing-his-job_23-2150721547.jpg", imageAlt: "detecting water leak detection equipment", buttons: [
|
||||
{
|
||||
text: "Get Quote", href: "tel:(309)685-3903"},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "4", title: "Drain Issues", description: "Unclogging and drain cleaning that gets your water flowing smoothly again, guaranteed.", tag: "Fast Solutions", imageSrc: "http://img.b2bpic.net/free-photo/male-plumber-working-fix-problems-client-s-house_23-2150990704.jpg", imageAlt: "drain cleaning unclogging plumbing service"},
|
||||
id: "4", title: "Drain Issues", description: "Unclogging and drain cleaning that gets your water flowing smoothly again, guaranteed.", tag: "Fast Solutions", imageSrc: "http://img.b2bpic.net/free-photo/male-plumber-working-fix-problems-client-s-house_23-2150990704.jpg", imageAlt: "drain cleaning unclogging plumbing service", buttons: [
|
||||
{
|
||||
text: "Get Quote", href: "tel:(309)685-3903"},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "5", title: "Heating System Service", description: "Maintenance, repair, and installation of heating systems to keep your home warm and comfortable.", tag: "Year-Round Care", imageSrc: "http://img.b2bpic.net/free-photo/building-construction-worker-site_23-2149124294.jpg", imageAlt: "heating system maintenance furnace repair"},
|
||||
id: "5", title: "Heating System Service", description: "Maintenance, repair, and installation of heating systems to keep your home warm and comfortable.", tag: "Year-Round Care", imageSrc: "http://img.b2bpic.net/free-photo/building-construction-worker-site_23-2149124294.jpg", imageAlt: "heating system maintenance furnace repair", buttons: [
|
||||
{
|
||||
text: "Get Quote", href: "tel:(309)685-3903"},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "6", title: "Emergency Plumbing", description: "Available 24/7 for emergencies. We respond quickly and fix problems that can't wait.", tag: "Always Available", imageSrc: "http://img.b2bpic.net/free-photo/furious-young-blonde-handsome-man-sits-table-with-cup-talking-phone-putting-hand-temple-looking-side-inside-living-room_141793-67542.jpg", imageAlt: "emergency plumbing pipe burst response"},
|
||||
id: "6", title: "Emergency Plumbing", description: "Available 24/7 for emergencies. We respond quickly and fix problems that can't wait.", tag: "Always Available", imageSrc: "http://img.b2bpic.net/free-photo/furious-young-blonde-handsome-man-sits-table-with-cup-talking-phone-putting-hand-temple-looking-side-inside-living-room_141793-67542.jpg", imageAlt: "emergency plumbing pipe burst response", buttons: [
|
||||
{
|
||||
text: "Call Now", href: "tel:(309)685-3903"},
|
||||
],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
@@ -202,6 +238,7 @@ export default function LandingPage() {
|
||||
inputPlaceholder="Enter your email"
|
||||
buttonText="Subscribe for Tips"
|
||||
termsText="We respect your privacy and will never spam you. Unsubscribe anytime."
|
||||
onSubmit={handleContactSubmit}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user