Skip to content

Commit 0bfcdb6

Browse files
committed
cleanup utils
1 parent 9678c86 commit 0bfcdb6

File tree

7 files changed

+64
-72
lines changed

7 files changed

+64
-72
lines changed

apps/dashboard/src/@/components/chat/CustomChatContent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,12 @@ function EmptyStateChatPageContent(props: {
328328
</h1>
329329

330330
<div className="h-6" />
331-
<div className="flex max-w-lg flex-col items-center justify-center gap-2.5">
331+
<div className="flex flex-col items-center justify-center gap-2.5 overflow-hidden">
332332
{props.examplePrompts.map((prompt) => (
333333
<Button
334334
disabled={false}
335335
key={prompt.title}
336-
className="rounded-full bg-card w-fit"
336+
className="rounded-full text-xs sm:text-sm truncate bg-card w-fit h-auto py-1.5 whitespace-pre-wrap"
337337
onClick={() =>
338338
props.sendMessage({
339339
content: [

apps/dashboard/src/@/lib/support-utils.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/CreateSupportCase.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ export function CreateSupportCase(props: { team: Team; authToken: string }) {
155155

156156
return (
157157
<div className="flex flex-col border bg-card rounded-xl mt-4">
158-
<div className="px-4 lg:px-12 py-6 lg:py-10 border-b border-dashed">
159-
<h2 className="text-xl lg:text-2xl font-semibold tracking-tight mb-0.5">
158+
<div className="px-4 lg:px-12 py-4 lg:py-10 border-b border-dashed">
159+
<h2 className="text-lg lg:text-2xl font-semibold tracking-tight mb-1 md:mb-0.5 leading-none">
160160
Chat with support
161161
</h2>
162162

@@ -273,7 +273,7 @@ export function CreateSupportCase(props: { team: Team; authToken: string }) {
273273

274274
{/* Chat Input */}
275275
{!showCreateForm && (
276-
<div className="px-4 lg:px-12 pb-12">
276+
<div className="px-4 lg:px-12 pb-4 lg:pb-12">
277277
<div className="relative">
278278
<AutoResizeTextarea
279279
placeholder="I am having an issue with..."

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/SupportCaseDetails.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ import { Button } from "@/components/ui/button";
1919
import { DynamicHeight } from "@/components/ui/DynamicHeight";
2020
import { Spinner } from "@/components/ui/Spinner/Spinner";
2121
import { AutoResizeTextarea } from "@/components/ui/textarea";
22-
import { getStatusColor, getStatusLabel } from "@/lib/support-utils";
2322
import { cn } from "@/lib/utils";
2423
import { ThirdwebMiniLogo } from "../../../../../../components/ThirdwebMiniLogo";
2524
import type { SupportMessage, SupportTicket } from "../types/tickets";
25+
import {
26+
getTicketStatusBadgeVariant,
27+
getTicketStatusLabel,
28+
} from "../utils/ticket-status";
2629

2730
interface SupportCaseDetailsProps {
2831
ticket: SupportTicket;
@@ -212,10 +215,10 @@ function TicketHeader(props: {
212215
</div>
213216

214217
<Badge
215-
variant={getStatusColor(props.status)}
218+
variant={getTicketStatusBadgeVariant(props.status)}
216219
className="text-sm px-3 py-1.5"
217220
>
218-
{getStatusLabel(props.status)}
221+
{getTicketStatusLabel(props.status)}
219222
</Badge>
220223
</div>
221224
);

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/SupportCasesClient.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import { useState } from "react";
77
import type { Team } from "@/api/team";
88
import { Badge } from "@/components/ui/badge";
99
import { useDashboardRouter } from "@/lib/DashboardRouter";
10-
import { getStatusColor, getStatusLabel } from "@/lib/support-utils";
1110
import type { SupportTicketListItem } from "../types/tickets";
11+
import {
12+
getTicketStatusBadgeVariant,
13+
getTicketStatusLabel,
14+
} from "../utils/ticket-status";
1215
import { SupportTabs } from "./SupportTabs";
1316

1417
export default function SupportCasesClient({
@@ -119,8 +122,8 @@ export default function SupportCasesClient({
119122
</Link>
120123

121124
<div className="flex items-center gap-3 justify-between">
122-
<Badge variant={getStatusColor(ticket.status)}>
123-
{getStatusLabel(ticket.status)}
125+
<Badge variant={getTicketStatusBadgeVariant(ticket.status)}>
126+
{getTicketStatusLabel(ticket.status)}
124127
</Badge>
125128

126129
<div className="text-muted-foreground text-xs">

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/types/tickets.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ export type SupportMessage = {
1010
};
1111
};
1212

13+
export type SupportTicketStatus =
14+
| "needs_response"
15+
| "in_progress"
16+
| "on_hold"
17+
| "closed"
18+
| "resolved";
19+
1320
export type SupportTicket = {
1421
id: string;
15-
status: "needs_response" | "in_progress" | "on_hold" | "closed" | "resolved";
22+
status: SupportTicketStatus;
1623
createdAt: string;
1724
updatedAt: string;
1825
closedAt: string | null;
@@ -24,7 +31,7 @@ export type SupportTicket = {
2431

2532
export type SupportTicketListItem = {
2633
id: string;
27-
status: "needs_response" | "in_progress" | "on_hold" | "closed" | "resolved";
34+
status: SupportTicketStatus;
2835
// timestamps
2936
createdAt: string;
3037
updatedAt: string;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import type { BadgeProps } from "@/components/ui/badge";
2+
import type { SupportTicketStatus } from "../types/tickets";
3+
4+
export function getTicketStatusBadgeVariant(
5+
status: SupportTicketStatus,
6+
): BadgeProps["variant"] {
7+
switch (status) {
8+
case "resolved":
9+
return "success";
10+
case "closed":
11+
return "outline";
12+
case "in_progress":
13+
return "default";
14+
case "needs_response":
15+
return "warning";
16+
case "on_hold":
17+
return "outline";
18+
default:
19+
return "default";
20+
}
21+
}
22+
23+
export function getTicketStatusLabel(status: SupportTicketStatus): string {
24+
switch (status) {
25+
case "closed":
26+
return "Closed";
27+
case "resolved":
28+
return "Resolved";
29+
case "in_progress":
30+
return "Needs Response";
31+
case "needs_response":
32+
return "In Progress";
33+
case "on_hold":
34+
return "On Hold";
35+
default:
36+
return "In Progress";
37+
}
38+
}

0 commit comments

Comments
 (0)