From 91ef4dcb8247927aef403cf68b7eabf5007539ed Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Mon, 15 Dec 2025 15:01:42 -0600 Subject: [PATCH] refactor: simplify inquiryType handling in contact forms - Removed 'other' option from inquiryType in ContactFormData interfaces across contact form and API. - Updated email recipient logic to use a single variable for clarity. - Adjusted related components to reflect the changes in inquiryType options. --- apps/website/app/api/contact/route.ts | 12 +++++++----- apps/website/components/ContactForm.tsx | 7 +++---- apps/website/lib/slack.ts | 6 +----- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/apps/website/app/api/contact/route.ts b/apps/website/app/api/contact/route.ts index db0dd3a..10e4e74 100644 --- a/apps/website/app/api/contact/route.ts +++ b/apps/website/app/api/contact/route.ts @@ -5,7 +5,7 @@ import { NextResponse } from "next/server"; import { Resend } from "resend"; interface ContactFormData { - inquiryType: "support" | "sales" | "other"; + inquiryType: "support" | "sales"; firstName: string; lastName: string; email: string; @@ -107,12 +107,14 @@ Sent from Dokploy website contact form `.trim(); // Send email to Dokploy team + const recipients = + body.inquiryType === "sales" + ? ["sales@dokploy.com", "contact@dokploy.com"] + : ["support@dokploy.com"]; + await resend.emails.send({ from: "Dokploy Contact Form ", - to: - body.inquiryType === "sales" - ? ["sales@dokploy.com", "contact@dokploy.com"] - : ["contact@dokploy.com"], + to: recipients, subject: emailSubject, text: emailBody, replyTo: body.email, diff --git a/apps/website/components/ContactForm.tsx b/apps/website/components/ContactForm.tsx index 5348b0a..9932a58 100644 --- a/apps/website/components/ContactForm.tsx +++ b/apps/website/components/ContactForm.tsx @@ -13,7 +13,7 @@ import { import { useState } from "react"; interface ContactFormData { - inquiryType: "" | "support" | "sales" | "other"; + inquiryType: "" | "support" | "sales"; deploymentType: "" | "cloud" | "self-hosted"; firstName: string; lastName: string; @@ -23,7 +23,7 @@ interface ContactFormData { } interface ContactFormProps { - defaultInquiryType?: "" | "support" | "sales" | "other"; + defaultInquiryType?: "" | "support" | "sales"; onSuccess?: () => void; onCancel?: () => void; showCancelButton?: boolean; @@ -194,7 +194,7 @@ export function ContactForm({ onValueChange={(value) => handleInputChange( "inquiryType", - value as "support" | "sales" | "other", + value as "support" | "sales", ) } > @@ -204,7 +204,6 @@ export function ContactForm({ Support Sales - Other {errors.inquiryType && ( diff --git a/apps/website/lib/slack.ts b/apps/website/lib/slack.ts index 436c0c9..c706ec2 100644 --- a/apps/website/lib/slack.ts +++ b/apps/website/lib/slack.ts @@ -1,5 +1,5 @@ interface ContactFormData { - inquiryType: "support" | "sales" | "other"; + inquiryType: "support" | "sales"; firstName: string; lastName: string; email: string; @@ -47,10 +47,6 @@ function formatContactDataForSlack( inquiryTypeEmoji = "🛟"; inquiryTypeLabel = "Support"; break; - case "other": - inquiryTypeEmoji = "📝"; - inquiryTypeLabel = "Other"; - break; default: inquiryTypeEmoji = "📧"; inquiryTypeLabel = "Contact";