From 9cbad58a7090df9ec19ab46b0500cde1e0a1fa7d Mon Sep 17 00:00:00 2001 From: mateo Date: Thu, 17 Sep 2026 20:03:49 +0000 Subject: [PATCH] refactor(ui): remove unused HelpLink and HelpIcon components Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../src/components/HelpLink.test.tsx | 80 +----------- .../src/components/HelpLink.tsx | 120 ------------------ 2 files changed, 1 insertion(+), 199 deletions(-) diff --git a/ui/litellm-dashboard/src/components/HelpLink.test.tsx b/ui/litellm-dashboard/src/components/HelpLink.test.tsx index e502126477a..a247b39b145 100644 --- a/ui/litellm-dashboard/src/components/HelpLink.test.tsx +++ b/ui/litellm-dashboard/src/components/HelpLink.test.tsx @@ -3,85 +3,7 @@ import { describe, it, expect } from "vitest"; import { screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { renderWithProviders } from "../../tests/test-utils"; -import { HelpLink, HelpIcon, DocsMenu } from "./HelpLink"; - -describe("HelpLink", () => { - it("should render with default children and open in new tab", () => { - renderWithProviders(); - - const link = screen.getByRole("link", { name: /learn more/i }); - expect(link).toHaveAttribute("href", "https://docs.example.com"); - expect(link).toHaveAttribute("target", "_blank"); - expect(link).toHaveAttribute("rel", "noopener noreferrer"); - }); - - it("should render custom children text", () => { - renderWithProviders(Custom docs link); - - expect(screen.getByText("Custom docs link")).toBeInTheDocument(); - }); - - it("should have the correct href", () => { - renderWithProviders(); - expect(screen.getByRole("link")).toHaveAttribute("href", "https://docs.example.com/test"); - }); - - it("should include a screen-reader-only label for accessibility", () => { - renderWithProviders(); - - expect(screen.getByText("(opens in a new tab)")).toBeInTheDocument(); - }); -}); - -describe("HelpIcon", () => { - it("should render a help button with accessible label", () => { - renderWithProviders(); - - expect(screen.getByRole("button", { name: /help information/i })).toBeInTheDocument(); - }); - - it("should show tooltip content on hover", async () => { - const user = userEvent.setup(); - renderWithProviders(); - - await user.hover(screen.getByRole("button", { name: /help information/i })); - - expect(screen.getByText("Tooltip help text")).toBeInTheDocument(); - }); - - it("should hide tooltip content when not hovered", () => { - renderWithProviders(); - expect(screen.queryByText("Hidden tooltip")).not.toBeInTheDocument(); - }); - - it("should show learn more link when learnMoreHref is provided", async () => { - const user = userEvent.setup(); - renderWithProviders(); - await user.hover(screen.getByRole("button", { name: /help information/i })); - expect(screen.getByText("Learn more")).toBeInTheDocument(); - }); - - it("should use custom learn more text when provided", async () => { - const user = userEvent.setup(); - renderWithProviders( - , - ); - - await user.hover(screen.getByRole("button", { name: /help information/i })); - - const link = screen.getByRole("link", { name: /read docs/i }); - expect(link).toHaveAttribute("href", "https://docs.example.com"); - }); - - it("should not show learn more link when learnMoreHref is not provided", async () => { - const user = userEvent.setup(); - renderWithProviders(); - - await user.hover(screen.getByRole("button", { name: /help information/i })); - - expect(screen.queryByRole("link")).not.toBeInTheDocument(); - }); -}); +import { DocsMenu } from "./HelpLink"; describe("DocsMenu", () => { const items = [ diff --git a/ui/litellm-dashboard/src/components/HelpLink.tsx b/ui/litellm-dashboard/src/components/HelpLink.tsx index 35e2e5f535f..39ac18f9e80 100644 --- a/ui/litellm-dashboard/src/components/HelpLink.tsx +++ b/ui/litellm-dashboard/src/components/HelpLink.tsx @@ -1,13 +1,6 @@ import React, { useState, useRef, useEffect } from "react"; import { ExternalLink, ChevronDown } from "lucide-react"; -interface HelpLinkProps { - href: string; - children?: React.ReactNode; - variant?: "inline" | "subtle" | "button"; - className?: string; -} - interface DocMenuItem { label: string; href: string; @@ -19,119 +12,6 @@ interface DocsMenuProps { className?: string; } -/** - * A reusable component for linking to documentation, styled similar to Linear's help links. - * - * @example - * // Inline "Learn more" style - * - * Learn more about custom pricing - * - * - * @example - * // Subtle link (just icon + text, minimal styling) - * - * View docs - * - * - * @example - * // Button style (more prominent) - * - * Custom Pricing Documentation - * - */ -export const HelpLink: React.FC = ({ - href, - children = "Learn more", - variant = "inline", - className = "", -}) => { - const baseClasses = - "inline-flex items-center gap-1.5 transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-1 rounded-sm"; - - const variantClasses = { - inline: "text-info text-sm font-medium hover:underline", - subtle: "text-muted-foreground hover:text-foreground text-xs", - button: - "text-info border border-border px-3 py-1.5 rounded-md bg-card hover:bg-accent text-sm font-medium shadow-xs", - }; - - return ( - - {children} - - ); -}; - -/** - * A minimal help icon with tooltip for inline contextual help. - * Similar to Linear's "?" icons that appear next to labels. - */ -interface HelpIconProps { - content: React.ReactNode; - learnMoreHref?: string; - learnMoreText?: string; -} - -export const HelpIcon: React.FC = ({ content, learnMoreHref, learnMoreText = "Learn more" }) => { - const [showTooltip, setShowTooltip] = React.useState(false); - - return ( -
- - {showTooltip && ( -
-
{content}
- {learnMoreHref && ( - - {learnMoreText} - - )} -
-
- )} -
- ); -}; - /** * A dropdown menu for multiple documentation links. * Linear-style: Single "Docs" button that expands to show multiple relevant links.