mirror of
https://github.com/Dokploy/website.git
synced 2026-06-15 20:25:25 +02:00
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:
@@ -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,
|
||||
|
||||
@@ -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 && (
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user