diff --git a/frontend-web/src/components/ui/breadcrumb.tsx b/frontend-web/src/components/ui/breadcrumb.tsx index 029c0997..bd3af481 100644 --- a/frontend-web/src/components/ui/breadcrumb.tsx +++ b/frontend-web/src/components/ui/breadcrumb.tsx @@ -31,23 +31,25 @@ function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) { ); } -function BreadcrumbLink({ - asChild, - className, - ...props -}: React.ComponentProps<"a"> & { - asChild?: boolean; -}) { - const Comp = asChild ? Slot : "a"; - - return ( - - ); -} +const BreadcrumbLink = React.forwardRef< + HTMLAnchorElement, + React.ComponentProps<"a"> & { + asChild?: boolean; + } +>(({ asChild, className, ...props }, ref) => { + const Comp = asChild ? Slot : "a"; + + return ( + + ); +}); + +BreadcrumbLink.displayName = "BreadcrumbLink"; function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) { return ( diff --git a/frontend-web/src/components/ui/button.tsx b/frontend-web/src/components/ui/button.tsx index 961cf33b..31e89b42 100644 --- a/frontend-web/src/components/ui/button.tsx +++ b/frontend-web/src/components/ui/button.tsx @@ -1,6 +1,6 @@ -import * as React from "react"; -import { Slot } from "@radix-ui/react-slot"; -import { cva, type VariantProps } from "class-variance-authority"; +import * as React from "react"; +import { Slot } from "@radix-ui/react-slot"; +import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; @@ -37,27 +37,27 @@ const buttonVariants = cva( }, ); -function Button({ - className, - variant = "default", - size = "default", - asChild = false, - ...props -}: React.ComponentProps<"button"> & - VariantProps & { - asChild?: boolean; - }) { - const Comp = asChild ? Slot : "button"; - - return ( - - ); -} - -export { Button, buttonVariants }; +const Button = React.forwardRef< + HTMLButtonElement, + React.ComponentProps<"button"> & + VariantProps & { + asChild?: boolean; + } +>(({ className, variant = "default", size = "default", asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : "button"; + + return ( + + ); +}); + +Button.displayName = "Button"; + +export { Button, buttonVariants }; diff --git a/frontend-web/src/components/ui/collapsible.tsx b/frontend-web/src/components/ui/collapsible.tsx index ce790a65..a3f08519 100644 --- a/frontend-web/src/components/ui/collapsible.tsx +++ b/frontend-web/src/components/ui/collapsible.tsx @@ -1,6 +1,7 @@ -"use client"; - -import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"; +"use client"; + +import * as React from "react"; +import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"; import { cn } from "@/lib/utils"; @@ -10,28 +11,37 @@ function Collapsible({ return ; } -function CollapsibleTrigger({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -function CollapsibleContent({ - ...props -}: React.ComponentProps) { - return ( - - ); -} +const CollapsibleTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ( + + ); +}); + +CollapsibleTrigger.displayName = + CollapsiblePrimitive.CollapsibleTrigger.displayName; + +const CollapsibleContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ ...props }, ref) => { + return ( + + ); +}); + +CollapsibleContent.displayName = + CollapsiblePrimitive.CollapsibleContent.displayName; export { Collapsible, CollapsibleTrigger, CollapsibleContent }; diff --git a/frontend-web/src/components/ui/dialog.tsx b/frontend-web/src/components/ui/dialog.tsx index 0282d589..4fa8d7fb 100644 --- a/frontend-web/src/components/ui/dialog.tsx +++ b/frontend-web/src/components/ui/dialog.tsx @@ -12,11 +12,20 @@ function Dialog({ return ; } -function DialogTrigger({ - ...props -}: React.ComponentProps) { - return ; -} +const DialogTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ ...props }, ref) => { + return ( + + ); +}); + +DialogTrigger.displayName = DialogPrimitive.Trigger.displayName; function DialogPortal({ ...props @@ -24,61 +33,68 @@ function DialogPortal({ return ; } -function DialogClose({ - ...props -}: React.ComponentProps) { - return ; -} +const DialogClose = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ ...props }, ref) => { + return ; +}); + +DialogClose.displayName = DialogPrimitive.Close.displayName; -function DialogOverlay({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} +const DialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ( + + ); +}); + +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; -function DialogContent({ - className, - children, - showCloseButton = true, - ...props -}: React.ComponentProps & { - showCloseButton?: boolean; -}) { - return ( - - - - {children} - {showCloseButton && ( - - - Close - - )} - - - ); -} +const DialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & { + showCloseButton?: boolean; + } +>(({ className, children, showCloseButton = true, ...props }, ref) => { + return ( + + + + {children} + {showCloseButton && ( + + + Close + + )} + + + ); +}); + +DialogContent.displayName = DialogPrimitive.Content.displayName; function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { return ( diff --git a/frontend-web/src/components/ui/dropdown-menu.tsx b/frontend-web/src/components/ui/dropdown-menu.tsx index cf81f70c..766b5160 100644 --- a/frontend-web/src/components/ui/dropdown-menu.tsx +++ b/frontend-web/src/components/ui/dropdown-menu.tsx @@ -20,36 +20,42 @@ function DropdownMenuPortal({ ); } -function DropdownMenuTrigger({ - ...props -}: React.ComponentProps) { - return ( - - ); -} +const DropdownMenuTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ ...props }, ref) => { + return ( + + ); +}); + +DropdownMenuTrigger.displayName = DropdownMenuPrimitive.Trigger.displayName; -function DropdownMenuContent({ - className, - sideOffset = 4, - ...props -}: React.ComponentProps) { - return ( - - - - ); -} +const DropdownMenuContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, sideOffset = 4, ...props }, ref) => { + return ( + + + + ); +}); + +DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName; function DropdownMenuGroup({ ...props @@ -59,28 +65,29 @@ function DropdownMenuGroup({ ); } -function DropdownMenuItem({ - className, - inset, - variant = "default", - ...props -}: React.ComponentProps & { - inset?: boolean; - variant?: "default" | "destructive"; -}) { - return ( - - ); -} +const DropdownMenuItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & { + inset?: boolean; + variant?: "default" | "destructive"; + } +>(({ className, inset, variant = "default", ...props }, ref) => { + return ( + + ); +}); + +DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; function DropdownMenuCheckboxItem({ className, @@ -198,45 +205,51 @@ function DropdownMenuSub({ return ; } -function DropdownMenuSubTrigger({ - className, - inset, - children, - ...props -}: React.ComponentProps & { - inset?: boolean; -}) { - return ( - - {children} - - - ); -} +const DropdownMenuSubTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & { + inset?: boolean; + } +>(({ className, inset, children, ...props }, ref) => { + return ( + + {children} + + + ); +}); + +DropdownMenuSubTrigger.displayName = + DropdownMenuPrimitive.SubTrigger.displayName; -function DropdownMenuSubContent({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} +const DropdownMenuSubContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ( + + ); +}); + +DropdownMenuSubContent.displayName = + DropdownMenuPrimitive.SubContent.displayName; export { DropdownMenu, diff --git a/frontend-web/src/components/ui/hover-card.tsx b/frontend-web/src/components/ui/hover-card.tsx index 346b0ae3..b8a76875 100644 --- a/frontend-web/src/components/ui/hover-card.tsx +++ b/frontend-web/src/components/ui/hover-card.tsx @@ -11,34 +11,42 @@ function HoverCard({ return ; } -function HoverCardTrigger({ - ...props -}: React.ComponentProps) { - return ( - - ); -} - -function HoverCardContent({ - className, - align = "center", - sideOffset = 4, - ...props -}: React.ComponentProps) { - return ( - - - - ); -} +const HoverCardTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ ...props }, ref) => { + return ( + + ); +}); + +HoverCardTrigger.displayName = HoverCardPrimitive.Trigger.displayName; + +const HoverCardContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, align = "center", sideOffset = 4, ...props }, ref) => { + return ( + + + + ); +}); + +HoverCardContent.displayName = HoverCardPrimitive.Content.displayName; export { HoverCard, HoverCardTrigger, HoverCardContent }; diff --git a/frontend-web/src/components/ui/select.tsx b/frontend-web/src/components/ui/select.tsx index c1a87494..327e1350 100644 --- a/frontend-web/src/components/ui/select.tsx +++ b/frontend-web/src/components/ui/select.tsx @@ -24,68 +24,69 @@ function SelectValue({ return ; } -function SelectTrigger({ - className, - size = "default", - children, - ...props -}: React.ComponentProps & { - size?: "sm" | "default"; -}) { - return ( - - {children} - - - - - ); -} +const SelectTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & { + size?: "sm" | "default"; + } +>(({ className, size = "default", children, ...props }, ref) => { + return ( + + {children} + + + + + ); +}); + +SelectTrigger.displayName = SelectPrimitive.Trigger.displayName; -function SelectContent({ - className, - children, - position = "item-aligned", - align = "center", - ...props -}: React.ComponentProps) { - return ( - - - - - {children} - - - - - ); -} +const SelectContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, position = "item-aligned", align = "center", ...props }, ref) => { + return ( + + + + + {children} + + + + + ); +}); + +SelectContent.displayName = SelectPrimitive.Content.displayName; function SelectLabel({ className, @@ -100,32 +101,34 @@ function SelectLabel({ ); } -function SelectItem({ - className, - children, - ...props -}: React.ComponentProps) { - return ( - - - - - - - {children} - - ); -} +const SelectItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => { + return ( + + + + + + + {children} + + ); +}); + +SelectItem.displayName = SelectPrimitive.Item.displayName; function SelectSeparator({ className, diff --git a/frontend-web/src/components/ui/sheet.tsx b/frontend-web/src/components/ui/sheet.tsx index 82c613fc..abb4b216 100644 --- a/frontend-web/src/components/ui/sheet.tsx +++ b/frontend-web/src/components/ui/sheet.tsx @@ -10,17 +10,23 @@ function Sheet({ ...props }: React.ComponentProps) { return ; } -function SheetTrigger({ - ...props -}: React.ComponentProps) { - return ; -} +const SheetTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ ...props }, ref) => { + return ; +}); + +SheetTrigger.displayName = SheetPrimitive.Trigger.displayName; -function SheetClose({ - ...props -}: React.ComponentProps) { - return ; -} +const SheetClose = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ ...props }, ref) => { + return ; +}); + +SheetClose.displayName = SheetPrimitive.Close.displayName; function SheetPortal({ ...props @@ -28,58 +34,62 @@ function SheetPortal({ return ; } -function SheetOverlay({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} +const SheetOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ( + + ); +}); + +SheetOverlay.displayName = SheetPrimitive.Overlay.displayName; -function SheetContent({ - className, - children, - side = "right", - ...props -}: React.ComponentProps & { - side?: "top" | "right" | "bottom" | "left"; -}) { - return ( - - - - {children} - - - Close - - - - ); -} +const SheetContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & { + side?: "top" | "right" | "bottom" | "left"; + } +>(({ className, children, side = "right", ...props }, ref) => { + return ( + + + + {children} + + + Close + + + + ); +}); + +SheetContent.displayName = SheetPrimitive.Content.displayName; function SheetHeader({ className, ...props }: React.ComponentProps<"div">) { return ( diff --git a/frontend-web/src/components/ui/sidebar.tsx b/frontend-web/src/components/ui/sidebar.tsx index 80e8e357..f6c5e3e4 100644 --- a/frontend-web/src/components/ui/sidebar.tsx +++ b/frontend-web/src/components/ui/sidebar.tsx @@ -397,49 +397,53 @@ function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) { ); } -function SidebarGroupLabel({ - className, - asChild = false, - ...props -}: React.ComponentProps<"div"> & { asChild?: boolean }) { - const Comp = asChild ? Slot : "div"; +const SidebarGroupLabel = React.forwardRef< + HTMLDivElement, + React.ComponentProps<"div"> & { asChild?: boolean } +>(({ className, asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : "div"; + + return ( + svg]:size-4 [&>svg]:shrink-0", + "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", + className, + )} + {...props} + /> + ); +}); + +SidebarGroupLabel.displayName = "SidebarGroupLabel"; - return ( - svg]:size-4 [&>svg]:shrink-0", - "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", - className, - )} - {...props} - /> - ); -} - -function SidebarGroupAction({ - className, - asChild = false, - ...props -}: React.ComponentProps<"button"> & { asChild?: boolean }) { - const Comp = asChild ? Slot : "button"; - - return ( - svg]:size-4 [&>svg]:shrink-0", - // Increases the hit area of the button on mobile. - "after:absolute after:-inset-2 md:after:hidden", - "group-data-[collapsible=icon]:hidden", - className, - )} - {...props} - /> - ); -} +const SidebarGroupAction = React.forwardRef< + HTMLButtonElement, + React.ComponentProps<"button"> & { asChild?: boolean } +>(({ className, asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : "button"; + + return ( + svg]:size-4 [&>svg]:shrink-0", + // Increases the hit area of the button on mobile. + "after:absolute after:-inset-2 md:after:hidden", + "group-data-[collapsible=icon]:hidden", + className, + )} + {...props} + /> + ); +}); + +SidebarGroupAction.displayName = "SidebarGroupAction"; function SidebarGroupContent({ className, @@ -499,87 +503,99 @@ const sidebarMenuButtonVariants = cva( }, ); -function SidebarMenuButton({ - asChild = false, - isActive = false, - variant = "default", - size = "default", - tooltip, - className, - ...props -}: React.ComponentProps<"button"> & { - asChild?: boolean; - isActive?: boolean; - tooltip?: string | React.ComponentProps; -} & VariantProps) { - const Comp = asChild ? Slot : "button"; - const { isMobile, state } = useSidebar(); +const SidebarMenuButton = React.forwardRef< + HTMLButtonElement, + React.ComponentProps<"button"> & { + asChild?: boolean; + isActive?: boolean; + tooltip?: string | React.ComponentProps; + } & VariantProps +>( + ( + { + asChild = false, + isActive = false, + variant = "default", + size = "default", + tooltip, + className, + ...props + }, + ref, + ) => { + const Comp = asChild ? Slot : "button"; + const { isMobile, state } = useSidebar(); + + const button = ( + + ); + + if (!tooltip) { + return button; + } + + if (typeof tooltip === "string") { + tooltip = { + children: tooltip, + }; + } + + return ( + + {button} + + ); + }, +); + +SidebarMenuButton.displayName = "SidebarMenuButton"; - const button = ( - - ); - - if (!tooltip) { - return button; - } - - if (typeof tooltip === "string") { - tooltip = { - children: tooltip, - }; - } - - return ( - - {button} - - ); -} - -function SidebarMenuAction({ - className, - asChild = false, - showOnHover = false, - ...props -}: React.ComponentProps<"button"> & { - asChild?: boolean; - showOnHover?: boolean; -}) { - const Comp = asChild ? Slot : "button"; - - return ( - svg]:size-4 [&>svg]:shrink-0", - // Increases the hit area of the button on mobile. - "after:absolute after:-inset-2 md:after:hidden", - "peer-data-[size=sm]/menu-button:top-1", - "peer-data-[size=default]/menu-button:top-1.5", - "peer-data-[size=lg]/menu-button:top-2.5", - "group-data-[collapsible=icon]:hidden", - showOnHover && - "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0", - className, - )} - {...props} - /> - ); -} +const SidebarMenuAction = React.forwardRef< + HTMLButtonElement, + React.ComponentProps<"button"> & { + asChild?: boolean; + showOnHover?: boolean; + } +>(({ className, asChild = false, showOnHover = false, ...props }, ref) => { + const Comp = asChild ? Slot : "button"; + + return ( + svg]:size-4 [&>svg]:shrink-0", + // Increases the hit area of the button on mobile. + "after:absolute after:-inset-2 md:after:hidden", + "peer-data-[size=sm]/menu-button:top-1", + "peer-data-[size=default]/menu-button:top-1.5", + "peer-data-[size=lg]/menu-button:top-2.5", + "group-data-[collapsible=icon]:hidden", + showOnHover && + "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0", + className, + )} + {...props} + /> + ); +}); + +SidebarMenuAction.displayName = "SidebarMenuAction"; function SidebarMenuBadge({ className, @@ -670,37 +686,37 @@ function SidebarMenuSubItem({ ); } -function SidebarMenuSubButton({ - asChild = false, - size = "md", - isActive = false, - className, - ...props -}: React.ComponentProps<"a"> & { - asChild?: boolean; - size?: "sm" | "md"; - isActive?: boolean; -}) { - const Comp = asChild ? Slot : "a"; - - return ( - svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", - "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", - size === "sm" && "text-xs", - size === "md" && "text-sm", - "group-data-[collapsible=icon]:hidden", - className, - )} - {...props} - /> - ); -} +const SidebarMenuSubButton = React.forwardRef< + HTMLAnchorElement, + React.ComponentProps<"a"> & { + asChild?: boolean; + size?: "sm" | "md"; + isActive?: boolean; + } +>(({ asChild = false, size = "md", isActive = false, className, ...props }, ref) => { + const Comp = asChild ? Slot : "a"; + + return ( + svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", + "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", + size === "sm" && "text-xs", + size === "md" && "text-sm", + "group-data-[collapsible=icon]:hidden", + className, + )} + {...props} + /> + ); +}); + +SidebarMenuSubButton.displayName = "SidebarMenuSubButton"; export { Sidebar, diff --git a/frontend-web/src/components/ui/tabs.tsx b/frontend-web/src/components/ui/tabs.tsx index 3d88efbf..41a53cc7 100644 --- a/frontend-web/src/components/ui/tabs.tsx +++ b/frontend-web/src/components/ui/tabs.tsx @@ -40,52 +40,60 @@ const tabsListVariants = cva( }, ); -function TabsList({ - className, - variant = "default", - ...props -}: React.ComponentProps & - VariantProps) { - return ( - - ); -} +const TabsList = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & + VariantProps +>(({ className, variant = "default", ...props }, ref) => { + return ( + + ); +}); + +TabsList.displayName = TabsPrimitive.List.displayName; -function TabsTrigger({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} +const TabsTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ( + + ); +}); + +TabsTrigger.displayName = TabsPrimitive.Trigger.displayName; -function TabsContent({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} +const TabsContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ( + + ); +}); + +TabsContent.displayName = TabsPrimitive.Content.displayName; export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }; diff --git a/frontend-web/src/components/ui/tooltip.tsx b/frontend-web/src/components/ui/tooltip.tsx index ad120150..04286b1a 100644 --- a/frontend-web/src/components/ui/tooltip.tsx +++ b/frontend-web/src/components/ui/tooltip.tsx @@ -28,33 +28,43 @@ function Tooltip({ ); } -function TooltipTrigger({ - ...props -}: React.ComponentProps) { - return ; -} - -function TooltipContent({ - className, - sideOffset, - children, - ...props -}: React.ComponentProps) { - return ( - - - {children} - - - ); -} +const TooltipTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ ...props }, ref) => { + return ( + + ); +}); + +TooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName; + +const TooltipContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, sideOffset, children, ...props }, ref) => { + return ( + + + {children} + + + ); +}); + +TooltipContent.displayName = TooltipPrimitive.Content.displayName; export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }; diff --git a/frontend-web/src/components/workspace/recent-chat-list.tsx b/frontend-web/src/components/workspace/recent-chat-list.tsx index cc60f7e5..20e833cf 100644 --- a/frontend-web/src/components/workspace/recent-chat-list.tsx +++ b/frontend-web/src/components/workspace/recent-chat-list.tsx @@ -173,91 +173,89 @@ export function RecentChatList() {
{visibleThreads.map((thread) => { const isActive = pathOfThread(thread) === pathname; - return ( - - -
- - {titleOfThread(thread)} - - {env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY !== "true" && ( - - - - - {t.common.more} - - - - - handleRenameClick( - thread.thread_id, - titleOfThread(thread), - ) - } - > - - {t.common.rename} - - handleShare(thread)} - > - - {t.common.share} - - - - - {t.common.export} - - - - handleExport(thread, "markdown") - } - > - - {t.common.exportAsMarkdown} - - - handleExport(thread, "json") - } - > - - {t.common.exportAsJSON} - - - - - handleDelete(thread.thread_id)} - > - - {t.common.delete} - - - - )} -
-
-
- ); - })} + return ( + + + + {titleOfThread(thread)} + + + {env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY !== "true" && ( + + + + + {t.common.more} + + + + + handleRenameClick( + thread.thread_id, + titleOfThread(thread), + ) + } + > + + {t.common.rename} + + handleShare(thread)} + > + + {t.common.share} + + + + + {t.common.export} + + + + handleExport(thread, "markdown") + } + > + + {t.common.exportAsMarkdown} + + + handleExport(thread, "json") + } + > + + {t.common.exportAsJSON} + + + + + handleDelete(thread.thread_id)} + > + + {t.common.delete} + + + + )} + + ); + })}
diff --git a/frontend-web/src/pages/NewAgentPage.tsx b/frontend-web/src/pages/NewAgentPage.tsx index e64de2bc..3ac5d4f2 100644 --- a/frontend-web/src/pages/NewAgentPage.tsx +++ b/frontend-web/src/pages/NewAgentPage.tsx @@ -1,4 +1,4 @@ -"use client"; +"use client"; import { ArrowLeftIcon, @@ -17,13 +17,6 @@ import { } from "@/components/ai-elements/prompt-input"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select"; import { Textarea } from "@/components/ui/textarea"; import { ArtifactsProvider } from "@/components/workspace/artifacts"; import { @@ -120,7 +113,7 @@ export default function NewAgentPage() { model_name: chatModelInput || undefined, }, onToolEnd() { - // setup_agent never actually executes in this flow — it gets + // setup_agent never actually executes in this flow 鈥?it gets // intercepted by SetupAgentApprovalMiddleware and the form is filled // from the approval ToolMessage payload (handleApproveSetupAgent). // No agent record is fetched/refreshed during chat. @@ -156,7 +149,7 @@ export default function NewAgentPage() { if (!name) { // Names are display-only and may collide, so a timestamped placeholder // is safe to send to the backend just to satisfy the required-field - // validation. Intentionally NOT written back into the visible input — + // validation. Intentionally NOT written back into the visible input 鈥? // the user wants the name box to stay blank while they chat, and we // refill it later (with the model's proposed name) on setup_agent // approval. @@ -245,7 +238,7 @@ export default function NewAgentPage() { // Chat is purely a discussion channel. The agent record is only // created when the user explicitly clicks Save (top-right). If the // model proposes a config via setup_agent, our approval handler - // prefills the form locally — it does NOT persist anything. + // prefills the form locally 鈥?it does NOT persist anything. await ensureThreadExists(); await sendMessage(threadId, { text: trimmed, files: [] }); }, @@ -255,7 +248,7 @@ export default function NewAgentPage() { const handleApproveSetupAgent = useCallback( async (payload: SetupAgentApprovalPayload) => { // Approving the model's setup_agent proposal **does not** persist - // anything — it only mirrors the proposal into the form so the user + // anything 鈥?it only mirrors the proposal into the form so the user // can review it. Creation/update happens later when the user clicks // the top-right Save button. const proposedName = payload.name?.trim() ?? ""; @@ -338,22 +331,23 @@ export default function NewAgentPage() { 当前对话模型 - + + {models.map((model) => ( + + ))} + void handleChatSubmit(text)} @@ -405,22 +399,21 @@ export default function NewAgentPage() {
- + + {models.map((model) => ( + + ))} +

该专家被使用时调用的模型。

diff --git a/frontend-web/src/pages/PageRoutes.tsx b/frontend-web/src/pages/PageRoutes.tsx index 1d252412..cd21afd7 100644 --- a/frontend-web/src/pages/PageRoutes.tsx +++ b/frontend-web/src/pages/PageRoutes.tsx @@ -8,7 +8,7 @@ import StrategyRoutes from "./StrategyRoutes"; import Header from "@/strategy-components/Header"; // 设为 true 时隐藏侧边栏(开发中,暂未完成) -const SIDEBAR_ENABLED = false; +const SIDEBAR_ENABLED = true; function PageLayout() { const [collapsed, setCollapsed] = useState(false); diff --git a/frontend-web/src/pages/StrategyRoutes.tsx b/frontend-web/src/pages/StrategyRoutes.tsx index 54941cdd..42eadc32 100644 --- a/frontend-web/src/pages/StrategyRoutes.tsx +++ b/frontend-web/src/pages/StrategyRoutes.tsx @@ -1,14 +1,12 @@ import { Navigate, Route, Routes } from "react-router-dom"; -import type { ReactNode } from "react"; import { Toaster } from "sonner"; import { getStoredAuth } from "@/core/auth"; import { RouteBaseProvider } from "@/core/route-base"; -import { SubtasksProvider } from "@/core/tasks/context"; -import { ArtifactsProvider } from "@/components/workspace/artifacts"; -import { PromptInputProvider } from "@/components/ai-elements/prompt-input"; +import { SidebarProvider } from "@/components/ui/sidebar"; import GeneralQA from "@/strategy-components/components/qa/GeneralQA"; +import { ChatRuntime } from "./WorkspaceRoutes"; import AgentsPage from "./AgentsPage"; import ChatsPage from "./ChatsPage"; import ChatPage from "./ChatPage"; @@ -18,19 +16,10 @@ import ScheduledTasksPage from "./ScheduledTasksPage"; import ScheduledTaskRunDetailPage from "./ScheduledTaskRunDetailPage"; import RecommendedQuestionsPage from "./RecommendedQuestionsPage"; -function ChatRuntime({ children }: { children: ReactNode }) { - return ( - - - {children} - - - ); -} - export default function StrategyRoutes() { return ( +
} /> @@ -89,6 +78,7 @@ export default function StrategyRoutes() { />
+
); diff --git a/frontend-web/src/pages/WorkspaceRoutes.tsx b/frontend-web/src/pages/WorkspaceRoutes.tsx index 4357ae5c..5d0ec5c0 100644 --- a/frontend-web/src/pages/WorkspaceRoutes.tsx +++ b/frontend-web/src/pages/WorkspaceRoutes.tsx @@ -61,7 +61,7 @@ export function WorkspaceLayout({ ); } -function ChatRuntime({ children }: { children: ReactNode }) { +export function ChatRuntime({ children }: { children: ReactNode }) { return (