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.
This commit is contained in:
Mauricio Siu
2025-12-15 15:01:42 -06:00
parent 47bd1ccc79
commit 91ef4dcb82
3 changed files with 11 additions and 14 deletions

View File

@@ -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 <noreply@emails.dokploy.com>",
to:
body.inquiryType === "sales"
? ["sales@dokploy.com", "contact@dokploy.com"]
: ["contact@dokploy.com"],
to: recipients,
subject: emailSubject,
text: emailBody,
replyTo: body.email,

View File

@@ -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({
<SelectContent>
<SelectItem value="support">Support</SelectItem>
<SelectItem value="sales">Sales</SelectItem>
<SelectItem value="other">Other</SelectItem>
</SelectContent>
</Select>
{errors.inquiryType && (

View File

@@ -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";