From b9b5fdd9128fe7cae211b59110512c352e908b86 Mon Sep 17 00:00:00 2001 From: Joe-thirdweb Date: Thu, 17 Apr 2025 00:37:14 -0500 Subject: [PATCH] Adding Telegram OPTIONAL field in support ticket flow. --- .../components/create-ticket.action.ts | 15 +++++++++-- .../components/create-ticket.client.tsx | 3 +++ .../shared/SupportForm_TelegramInput.tsx | 27 +++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 apps/dashboard/src/components/help/contact-forms/shared/SupportForm_TelegramInput.tsx diff --git a/apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.action.ts b/apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.action.ts index 94a7761615a..393ea4d9c08 100644 --- a/apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.action.ts +++ b/apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.action.ts @@ -47,9 +47,17 @@ function prepareEmailBody(props: { name: string; extraInfoInput: Record; walletAddress: string; + telegramHandle: string; }) { - const { extraInfoInput, email, walletAddress, product, name, markdownInput } = - props; + const { + extraInfoInput, + email, + walletAddress, + product, + name, + markdownInput, + telegramHandle, + } = props; // Update `markdown` to include the infos from the form const extraInfo = Object.keys(extraInfoInput) .filter((key) => key.startsWith("extraInfo_")) @@ -62,6 +70,7 @@ function prepareEmailBody(props: { .join(""); const markdown = `# Email: ${email} # Name: ${name} + # Telegram: ${telegramHandle} # Wallet address: ${walletAddress} # Product: ${product} ${extraInfo} @@ -110,6 +119,7 @@ export async function createTicketAction( const product = formData.get("product")?.toString() || ""; const problemArea = formData.get("extraInfo_Problem_Area")?.toString() || ""; + const telegramHandle = formData.get("telegram")?.toString() || ""; const title = prepareEmailTitle( product, @@ -130,6 +140,7 @@ export async function createTicketAction( name: account.name || "", extraInfoInput: keyVal, walletAddress: walletAddress, + telegramHandle: telegramHandle, }); const content = { diff --git a/apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.client.tsx b/apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.client.tsx index 800e9bfef14..21643967b9c 100644 --- a/apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.client.tsx +++ b/apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.client.tsx @@ -5,6 +5,7 @@ import { Button } from "@/components/ui/button"; import { Skeleton } from "@/components/ui/skeleton"; import { cn } from "@/lib/utils"; import { SupportForm_SelectInput } from "components/help/contact-forms/shared/SupportForm_SelectInput"; +import { SupportForm_TelegramInput } from "components/help/contact-forms/shared/SupportForm_TelegramInput"; import dynamic from "next/dynamic"; import { type ReactElement, @@ -155,6 +156,8 @@ export function CreateTicket(props: { /> + + { + return ( +
+ + + +
+ ); +};