Skip to content

Commit 4504a56

Browse files
committed
coderabbit review fix
1 parent 6b5da01 commit 4504a56

File tree

17 files changed

+113
-91
lines changed

17 files changed

+113
-91
lines changed

apps/dashboard/src/@/api/support.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ export async function getSupportTicket(
220220
conversation.messages = messages;
221221
} else {
222222
// Don't throw error, just leave messages empty
223-
const _errorText = await messagesResponse.text();
223+
const errorText = await messagesResponse.text();
224+
console.error("Failed to fetch messages:", errorText);
224225
conversation.messages = [];
225226
}
226227

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22
import { BotIcon } from "lucide-react";
33
import { useState } from "react";
4+
import { Input } from "@/components/ui/input";
45

56
export function SupportAIChatCard({
67
_authToken,
@@ -16,8 +17,8 @@ export function SupportAIChatCard({
1617
return (
1718
<div className="rounded-lg border bg-card p-6 mb-6">
1819
<div className="flex items-center gap-3 mb-4">
19-
<span className="inline-block size-8 rounded-full bg-blue-900 flex items-center justify-center">
20-
<BotIcon className="text-lg text-white" />
20+
<span className="inline-block size-8 rounded-full bg-primary flex items-center justify-center">
21+
<BotIcon className="text-lg text-primary-foreground" />
2122
</span>
2223
<div>
2324
<div className="font-semibold">Ask AI for support</div>
@@ -28,14 +29,14 @@ export function SupportAIChatCard({
2829
</div>
2930
</div>
3031
<div className="mb-4">
31-
<div className="rounded bg-[#181C24] px-4 py-3 text-sm text-white">
32-
Ill help you troubleshoot. If I cant fix it, Ill pass it to our
32+
<div className="rounded bg-muted px-4 py-3 text-sm text-foreground">
33+
I'll help you troubleshoot. If I can't fix it, I'll pass it to our
3334
support team.
3435
</div>
3536
</div>
3637
<div className="flex items-center gap-2">
37-
<input
38-
className="flex-1 rounded-md border px-3 py-2 bg-background text-white placeholder:text-muted-foreground"
38+
<Input
39+
className="flex-1"
3940
onChange={(e) => setMessage(e.target.value)}
4041
onKeyDown={(e) => {
4142
if (e.key === "Enter" && !e.shiftKey && message.trim()) {
@@ -47,7 +48,7 @@ export function SupportAIChatCard({
4748
value={message}
4849
/>
4950
<button
50-
className="bg-[#2663EB] hover:bg-[#2663EB]/90 text-white rounded-md px-4 py-2"
51+
className="bg-primary hover:bg-primary/90 text-primary-foreground rounded-md px-4 py-2"
5152
disabled={!message.trim()}
5253
onClick={() => onStartChat(message)}
5354
type="button"

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { Reasoning } from "@/components/chat/Reasoning";
1212
import { Badge } from "@/components/ui/badge";
1313
import { Button } from "@/components/ui/button";
1414
import { Textarea } from "@/components/ui/textarea";
15-
import { useDashboardRouter } from "@/lib/DashboardRouter";
1615
import { SupportAIChatCard } from "./SupportAIChatCard";
1716
import { SupportTabs } from "./SupportTabs";
1817
import { SupportTicketForm } from "./SupportTicketForm";
@@ -52,14 +51,11 @@ export default function SupportCasesClient({
5251
undefined,
5352
);
5453
const chatContainerRef = useRef<HTMLDivElement>(null);
55-
const [_inputFocused, _setInputFocusedd] = useState(false);
56-
const _router = useDashboardRouter();
5754
const replySectionRef = useRef<HTMLDivElement>(null);
5855

5956
// Form states
6057
const [showCreateForm, setShowCreateForm] = useState(false);
6158
const [productLabel, setProductLabel] = useState("");
62-
const [_isSubmittingForm, _setIsSubmittingFormm] = useState(false);
6359

6460
const selectedCase =
6561
selectedCaseDetails || tickets.find((c) => c.id === selectedCaseId);
@@ -174,7 +170,8 @@ export default function SupportCasesClient({
174170
if (ticketDetails) {
175171
setSelectedCaseDetails(ticketDetails);
176172
}
177-
} catch (_error) {
173+
} catch (error) {
174+
console.error("Failed to load ticket details:", error);
178175
toast.error("Failed to load ticket details");
179176
} finally {
180177
setIsLoadingCaseDetails(false);
@@ -229,7 +226,8 @@ export default function SupportCasesClient({
229226
} finally {
230227
setIsLoadingCaseDetails(false);
231228
}
232-
} catch (_error) {
229+
} catch (error) {
230+
console.error("Failed to send reply:", error);
233231
toast.error("Failed to send reply. Please try again.");
234232
} finally {
235233
setIsSubmittingReply(false);
@@ -394,7 +392,8 @@ export default function SupportCasesClient({
394392
timestamp: new Date().toISOString(),
395393
},
396394
]);
397-
} catch (_error) {
395+
} catch (error) {
396+
console.error("Error in handleStartChat:", error);
398397
setChatMessages([
399398
initialAIMsg,
400399
userMsg,
@@ -438,7 +437,8 @@ export default function SupportCasesClient({
438437
timestamp: new Date().toISOString(),
439438
},
440439
]);
441-
} catch (_error) {
440+
} catch (error) {
441+
console.error("Error in handleChatSend:", error);
442442
setChatMessages((msgs) => [
443443
...msgs.slice(0, -1),
444444
{

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@ export function SupportTabs({
3232
<div className="flex items-center gap-4 mb-6">
3333
{/* Search Bar */}
3434
<div className="relative">
35-
<SearchIcon className="absolute left-3 top-1/2 transform -translate-y-1/2 text-[#737373] w-4 h-4" />
35+
<SearchIcon className="absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" />
3636
<Input
37-
className="pl-10 w-80 bg-[#0A0A0A] border-[#1F1F1F] text-white placeholder:text-[#737373] focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-[#2663EB]"
37+
className="pl-10 w-80 bg-background border-border text-foreground placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-primary"
3838
onChange={(e) => onSearchChange(e.target.value)}
3939
placeholder="Search cases..."
4040
value={searchQuery}
4141
/>
4242
</div>
4343

4444
{/* Tab Buttons */}
45-
<div className="grid w-fit grid-cols-3 bg-[#0A0A0A] border border-[#1F1F1F] p-1 rounded-lg">
45+
<div className="grid w-fit grid-cols-3 bg-background border border-border p-1 rounded-lg">
4646
{tabs.map((tab) => (
4747
<Button
4848
className={cn(
4949
"h-8 px-3 py-1 font-medium text-sm transition-colors rounded-md",
5050
activeTab === tab.id
51-
? "bg-[#1F1F1F] text-white"
52-
: "text-[#737373] hover:text-white",
51+
? "bg-accent text-foreground"
52+
: "text-muted-foreground hover:text-foreground",
5353
)}
5454
key={tab.id}
5555
onClick={() => onTabChange(tab.id)}

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import dynamic from "next/dynamic";
33
import { useRef, useState } from "react";
44
import { toast } from "sonner";
55
import { createSupportTicket } from "@/api/support";
6+
import type { Team } from "@/api/team";
67
import { Button } from "@/components/ui/button";
78
import { Skeleton } from "@/components/ui/skeleton";
89
import { SupportForm_SelectInput } from "./shared/SupportForm_SelectInput";
@@ -98,7 +99,7 @@ function ProductAreaSelection(props: {
9899
}
99100

100101
interface SupportTicketFormProps {
101-
team: any;
102+
team: Team;
102103
productLabel: string;
103104
setProductLabel: (val: string) => void;
104105
onSuccess?: () => void;
@@ -187,12 +188,7 @@ export function SupportTicketForm({
187188
/>
188189
{/* Submit Buttons */}
189190
<div className="flex justify-end gap-3 pt-2">
190-
<Button
191-
type="submit"
192-
className="bg-[#2663EB] hover:bg-[#2663EB]/80 text-white transition-opacity"
193-
size="sm"
194-
disabled={isSubmittingForm}
195-
>
191+
<Button type="submit" size="sm" disabled={isSubmittingForm}>
196192
{isSubmittingForm ? (
197193
<>
198194
<LoaderCircleIcon className="animate-spin w-4 h-4 mr-2 inline" />

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/contact-forms/account/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { useState } from "react";
24
import { DescriptionInput } from "../../shared/SupportForm_DescriptionInput";
35
import { SupportForm_SelectInput } from "../../shared/SupportForm_SelectInput";
@@ -11,6 +13,7 @@ const ACCOUNT_PROBLEM_AREAS = [
1113

1214
export function AccountSupportForm() {
1315
const [problemArea, setProblemArea] = useState<string>("");
16+
const [description, setDescription] = useState<string>("");
1417

1518
return (
1619
<>
@@ -23,7 +26,9 @@ export function AccountSupportForm() {
2326
required={true}
2427
value={problemArea}
2528
/>
26-
{problemArea && <DescriptionInput />}
29+
{problemArea && (
30+
<DescriptionInput value={description} onChange={setDescription} />
31+
)}
2732
</>
2833
);
2934
}

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/contact-forms/connect/AffectedAreaInput.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { useState } from "react";
24
import { DescriptionInput } from "../../shared/SupportForm_DescriptionInput";
35
import { SupportForm_SelectInput } from "../../shared/SupportForm_SelectInput";
@@ -9,6 +11,9 @@ const AFFECTED_AREAS = ["Dashboard", "Application"];
911
export const AffectedAreaInput = () => {
1012
const [selectedAffectedArea, setSelectedAffectedArea] = useState<string>("");
1113
const [selectedSDK, setSelectedSDK] = useState<string>("");
14+
const [description, setDescription] = useState<string>("");
15+
const [sdkDescription, setSdkDescription] = useState<string>("");
16+
1217
return (
1318
<>
1419
<SupportForm_SelectInput
@@ -47,12 +52,15 @@ export const AffectedAreaInput = () => {
4752
inputType="url"
4853
required={false}
4954
/>
50-
<DescriptionInput />
55+
<DescriptionInput
56+
value={sdkDescription}
57+
onChange={setSdkDescription}
58+
/>
5159
</>
5260
)}
5361
</>
5462
) : (
55-
<DescriptionInput />
63+
<DescriptionInput value={description} onChange={setDescription} />
5664
))}
5765
</>
5866
);

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/contact-forms/connect/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ const OSSelect = () => {
3434
);
3535
};
3636

37+
const DescriptionInputWrapper = () => {
38+
const [description, setDescription] = useState<string>("");
39+
return <DescriptionInput value={description} onChange={setDescription} />;
40+
};
41+
3742
const PROBLEM_AREAS: ProblemAreaItem[] = [
3843
{
3944
component: <AffectedAreaInput />,
@@ -65,7 +70,7 @@ const PROBLEM_AREAS: ProblemAreaItem[] = [
6570
inputType="url"
6671
required={false}
6772
/>
68-
<DescriptionInput />
73+
<DescriptionInputWrapper />
6974
</>
7075
),
7176
label: "Connect SDKs",
@@ -75,7 +80,7 @@ const PROBLEM_AREAS: ProblemAreaItem[] = [
7580
<>
7681
<UnitySupportForm />
7782
<SDKVersionInput />
78-
<DescriptionInput />
83+
<DescriptionInputWrapper />
7984
</>
8085
),
8186
label: "Unity SDK",
@@ -98,7 +103,7 @@ const PROBLEM_AREAS: ProblemAreaItem[] = [
98103
inputType="text"
99104
required={false}
100105
/>
101-
<DescriptionInput />
106+
<DescriptionInputWrapper />
102107
</>
103108
),
104109
label: ".NET SDK",

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/contact-forms/contracts/index.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,19 @@ const ContractAffectedAreaInput = () => {
6161
);
6262
};
6363

64+
const DescriptionInputWrapper = () => {
65+
const [description, setDescription] = useState<string>("");
66+
return <DescriptionInput value={description} onChange={setDescription} />;
67+
};
68+
6469
const CONTRACT_PROBLEM_AREAS: ProblemAreaItem[] = [
6570
{
6671
component: (
6772
<>
6873
<NetworkInput />
6974
<ContractTypeInput />
7075
<ContractAffectedAreaInput />
71-
<DescriptionInput />
76+
<DescriptionInputWrapper />
7277
</>
7378
),
7479
label: "Deploying a contract",
@@ -79,7 +84,7 @@ const CONTRACT_PROBLEM_AREAS: ProblemAreaItem[] = [
7984
<NetworkInput />
8085
<ContractAddressInput />
8186
<ContractTypeInput />
82-
<DescriptionInput />
87+
<DescriptionInputWrapper />
8388
</>
8489
),
8590
label: "Contract verification",
@@ -91,23 +96,23 @@ const CONTRACT_PROBLEM_AREAS: ProblemAreaItem[] = [
9196
<ContractAddressInput />
9297
<ContractFunctionInput />
9398
<ContractAffectedAreaInput />
94-
<DescriptionInput />
99+
<DescriptionInputWrapper />
95100
</>
96101
),
97102
label: "Calling a function in my contract",
98103
},
99104
{
100105
component: (
101106
<>
102-
<DescriptionInput />
107+
<DescriptionInputWrapper />
103108
</>
104109
),
105110
label: "Developing a custom contract",
106111
},
107112
{
108113
component: (
109114
<>
110-
<DescriptionInput />
115+
<DescriptionInputWrapper />
111116
</>
112117
),
113118
label: "Other",

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/contact-forms/engine/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const ENGINE_PROBLEM_AREAS = [
1515
export function EngineSupportForm() {
1616
const [selectedEngineType, setSelectedEngineType] = useState<string>("");
1717
const [problemArea, setProblemArea] = useState<string>("");
18+
const [description, setDescription] = useState<string>("");
19+
1820
return (
1921
<>
2022
<SupportForm_SelectInput
@@ -47,7 +49,7 @@ export function EngineSupportForm() {
4749
placeholder="https://your-engine-url.com"
4850
required={true}
4951
/>
50-
<DescriptionInput />
52+
<DescriptionInput value={description} onChange={setDescription} />
5153
</>
5254
)}
5355
</>

0 commit comments

Comments
 (0)