From 15464786c3a34b7ff5b32283103534de2311ccf0 Mon Sep 17 00:00:00 2001 From: abhi1992002 Date: Tue, 3 Feb 2026 12:10:31 +0530 Subject: [PATCH] fix lint --- .../ChatContainer/ChatContainer.tsx | 121 +++--- .../ChatMessagesContainer.tsx | 12 +- .../components/ChatSidebar/ChatSidebar.tsx | 105 +++-- .../src/app/(platform)/copilot-2/page.tsx | 12 +- .../src/components/layout/Navbar/Navbar.tsx | 2 +- .../frontend/src/components/ui/input.tsx | 18 +- .../frontend/src/components/ui/sheet.tsx | 65 ++-- .../frontend/src/components/ui/sidebar.tsx | 356 ++++++++--------- .../frontend/src/components/ui/skeleton.tsx | 11 +- .../frontend/src/hooks/use-mobile.tsx | 24 +- autogpt_platform/frontend/tailwind.config.ts | 364 +++++++++--------- 11 files changed, 568 insertions(+), 522 deletions(-) diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatContainer/ChatContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatContainer/ChatContainer.tsx index c76eb406cb..d9e1d840cd 100644 --- a/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatContainer/ChatContainer.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatContainer/ChatContainer.tsx @@ -1,6 +1,6 @@ -"use client" +"use client"; import { UIDataTypes, UITools, UIMessage } from "ai"; -import { ChatMessagesContainer } from "../ChatMessagesContainer/ChatMessagesContainer" +import { ChatMessagesContainer } from "../ChatMessagesContainer/ChatMessagesContainer"; import { EmptySession } from "../EmptySession/EmptySession"; import { ChatInput } from "@/components/contextual/Chat/components/ChatInput/ChatInput"; import { postV2CreateSession } from "@/app/api/__generated__/endpoints/chat/chat"; @@ -8,64 +8,71 @@ import { useState } from "react"; import { parseAsString, useQueryState } from "nuqs"; export interface ChatContainerProps { - messages: UIMessage[]; - status: string; - error: Error | undefined; - input: string; - setInput: (input: string) => void; - handleMessageSubmit: (e: React.FormEvent) => void; - onSend: (message: string) => void; + messages: UIMessage[]; + status: string; + error: Error | undefined; + input: string; + setInput: (input: string) => void; + handleMessageSubmit: (e: React.FormEvent) => void; + onSend: (message: string) => void; } -export const ChatContainer = ({messages, status, error, input, setInput, handleMessageSubmit, onSend}: ChatContainerProps) => { - const [isCreating, setIsCreating] = useState(false); - const [sessionId, setSessionId] = useQueryState("sessionId", parseAsString); +export const ChatContainer = ({ + messages, + status, + error, + input, + setInput, + handleMessageSubmit, + onSend, +}: ChatContainerProps) => { + const [isCreating, setIsCreating] = useState(false); + const [sessionId, setSessionId] = useQueryState("sessionId", parseAsString); - async function createSession(e: React.FormEvent) { - e.preventDefault(); - if (isCreating) return; - setIsCreating(true); - try { - const response = await postV2CreateSession({ - body: JSON.stringify({}), - }); - if (response.status === 200 && response.data?.id) { - setSessionId(response.data.id); - } - } finally { - setIsCreating(false); - } + async function createSession(e: React.FormEvent) { + e.preventDefault(); + if (isCreating) return; + setIsCreating(true); + try { + const response = await postV2CreateSession({ + body: JSON.stringify({}), + }); + if (response.status === 200 && response.data?.id) { + setSessionId(response.data.id); } + } finally { + setIsCreating(false); + } + } - - return ( -
-
- {sessionId ? ( - - ) : ( - - )} -
-
- {}} - placeholder="You can search or just ask" - /> -
+ return ( +
+
+ {sessionId ? ( + + ) : ( + + )} +
+
+ {}} + placeholder="You can search or just ask" + />
- ) -} \ No newline at end of file +
+ ); +}; diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatMessagesContainer/ChatMessagesContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatMessagesContainer/ChatMessagesContainer.tsx index 98142300be..658a832646 100644 --- a/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatMessagesContainer/ChatMessagesContainer.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatMessagesContainer/ChatMessagesContainer.tsx @@ -39,11 +39,13 @@ export const ChatMessagesContainer = ({ ) : ( messages.map((message) => ( - + {message.parts.map((part, i) => { switch (part.type) { case "text": diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatSidebar/ChatSidebar.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatSidebar/ChatSidebar.tsx index 3548d7c3c3..eb80f5b064 100644 --- a/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatSidebar/ChatSidebar.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/copilot-2/components/ChatSidebar/ChatSidebar.tsx @@ -1,11 +1,27 @@ "use client"; -import { Sidebar, SidebarHeader, SidebarContent, SidebarFooter, SidebarTrigger, useSidebar } from "@/components/ui/sidebar"; +import { + Sidebar, + SidebarHeader, + SidebarContent, + SidebarFooter, + SidebarTrigger, + useSidebar, +} from "@/components/ui/sidebar"; import { cn } from "@/lib/utils"; -import { SparkleIcon, PlusIcon, SpinnerGapIcon, ChatCircleIcon } from "@phosphor-icons/react"; +import { + SparkleIcon, + PlusIcon, + SpinnerGapIcon, + ChatCircleIcon, +} from "@phosphor-icons/react"; import { motion } from "framer-motion"; import { useState } from "react"; import { parseAsString, useQueryState } from "nuqs"; -import { postV2CreateSession, useGetV2ListSessions, getGetV2ListSessionsQueryKey } from "@/app/api/__generated__/endpoints/chat/chat"; +import { + postV2CreateSession, + useGetV2ListSessions, + getGetV2ListSessionsQueryKey, +} from "@/app/api/__generated__/endpoints/chat/chat"; import { Button } from "@/components/atoms/Button/Button"; import { useQueryClient } from "@tanstack/react-query"; @@ -16,11 +32,11 @@ export function ChatSidebar() { const [sessionId, setSessionId] = useQueryState("sessionId", parseAsString); const queryClient = useQueryClient(); - const { data: sessionsResponse, isLoading: isLoadingSessions } = useGetV2ListSessions( - { limit: 50 }, - ); + const { data: sessionsResponse, isLoading: isLoadingSessions } = + useGetV2ListSessions({ limit: 50 }); - const sessions = sessionsResponse?.status === 200 ? sessionsResponse.data.sessions : []; + const sessions = + sessionsResponse?.status === 200 ? sessionsResponse.data.sessions : []; async function handleNewChat() { if (isCreating) return; @@ -31,7 +47,9 @@ export function ChatSidebar() { }); if (response.status === 200 && response.data?.id) { setSessionId(response.data.id); - queryClient.invalidateQueries({ queryKey: getGetV2ListSessionsQueryKey() }); + queryClient.invalidateQueries({ + queryKey: getGetV2ListSessionsQueryKey(), + }); } } finally { setIsCreating(false); @@ -60,31 +78,34 @@ export function ChatSidebar() { collapsible="icon" className="!top-[60px] !h-[calc(100vh-60px)]" > - {isCollapsed && - - {isCollapsed &&
- - -
} -
-
} - + + {isCollapsed && ( +
+ +
+ )} +
+ + )} +
{!isCollapsed && ( -
+
)}
{!isCollapsed && ( -
+
{isLoadingSessions ? (
) : sessions.length === 0 ? ( -

No conversations yet

+

+ No conversations yet +

) : ( sessions.map((session) => (
)} - - + ); } diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot-2/page.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot-2/page.tsx index 7cb8a4c8c3..7069c5ab66 100644 --- a/autogpt_platform/frontend/src/app/(platform)/copilot-2/page.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/copilot-2/page.tsx @@ -46,7 +46,6 @@ export default function Page() { transport: transport ?? undefined, }); - function handleMessageSubmit(e: React.FormEvent) { e.preventDefault(); if (!input.trim() || !sessionId) return; @@ -60,13 +59,16 @@ export default function Page() { } return ( - + - + {sessionId && ( -
+
- {sessionId.slice(0, 8)}... + {sessionId.slice(0, 8)}...
- ) - } -) -Sidebar.displayName = "Sidebar" + ); + }, +); +Sidebar.displayName = "Sidebar"; const SidebarTrigger = React.forwardRef< React.ElementRef, React.ComponentProps >(({ className, onClick, ...props }, ref) => { - const { toggleSidebar } = useSidebar() + const { toggleSidebar } = useSidebar(); return ( - ) -}) -SidebarTrigger.displayName = "SidebarTrigger" + ); +}); +SidebarTrigger.displayName = "SidebarTrigger"; const SidebarRail = React.forwardRef< HTMLButtonElement, React.ComponentProps<"button"> >(({ className, ...props }, ref) => { - const { toggleSidebar } = useSidebar() + const { toggleSidebar } = useSidebar(); return (