From 7e810fa809dcd7c3b55471b4eafbf15e3f008f99 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:52:26 -0600 Subject: [PATCH] feat: enhance contact form with first and last name fields, integrate HubSpot submission, and update localization files --- apps/website/README.md | 15 ++- apps/website/app/[locale]/contact/page.tsx | 74 +++++++---- apps/website/app/api/contact/route.ts | 33 ++++- apps/website/lib/hubspot.ts | 138 +++++++++++++++++++++ apps/website/locales/en.json | 13 +- apps/website/locales/es.json | 11 +- apps/website/locales/fr.json | 13 +- apps/website/locales/zh-Hans.json | 13 +- 8 files changed, 266 insertions(+), 44 deletions(-) create mode 100644 apps/website/lib/hubspot.ts diff --git a/apps/website/README.md b/apps/website/README.md index 693a4a8..5a7f037 100644 --- a/apps/website/README.md +++ b/apps/website/README.md @@ -2,6 +2,8 @@ Main Landing Page of Dokploy +## Development + Run development server: ```bash @@ -14,9 +16,20 @@ yarn dev Open http://localhost:3000 with your browser to see the result. +## Environment Variables -For Blog Page, you can use the following command to generate the static pages: +### Required for Contact Form +``` +RESEND_API_KEY=your_resend_api_key_here +``` +### Required for HubSpot Integration (Sales Forms) +``` +HUBSPOT_PORTAL_ID=147033433 +HUBSPOT_FORM_GUID=0d788925-ef54-4fda-9b76-741fb5877056 +``` + +### Required for Blog Page ``` GHOST_URL="" GHOST_KEY="" diff --git a/apps/website/app/[locale]/contact/page.tsx b/apps/website/app/[locale]/contact/page.tsx index a562935..c15c006 100644 --- a/apps/website/app/[locale]/contact/page.tsx +++ b/apps/website/app/[locale]/contact/page.tsx @@ -18,7 +18,8 @@ import { cn } from "@/lib/utils"; interface ContactFormData { inquiryType: "" | "support" | "sales" | "other"; - name: string; + firstName: string; + lastName: string; email: string; company: string; message: string; @@ -30,7 +31,8 @@ export default function ContactPage() { const [isSubmitted, setIsSubmitted] = useState(false); const [formData, setFormData] = useState({ inquiryType: "", - name: "", + firstName: "", + lastName: "", email: "", company: "", message: "", @@ -43,8 +45,11 @@ export default function ContactPage() { if (!formData.inquiryType) { newErrors.inquiryType = t("errors.inquiryTypeRequired"); } - if (!formData.name.trim()) { - newErrors.name = t("errors.nameRequired"); + if (!formData.firstName.trim()) { + newErrors.firstName = t("errors.firstNameRequired"); + } + if (!formData.lastName.trim()) { + newErrors.lastName = t("errors.lastNameRequired"); } if (!formData.email.trim()) { newErrors.email = t("errors.emailRequired"); @@ -91,7 +96,8 @@ export default function ContactPage() { // Reset form and show success setFormData({ inquiryType: "", - name: "", + firstName: "", + lastName: "", email: "", company: "", message: "", @@ -211,45 +217,69 @@ export default function ContactPage() {
handleInputChange("name", e.target.value)} - placeholder={t("fields.name.placeholder")} + value={formData.firstName} + onChange={(e) => + handleInputChange("firstName", e.target.value) + } + placeholder={t("fields.firstName.placeholder")} /> - {errors.name && ( -

{errors.name}

+ {errors.firstName && ( +

{errors.firstName}

)}
handleInputChange("email", e.target.value)} - placeholder={t("fields.email.placeholder")} + id="lastName" + type="text" + value={formData.lastName} + onChange={(e) => + handleInputChange("lastName", e.target.value) + } + placeholder={t("fields.lastName.placeholder")} /> - {errors.email && ( -

{errors.email}

+ {errors.lastName && ( +

{errors.lastName}

)}
+
+ + handleInputChange("email", e.target.value)} + placeholder={t("fields.email.placeholder")} + /> + {errors.email && ( +

{errors.email}

+ )} +
+