Skip to content

Commit f1aee4e

Browse files
committed
Fix lint issues in dashboard.
1 parent e21c29e commit f1aee4e

File tree

10 files changed

+55
-62
lines changed

10 files changed

+55
-62
lines changed

apps/dashboard/app/(main)/websites/[id]/_components/tabs/settings-tab.tsx

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,6 @@
11
'use client';
22

3-
import { useMutation, useQueryClient } from '@tanstack/react-query';
4-
import {
5-
Activity,
6-
AlertCircle,
7-
BarChart,
8-
BookOpen,
9-
Check,
10-
ChevronRight,
11-
Clipboard,
12-
Code,
13-
ExternalLink,
14-
FileCode,
15-
Globe,
16-
HelpCircle,
17-
Info,
18-
Laptop,
19-
Pencil,
20-
Server,
21-
Settings2,
22-
Sliders,
23-
TableProperties,
24-
Trash2,
25-
Zap,
26-
} from 'lucide-react';
3+
import { Activity, AlertCircle } from 'lucide-react';
274
import Link from 'next/link';
285
import { useRouter } from 'next/navigation';
296
import { useState } from 'react';
@@ -76,7 +53,6 @@ export function WebsiteSettingsTab({
7653
onWebsiteUpdated,
7754
}: WebsiteDataTabProps) {
7855
const router = useRouter();
79-
const queryClient = useQueryClient();
8056
const [copied, setCopied] = useState(false);
8157
const [installMethod, setInstallMethod] = useState<'script' | 'npm'>(
8258
'script'
@@ -101,7 +77,7 @@ export function WebsiteSettingsTab({
10177
setTrackingOptions((prev) => toggleTrackingOption(prev, option));
10278
};
10379

104-
const handleDeleteWebsite = async () => {
80+
const handleDeleteWebsite = () => {
10581
toast.promise(deleteWebsiteMutation.mutateAsync({ id: websiteId }), {
10682
loading: 'Deleting website...',
10783
success: () => {

apps/dashboard/app/(main)/websites/[id]/assistant/components/chat-history-sheet.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
ClockIcon,
66
DotsThreeOutlineVerticalIcon,
77
DownloadIcon,
8-
ImageSquareIcon,
98
MagnifyingGlassIcon,
109
TrashIcon,
1110
} from '@phosphor-icons/react';
@@ -32,7 +31,6 @@ import {
3231
DropdownMenuTrigger,
3332
} from '@/components/ui/dropdown-menu';
3433
import { Input } from '@/components/ui/input';
35-
import { ScrollArea } from '@/components/ui/scroll-area';
3634
import {
3735
Sheet,
3836
SheetContent,
@@ -66,10 +64,18 @@ function formatRelativeTime(timestamp: number): string {
6664
const hours = Math.floor(diff / (1000 * 60 * 60));
6765
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
6866

69-
if (minutes < 1) return 'Just now';
70-
if (minutes < 60) return `${minutes}m ago`;
71-
if (hours < 24) return `${hours}h ago`;
72-
if (days < 7) return `${days}d ago`;
67+
if (minutes < 1) {
68+
return 'Just now';
69+
}
70+
if (minutes < 60) {
71+
return `${minutes}m ago`;
72+
}
73+
if (hours < 24) {
74+
return `${hours}h ago`;
75+
}
76+
if (days < 7) {
77+
return `${days}d ago`;
78+
}
7379
return new Date(timestamp).toLocaleDateString();
7480
}
7581

@@ -90,11 +96,11 @@ export function ChatHistorySheet({ isOpen, onClose }: ChatHistorySheetProps) {
9096
const chats = await chatDB.getAllChats();
9197

9298
const chatsWithPreview = await Promise.all(
93-
chats.map(async (chat: any) => {
99+
chats.map(async (chat) => {
94100
try {
95101
const messages = await chatDB.getMessages(chat.websiteId);
96102
const lastUserMessage = messages
97-
.filter((m: any) => m.type === 'user')
103+
.filter((m) => m.type === 'user')
98104
.pop();
99105

100106
return {

apps/dashboard/app/(main)/websites/[id]/assistant/components/chat-section.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export default function ChatSection() {
8282
const [scrollAreaRef] = useAtom(scrollAreaRefAtom);
8383
const [selectedModel] = useAtom(modelAtom);
8484
const [websiteData] = useAtom(websiteDataAtom);
85-
const [websiteId] = useAtom(websiteIdAtom);
8685

8786
const inputRef = useRef<HTMLInputElement>(null);
8887
const bottomRef = useRef<HTMLDivElement>(null);

apps/dashboard/app/(main)/websites/[id]/assistant/components/loading-message.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use client';
22

33
import { Robot } from '@phosphor-icons/react';
4-
import React from 'react';
54

65
export function LoadingMessage() {
76
return (

apps/dashboard/app/(main)/websites/[id]/assistant/components/message-bubble.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
Robot,
1212
User,
1313
} from '@phosphor-icons/react';
14-
import React, { useEffect, useState } from 'react';
14+
import { useEffect, useState } from 'react';
1515
import {
1616
Accordion,
1717
AccordionContent,
@@ -44,7 +44,9 @@ function ThinkingStepsPreview({ steps }: { steps: string[] }) {
4444
const maxPreviewSteps = 3;
4545

4646
useEffect(() => {
47-
if (steps.length === 0) return;
47+
if (steps.length === 0) {
48+
return;
49+
}
4850

4951
// Show the latest steps in the preview (sliding window)
5052
const latestSteps = steps.slice(-maxPreviewSteps);
@@ -59,7 +61,9 @@ function ThinkingStepsPreview({ steps }: { steps: string[] }) {
5961
}
6062
}, [steps]);
6163

62-
if (visibleSteps.length === 0) return null;
64+
if (visibleSteps.length === 0) {
65+
return null;
66+
}
6367

6468
return (
6569
<div className="mt-2 max-h-20 space-y-1 overflow-hidden">
@@ -92,7 +96,9 @@ function ThinkingStepsPreview({ steps }: { steps: string[] }) {
9296
}
9397

9498
function ThinkingStepsAccordion({ steps }: { steps: string[] }) {
95-
if (steps.length === 0) return null;
99+
if (steps.length === 0) {
100+
return null;
101+
}
96102

97103
return (
98104
<Accordion className="w-full" collapsible type="single">

apps/dashboard/app/(main)/websites/[id]/assistant/components/visualization-section.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,7 @@ import {
4747
} from '@/components/ui/chart';
4848
import { ScrollArea } from '@/components/ui/scroll-area';
4949
import { Skeleton } from '@/components/ui/skeleton';
50-
import {
51-
currentMessageAtom,
52-
dateRangeAtom,
53-
messagesAtom,
54-
websiteDataAtom,
55-
websiteIdAtom,
56-
} from '@/stores/jotai/assistantAtoms';
50+
import { messagesAtom, websiteDataAtom } from '@/stores/jotai/assistantAtoms';
5751
import type { Message } from '../types/message';
5852

5953
const CHART_COLORS = ['#2563eb', '#f97316', '#22c55e', '#ef4444', '#8b5cf6'];

apps/dashboard/app/(main)/websites/[id]/assistant/hooks/use-chat.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export function useChat() {
4646
const [model] = useAtom(modelAtom);
4747
const [websiteId] = useAtom(websiteIdAtom);
4848
const [websiteData] = useAtom(websiteDataAtom);
49-
const [dateRange] = useAtom(dateRangeAtom);
5049
const [messages, setMessages] = useAtom(messagesAtom);
5150
const [inputValue, setInputValue] = useAtom(inputValueAtom);
5251
const [isLoading, setIsLoading] = useAtom(isLoadingAtom);
@@ -124,9 +123,6 @@ export function useChat() {
124123
}, 50);
125124
}, [scrollAreaRef]);
126125

127-
const lastMessage = messages[messages.length - 1];
128-
const lastMessageThinkingSteps = lastMessage?.thinkingSteps?.length || 0;
129-
130126
useEffect(() => {
131127
scrollToBottom();
132128
}, [scrollToBottom]);
@@ -143,7 +139,9 @@ export function useChat() {
143139
const sendMessage = useCallback(
144140
async (content?: string) => {
145141
const messageContent = content || inputValue.trim();
146-
if (!messageContent || isLoading || isRateLimited) return;
142+
if (!messageContent || isLoading || isRateLimited) {
143+
return;
144+
}
147145

148146
const userMessage: Message = {
149147
id: Date.now().toString(),
@@ -238,7 +236,9 @@ export function useChat() {
238236
try {
239237
while (true) {
240238
const { done, value } = await reader.read();
241-
if (done) break;
239+
if (done) {
240+
break;
241+
}
242242

243243
const chunk = new TextDecoder().decode(value);
244244
const lines = chunk.split('\n');

apps/dashboard/app/(main)/websites/[id]/errors/_components/error-chart-tooltip.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Enhanced Custom Tooltip for Error Chart
22
export const ErrorChartTooltip = ({ active, payload, label }: any) => {
3-
if (!(active && payload && payload.length)) return null;
3+
if (!(active && payload && payload.length)) {
4+
return null;
5+
}
46

57
return (
68
<div className="rounded-lg border border-border bg-background p-3 text-xs shadow-lg">

apps/dashboard/app/(main)/websites/[id]/errors/_components/error-icons.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,31 @@ import {
1212

1313
// Get icon for error type
1414
export const getErrorTypeIcon = (type: string) => {
15-
if (!type) return <BugIcon className="h-4 w-4" size={16} weight="duotone" />;
15+
if (!type) {
16+
return <BugIcon className="h-4 w-4" size={16} weight="duotone" />;
17+
}
1618

1719
const lowerType = type.toLowerCase();
18-
if (lowerType.includes('react'))
20+
if (lowerType.includes('react')) {
1921
return <CodeIcon className="h-4 w-4" size={16} weight="duotone" />;
20-
if (lowerType.includes('network'))
22+
}
23+
if (lowerType.includes('network')) {
2124
return <NetworkIcon className="h-4 w-4" size={16} weight="duotone" />;
22-
if (lowerType.includes('script'))
25+
}
26+
if (lowerType.includes('script')) {
2327
return <FileCodeIcon className="h-4 w-4" size={16} weight="duotone" />;
24-
if (lowerType.includes('syntax'))
28+
}
29+
if (lowerType.includes('syntax')) {
2530
return <TerminalIcon className="h-4 w-4" size={16} weight="duotone" />;
31+
}
2632
return <BugIcon className="h-4 w-4" size={16} weight="duotone" />;
2733
};
2834

2935
// Get device icon
3036
export const getDeviceIcon = (deviceType: string) => {
31-
if (!deviceType)
37+
if (!deviceType) {
3238
return <MonitorIcon className="h-4 w-4" size={16} weight="duotone" />;
39+
}
3340

3441
switch (deviceType.toLowerCase()) {
3542
case 'mobile':

apps/dashboard/app/(main)/websites/[id]/page.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ function WebsiteDetailsPage() {
156156
{ enabled: !!id }
157157
);
158158
const isTrackingSetup = useMemo(() => {
159-
if (!data || isTrackingSetupLoading) return null;
159+
if (!data || isTrackingSetupLoading) {
160+
return null;
161+
}
160162
return trackingSetupData?.tracking_setup ?? false;
161163
}, [data, isTrackingSetupLoading, trackingSetupData?.tracking_setup]);
162164

@@ -182,7 +184,9 @@ function WebsiteDetailsPage() {
182184

183185
const renderTabContent = useCallback(
184186
(tabId: TabId) => {
185-
if (tabId !== activeTab) return null;
187+
if (tabId !== activeTab) {
188+
return null;
189+
}
186190

187191
const key = `${tabId}-${id as string}`;
188192
const settingsProps: WebsiteDataTabProps = {

0 commit comments

Comments
 (0)