Skip to content

Commit 91ef4dc

Browse files
committed
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.
1 parent 47bd1cc commit 91ef4dc

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

apps/website/app/api/contact/route.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { NextResponse } from "next/server";
55
import { Resend } from "resend";
66

77
interface ContactFormData {
8-
inquiryType: "support" | "sales" | "other";
8+
inquiryType: "support" | "sales";
99
firstName: string;
1010
lastName: string;
1111
email: string;
@@ -107,12 +107,14 @@ Sent from Dokploy website contact form
107107
`.trim();
108108

109109
// Send email to Dokploy team
110+
const recipients =
111+
body.inquiryType === "sales"
112+
113+
114+
110115
await resend.emails.send({
111116
from: "Dokploy Contact Form <[email protected]>",
112-
to:
113-
body.inquiryType === "sales"
114-
115-
117+
to: recipients,
116118
subject: emailSubject,
117119
text: emailBody,
118120
replyTo: body.email,

apps/website/components/ContactForm.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
import { useState } from "react";
1414

1515
interface ContactFormData {
16-
inquiryType: "" | "support" | "sales" | "other";
16+
inquiryType: "" | "support" | "sales";
1717
deploymentType: "" | "cloud" | "self-hosted";
1818
firstName: string;
1919
lastName: string;
@@ -23,7 +23,7 @@ interface ContactFormData {
2323
}
2424

2525
interface ContactFormProps {
26-
defaultInquiryType?: "" | "support" | "sales" | "other";
26+
defaultInquiryType?: "" | "support" | "sales";
2727
onSuccess?: () => void;
2828
onCancel?: () => void;
2929
showCancelButton?: boolean;
@@ -194,7 +194,7 @@ export function ContactForm({
194194
onValueChange={(value) =>
195195
handleInputChange(
196196
"inquiryType",
197-
value as "support" | "sales" | "other",
197+
value as "support" | "sales",
198198
)
199199
}
200200
>
@@ -204,7 +204,6 @@ export function ContactForm({
204204
<SelectContent>
205205
<SelectItem value="support">Support</SelectItem>
206206
<SelectItem value="sales">Sales</SelectItem>
207-
<SelectItem value="other">Other</SelectItem>
208207
</SelectContent>
209208
</Select>
210209
{errors.inquiryType && (

apps/website/lib/slack.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
interface ContactFormData {
2-
inquiryType: "support" | "sales" | "other";
2+
inquiryType: "support" | "sales";
33
firstName: string;
44
lastName: string;
55
email: string;
@@ -47,10 +47,6 @@ function formatContactDataForSlack(
4747
inquiryTypeEmoji = "🛟";
4848
inquiryTypeLabel = "Support";
4949
break;
50-
case "other":
51-
inquiryTypeEmoji = "📝";
52-
inquiryTypeLabel = "Other";
53-
break;
5450
default:
5551
inquiryTypeEmoji = "📧";
5652
inquiryTypeLabel = "Contact";

0 commit comments

Comments
 (0)