Skip to content

Commit 32c91ab

Browse files
authored
[Dashboard] Adding telegram field to support ticket creation (#6754)
1 parent 7a2dc25 commit 32c91ab

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.action.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,17 @@ function prepareEmailBody(props: {
4747
name: string;
4848
extraInfoInput: Record<string, string>;
4949
walletAddress: string;
50+
telegramHandle: string;
5051
}) {
51-
const { extraInfoInput, email, walletAddress, product, name, markdownInput } =
52-
props;
52+
const {
53+
extraInfoInput,
54+
email,
55+
walletAddress,
56+
product,
57+
name,
58+
markdownInput,
59+
telegramHandle,
60+
} = props;
5361
// Update `markdown` to include the infos from the form
5462
const extraInfo = Object.keys(extraInfoInput)
5563
.filter((key) => key.startsWith("extraInfo_"))
@@ -62,6 +70,7 @@ function prepareEmailBody(props: {
6270
.join("");
6371
const markdown = `# Email: ${email}
6472
# Name: ${name}
73+
# Telegram: ${telegramHandle}
6574
# Wallet address: ${walletAddress}
6675
# Product: ${product}
6776
${extraInfo}
@@ -110,6 +119,7 @@ export async function createTicketAction(
110119

111120
const product = formData.get("product")?.toString() || "";
112121
const problemArea = formData.get("extraInfo_Problem_Area")?.toString() || "";
122+
const telegramHandle = formData.get("telegram")?.toString() || "";
113123

114124
const title = prepareEmailTitle(
115125
product,
@@ -130,6 +140,7 @@ export async function createTicketAction(
130140
name: account.name || "",
131141
extraInfoInput: keyVal,
132142
walletAddress: walletAddress,
143+
telegramHandle: telegramHandle,
133144
});
134145

135146
const content = {

apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.client.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Button } from "@/components/ui/button";
55
import { Skeleton } from "@/components/ui/skeleton";
66
import { cn } from "@/lib/utils";
77
import { SupportForm_SelectInput } from "components/help/contact-forms/shared/SupportForm_SelectInput";
8+
import { SupportForm_TelegramInput } from "components/help/contact-forms/shared/SupportForm_TelegramInput";
89
import dynamic from "next/dynamic";
910
import {
1011
type ReactElement,
@@ -155,6 +156,8 @@ export function CreateTicket(props: {
155156
/>
156157
</div>
157158

159+
<SupportForm_TelegramInput />
160+
158161
<ProductAreaSelection
159162
productLabel={productLabel}
160163
setProductLabel={setProductLabel}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Label } from "@/components/ui/label";
2+
3+
type Props = {
4+
placeholder?: string;
5+
};
6+
7+
const defaultDescription = "@YourHandle";
8+
9+
export const SupportForm_TelegramInput = (props: Props) => {
10+
return (
11+
<div className="flex flex-col items-start gap-2 bg-[#0a0a0a]">
12+
<Label htmlFor="telegram" className="relative">
13+
Telegram
14+
<span className="-top-1.5 -right-2 absolute text-destructive"></span>
15+
</Label>
16+
17+
<input
18+
className="flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1"
19+
type="text"
20+
name="telegram"
21+
placeholder={props.placeholder ?? defaultDescription}
22+
autoComplete="off"
23+
maxLength={50}
24+
/>
25+
</div>
26+
);
27+
};

0 commit comments

Comments
 (0)