diff --git a/client/src/components/contact/contact-section.tsx b/client/src/components/contact/contact-section.tsx index 3ad5e01..df372b3 100644 --- a/client/src/components/contact/contact-section.tsx +++ b/client/src/components/contact/contact-section.tsx @@ -1,65 +1,81 @@ -import { useState } from "react"; -import { useMutation } from "@tanstack/react-query"; -import { apiRequest } from "@/lib/queryClient"; -import { insertContactMessageSchema } from "@shared/schema"; -import { useToast } from "@/hooks/use-toast"; -import { Loader2 } from "lucide-react"; +import { useEffect, useRef } from "react"; export function ContactSection() { - const { toast } = useToast(); - const [formData, setFormData] = useState({ - name: "", - email: "", - subject: "", - message: "" - }); + const formContainerRef = useRef(null); - const contactMutation = useMutation({ - mutationFn: async (data: typeof formData) => { - const res = await apiRequest("POST", "/api/contact", data); - return await res.json(); - }, - onSuccess: () => { - toast({ - title: "Message sent", - description: "Thank you for your message. We'll get back to you soon!", - }); - // Reset form - setFormData({ - name: "", - email: "", - subject: "", - message: "" - }); - }, - onError: (error: Error) => { - toast({ - title: "Failed to send message", - description: error.message, - variant: "destructive", - }); - }, - }); + useEffect(() => { + // Define the Mailchimp form HTML + const mailchimpFormHTML = ` + +
+
- const handleChange = (e: React.ChangeEvent) => { - const { name, value } = e.target; - setFormData(prev => ({ ...prev, [name]: value })); - }; +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + +
+ + `; - const handleSubmit = (e: React.FormEvent) => { - e.preventDefault(); - - if (!formData.name || !formData.email || !formData.message) { - toast({ - title: "Missing information", - description: "Please fill out all required fields", - variant: "destructive", - }); - return; + // Insert the form into the DOM + if (formContainerRef.current) { + formContainerRef.current.innerHTML = mailchimpFormHTML; } - - contactMutation.mutate(formData); - }; + }, []); return (
@@ -74,74 +90,8 @@ export function ContactSection() {
-
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- - -
+
+ {/* Mailchimp form will be inserted here by the useEffect hook */}
diff --git a/package-lock.json b/package-lock.json index 6be374e..035c9a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,6 +39,7 @@ "@radix-ui/react-toggle": "^1.1.3", "@radix-ui/react-toggle-group": "^1.1.3", "@radix-ui/react-tooltip": "^1.2.0", + "@sendgrid/mail": "^8.1.5", "@tailwindcss/vite": "^4.1.3", "@tanstack/react-query": "^5.60.5", "@types/nodemailer": "^6.4.17", @@ -2957,6 +2958,44 @@ "win32" ] }, + "node_modules/@sendgrid/client": { + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/@sendgrid/client/-/client-8.1.5.tgz", + "integrity": "sha512-Jqt8aAuGIpWGa15ZorTWI46q9gbaIdQFA21HIPQQl60rCjzAko75l3D1z7EyjFrNr4MfQ0StusivWh8Rjh10Cg==", + "license": "MIT", + "dependencies": { + "@sendgrid/helpers": "^8.0.0", + "axios": "^1.8.2" + }, + "engines": { + "node": ">=12.*" + } + }, + "node_modules/@sendgrid/helpers": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@sendgrid/helpers/-/helpers-8.0.0.tgz", + "integrity": "sha512-Ze7WuW2Xzy5GT5WRx+yEv89fsg/pgy3T1E3FS0QEx0/VvRmigMZ5qyVGhJz4SxomegDkzXv/i0aFPpHKN8qdAA==", + "license": "MIT", + "dependencies": { + "deepmerge": "^4.2.2" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/@sendgrid/mail": { + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/@sendgrid/mail/-/mail-8.1.5.tgz", + "integrity": "sha512-W+YuMnkVs4+HA/bgfto4VHKcPKLc7NiZ50/NH2pzO6UHCCFuq8/GNB98YJlLEr/ESDyzAaDr7lVE7hoBwFTT3Q==", + "license": "MIT", + "dependencies": { + "@sendgrid/client": "^8.1.5", + "@sendgrid/helpers": "^8.0.0" + }, + "engines": { + "node": ">=12.*" + } + }, "node_modules/@tailwindcss/node": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.3.tgz", @@ -4283,6 +4322,15 @@ "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==", "license": "MIT" }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", diff --git a/package.json b/package.json index 1d34a8b..6c83117 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "@radix-ui/react-toggle": "^1.1.3", "@radix-ui/react-toggle-group": "^1.1.3", "@radix-ui/react-tooltip": "^1.2.0", + "@sendgrid/mail": "^8.1.5", "@tailwindcss/vite": "^4.1.3", "@tanstack/react-query": "^5.60.5", "@types/nodemailer": "^6.4.17",