From ca2c45e5e7ceb89c7ac31b237c149bda86c24040 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 12:15:35 +0000 Subject: [PATCH] feat(ui): SectionHeader to shadcn - antd Typography/Button/Tooltip + @ant-design MessageOutlined/ CopyOutlined/Down/UpOutlined \u2192 shadcn Button/Tooltip + lucide MessageSquare/Copy/ChevronDown/ChevronUp. - Inline hover handlers replaced with Tailwind hover:bg-muted. - Copy button stopPropagation preserved to avoid triggering the parent collapse when clicked. Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang --- .../LogDetailsDrawer/SectionHeader.tsx | 131 +++++++++--------- 1 file changed, 64 insertions(+), 67 deletions(-) diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/SectionHeader.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/SectionHeader.tsx index 632ea961853..49169dc1226 100644 --- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/SectionHeader.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/SectionHeader.tsx @@ -1,19 +1,20 @@ -/** - * SectionHeader - Datadog-style header with icon, label, metrics, and copy - */ - -import { Typography, Button, Tooltip } from 'antd'; -import { - MessageOutlined, - CopyOutlined, - DownOutlined, - UpOutlined -} from '@ant-design/icons'; - -const { Text } = Typography; +import { Button } from "@/components/ui/button"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { + ChevronDown, + ChevronUp, + Copy, + MessageSquare, +} from "lucide-react"; +import { cn } from "@/lib/utils"; interface SectionHeaderProps { - type: 'input' | 'output'; + type: "input" | "output"; tokens?: number; cost?: number; onCopy: () => void; @@ -22,87 +23,83 @@ interface SectionHeaderProps { turnCount?: number; } -export function SectionHeader({ type, tokens, cost, onCopy, isCollapsed, onToggleCollapse, turnCount }: SectionHeaderProps) { +export function SectionHeader({ + type, + tokens, + cost, + onCopy, + isCollapsed, + onToggleCollapse, + turnCount, +}: SectionHeaderProps) { return (
{ - if (onToggleCollapse) { - e.currentTarget.style.background = '#f5f5f5'; - } - }} - onMouseLeave={(e) => { - e.currentTarget.style.background = '#fafafa'; - }} + className={cn( + "flex items-center justify-between px-4 py-2.5 bg-muted/50 transition-colors", + !isCollapsed && "border-b border-border", + onToggleCollapse ? "cursor-pointer hover:bg-muted" : "", + )} > -
- {/* Collapse Arrow */} +
{onToggleCollapse && ( -
+
{isCollapsed ? ( - + ) : ( - + )}
)} - {/* Icon + Label */} -
- {type === 'input' ? ( - +
+ {type === "input" ? ( + ) : ( - ✨ + ✨ )} - - {type === 'input' ? 'Input' : 'Output'} - + + {type === "input" ? "Input" : "Output"} +
- {/* Tokens */} {tokens !== undefined && ( - + Tokens: {tokens.toLocaleString()} - + )} - {/* Cost */} {cost !== undefined && ( - + Cost: ${cost.toFixed(6)} - + )} - {/* Turn count */} {turnCount !== undefined && turnCount > 0 && ( - + Turns: {turnCount} - + )}
- {/* Copy Button */} - - + + Copy + +
); }