Skip to content

Commit 63d9f04

Browse files
committed
more cleanup
1 parent 325f322 commit 63d9f04

File tree

8 files changed

+25
-41
lines changed

8 files changed

+25
-41
lines changed

apps/dashboard/src/@/components/ui/button.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const buttonVariants = cva(
2626
link: "underline-offset-4 hover:underline",
2727
outline:
2828
"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
29-
pink: "border border-nebula-pink-foreground !text-nebula-pink-foreground bg-[hsl(var(--nebula-pink-foreground)/5%)] hover:bg-nebula-pink-foreground/10 dark:!text-foreground dark:bg-nebula-pink-foreground/10 dark:hover:bg-nebula-pink-foreground/20",
3029
primary: "bg-primary hover:bg-primary/90 text-primary-foreground ",
3130
secondary:
3231
"bg-secondary hover:bg-secondary/80 text-secondary-foreground ",
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Button } from "@/components/ui/button";
33
import { Input } from "@/components/ui/input";
44
import { cn } from "@/lib/utils";
55

6-
interface SupportTabsProps {
6+
export function SupportCaseFilters(props: {
77
activeTab: string;
88
onTabChange: (tab: string) => void;
99
searchQuery: string;
@@ -13,15 +13,8 @@ interface SupportTabsProps {
1313
open: number;
1414
closed: number;
1515
};
16-
}
17-
18-
export function SupportTabs({
19-
activeTab,
20-
onTabChange,
21-
searchQuery,
22-
onSearchChange,
23-
counts,
24-
}: SupportTabsProps) {
16+
}) {
17+
const { activeTab, onTabChange, searchQuery, onSearchChange, counts } = props;
2518
const tabs = [
2619
{ count: counts.all, id: "all", label: "All" },
2720
{ count: counts.open, id: "open", label: "Open" },
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import {
1212
getTicketStatusBadgeVariant,
1313
getTicketStatusLabel,
1414
} from "../utils/ticket-status";
15-
import { SupportTabs } from "./SupportTabs";
15+
import { SupportCaseFilters } from "./case-filters";
1616

17-
export default function SupportCasesClient({
17+
export function SupportsCaseList({
1818
tickets,
1919
team,
2020
}: {
@@ -80,7 +80,7 @@ export default function SupportCasesClient({
8080

8181
return (
8282
<div className="flex flex-col">
83-
<SupportTabs
83+
<SupportCaseFilters
8484
activeTab={activeTab}
8585
counts={counts}
8686
onSearchChange={setSearchQuery}

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

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ export async function getSupportTicketsByTeam(params: {
1212
const encodedTeamSlug = encodeURIComponent(params.teamSlug);
1313
const apiUrl = `${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${encodedTeamSlug}/support-conversations/list`;
1414

15-
// Build the POST payload according to API spec
16-
const payload = {
17-
limit: 50,
18-
descending: true,
19-
};
20-
2115
const response = await fetch(apiUrl, {
22-
body: JSON.stringify(payload),
16+
body: JSON.stringify({
17+
limit: 50,
18+
descending: true,
19+
}),
2320
cache: "no-store",
2421
headers: {
2522
Accept: "application/json",
@@ -51,15 +48,13 @@ type RawSupportMessage = {
5148
email: string;
5249
isExternal: boolean;
5350
};
54-
// Add any other fields you use from the API
5551
};
5652

5753
export async function getSupportTicket(params: {
5854
ticketId: string;
5955
teamSlug: string;
6056
authToken: string;
6157
}): Promise<SupportTicket> {
62-
// URL encode the team slug to handle special characters like #
6358
const encodedTeamSlug = encodeURIComponent(params.teamSlug);
6459
const encodedTicketId = encodeURIComponent(params.ticketId);
6560

@@ -68,7 +63,6 @@ export async function getSupportTicket(params: {
6863
descending: false,
6964
};
7065

71-
// Fetch conversation details and messages in parallel
7266
const [conversationResponse, messagesResponse] = await Promise.all([
7367
fetch(
7468
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${encodedTeamSlug}/support-conversations/${encodedTicketId}`,
@@ -108,11 +102,6 @@ export async function getSupportTicket(params: {
108102
const conversation: SupportTicket = await conversationResponse.json();
109103
const messagesData: { data?: unknown[] } = await messagesResponse.json();
110104

111-
console.log({
112-
conversation,
113-
messagesData,
114-
});
115-
116105
const rawMessages = messagesData.data || [];
117106
// Transform the raw messages to match our interface
118107
const messages: SupportMessage[] = (rawMessages as RawSupportMessage[])

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/cases/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { notFound, redirect } from "next/navigation";
22
import { getAuthToken } from "@/api/auth-token";
33
import { getTeamBySlug } from "@/api/team";
4-
import { tryCatch } from "../../../../../../../../../@/utils/try-catch";
4+
import { tryCatch } from "@/utils/try-catch";
55
import { SupportCaseDetails } from "../../_components/SupportCaseDetails";
66
import { getSupportTicket } from "../../apis/tickets";
77

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { notFound } from "next/navigation";
33
import { getAuthToken } from "@/api/auth-token";
44
import { getTeamBySlug } from "@/api/team";
55
import { tryCatch } from "@/utils/try-catch";
6-
import SupportCasesClient from "./_components/SupportCasesClient";
6+
import { SupportsCaseList } from "./_components/case-list";
77
import { getSupportTicketsByTeam } from "./apis/tickets";
88

99
export default async function Page(props: {
@@ -42,7 +42,5 @@ export default async function Page(props: {
4242
);
4343
}
4444

45-
return (
46-
<SupportCasesClient team={team} tickets={supportedTicketsResult.data} />
47-
);
45+
return <SupportsCaseList team={team} tickets={supportedTicketsResult.data} />;
4846
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type SupportTicketStatus =
1515
| "in_progress"
1616
| "on_hold"
1717
| "closed"
18+
| "open"
1819
| "resolved";
1920

2021
export type SupportTicket = {
@@ -26,17 +27,13 @@ export type SupportTicket = {
2627
respondedAt: string | null;
2728
messages: SupportMessage[];
2829
title: string;
29-
tags: Array<{ id: string; name: string }>;
3030
};
3131

3232
export type SupportTicketListItem = {
3333
id: string;
3434
status: SupportTicketStatus;
35-
// timestamps
3635
createdAt: string;
3736
updatedAt: string;
3837
closedAt: string | null;
39-
respondedAt: string | null;
4038
title: string;
41-
tags: Array<{ id: string; name: string }>;
4239
};

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/utils/ticket-status.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ export function getTicketStatusBadgeVariant(
55
status: SupportTicketStatus,
66
): BadgeProps["variant"] {
77
switch (status) {
8+
case "open":
9+
return "default";
810
case "resolved":
911
return "success";
1012
case "closed":
1113
return "outline";
14+
// invert logic for user
1215
case "in_progress":
13-
return "default";
14-
case "needs_response":
1516
return "warning";
17+
// invert logic for user
18+
case "needs_response":
19+
return "default";
1620
case "on_hold":
1721
return "outline";
1822
default:
@@ -24,10 +28,14 @@ export function getTicketStatusLabel(status: SupportTicketStatus): string {
2428
switch (status) {
2529
case "closed":
2630
return "Closed";
31+
case "open":
32+
return "Open";
2733
case "resolved":
2834
return "Resolved";
35+
// Invert logic for user - in Progress becomes needs response
2936
case "in_progress":
30-
return "Needs Response";
37+
return "Response Required";
38+
// Invert logic for user - needs response becomes in progress
3139
case "needs_response":
3240
return "In Progress";
3341
case "on_hold":

0 commit comments

Comments
 (0)