diff --git a/ui/litellm-dashboard/.eslintrc.json b/ui/litellm-dashboard/.eslintrc.json index 6da9f5e4529..ddf8a7fee7d 100644 --- a/ui/litellm-dashboard/.eslintrc.json +++ b/ui/litellm-dashboard/.eslintrc.json @@ -68,6 +68,7 @@ "src/components/agent_management/AgentSelector.tsx", "src/components/CostTrackingSettings/how_it_works.tsx", "src/components/Settings/AdminSettings/UISettings/PageVisibilitySettings.tsx", + "src/components/AIHub/marketplace_table_columns.tsx", "src/components/UsagePage/components/EntityUsage/SpendByProvider.tsx", "src/components/view_logs/ToolsSection/FormattedToolView.tsx", "src/components/Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable.tsx", diff --git a/ui/litellm-dashboard/src/components/AIHub/marketplace_table_columns.tsx b/ui/litellm-dashboard/src/components/AIHub/marketplace_table_columns.tsx index ed17e84c23e..928c234984b 100644 --- a/ui/litellm-dashboard/src/components/AIHub/marketplace_table_columns.tsx +++ b/ui/litellm-dashboard/src/components/AIHub/marketplace_table_columns.tsx @@ -1,7 +1,14 @@ import { ColumnDef } from "@tanstack/react-table"; -import { Button, Badge, Text } from "@tremor/react"; -import { Tooltip } from "antd"; -import { CopyOutlined } from "@ant-design/icons"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { cn } from "@/lib/utils"; +import { Copy } from "lucide-react"; import { MarketplacePluginEntry } from "@/components/claude_code_plugins/types"; import { formatInstallCommand, @@ -9,170 +16,208 @@ import { getSourceDisplayText, } from "@/components/claude_code_plugins/helpers"; +// Map tremor palette names to categorical Tailwind classes +const categoryColorClass: Record = { + blue: "bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300", + green: + "bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300", + emerald: + "bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300", + amber: + "bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300", + yellow: + "bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300", + red: "bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-300", + purple: + "bg-purple-100 text-purple-700 dark:bg-purple-950 dark:text-purple-300", + indigo: + "bg-indigo-100 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-300", + gray: "bg-muted text-muted-foreground", +}; + export const getMarketplaceTableColumns = ( copyToClipboard: (text: string) => void, + // eslint-disable-next-line @typescript-eslint/no-unused-vars publicPage: boolean = false, -): ColumnDef[] => { - const allColumns: ColumnDef[] = [ - { - header: "Plugin Name", - accessorKey: "name", - enableSorting: true, - sortingFn: "alphanumeric", - cell: ({ row }) => { - const plugin = row.original; - const installCommand = formatInstallCommand(plugin); +): ColumnDef[] => [ + { + header: "Plugin Name", + accessorKey: "name", + enableSorting: true, + sortingFn: "alphanumeric", + cell: ({ row }) => { + const plugin = row.original; + const installCommand = formatInstallCommand(plugin); - return ( -
-
- {plugin.name} - - copyToClipboard(installCommand)} - className="cursor-pointer text-gray-500 hover:text-blue-500 text-xs" - /> - -
- {/* Show description on mobile */} -
- - {plugin.description || "No description"} - -
-
- ); - }, - }, - { - header: "Description", - accessorKey: "description", - enableSorting: true, - sortingFn: "alphanumeric", - cell: ({ row }) => { - const plugin = row.original; - - return ( - - {plugin.description || "-"} - - ); - }, - meta: { - className: "hidden md:table-cell", - }, - }, - { - header: "Version", - accessorKey: "version", - enableSorting: true, - sortingFn: "alphanumeric", - cell: ({ row }) => { - const plugin = row.original; - - return plugin.version ? ( - - v{plugin.version} - - ) : ( - - - ); - }, - meta: { - className: "hidden lg:table-cell", - }, - }, - { - header: "Category", - accessorKey: "category", - enableSorting: true, - sortingFn: "alphanumeric", - cell: ({ row }) => { - const plugin = row.original; - const badgeColor = getCategoryBadgeColor(plugin.category); - - return plugin.category ? ( - - {plugin.category} - - ) : ( - - Uncategorized - - ); - }, - meta: { - className: "hidden lg:table-cell", - }, - }, - { - header: "Source", - accessorKey: "source", - enableSorting: false, - cell: ({ row }) => { - const plugin = row.original; - const sourceText = getSourceDisplayText(plugin.source); - - return {sourceText}; - }, - meta: { - className: "hidden xl:table-cell", - }, - }, - { - header: "Keywords", - accessorKey: "keywords", - enableSorting: false, - cell: ({ row }) => { - const plugin = row.original; - const keywords = plugin.keywords?.slice(0, 3) || []; - const remaining = (plugin.keywords?.length || 0) - 3; - - return ( -
- {keywords.map((keyword, index) => ( - - {keyword} - - ))} - {remaining > 0 && ( - - +{remaining} - - )} -
- ); - }, - meta: { - className: "hidden xl:table-cell", - }, - }, - { - header: "Install Command", - id: "install_command", - enableSorting: false, - cell: ({ row }) => { - const plugin = row.original; - const installCommand = formatInstallCommand(plugin); - - return ( + return ( +
- - {installCommand} - - - + + Copy install command + +
- ); - }, +
+

+ {plugin.description || "No description"} +

+
+
+ ); }, - ]; + }, + { + header: "Description", + accessorKey: "description", + enableSorting: true, + sortingFn: "alphanumeric", + cell: ({ row }) => { + const plugin = row.original; + return ( +

{plugin.description || "-"}

+ ); + }, + meta: { + className: "hidden md:table-cell", + }, + }, + { + header: "Version", + accessorKey: "version", + enableSorting: true, + sortingFn: "alphanumeric", + cell: ({ row }) => { + const plugin = row.original; + return plugin.version ? ( + + v{plugin.version} + + ) : ( + - + ); + }, + meta: { + className: "hidden lg:table-cell", + }, + }, + { + header: "Category", + accessorKey: "category", + enableSorting: true, + sortingFn: "alphanumeric", + cell: ({ row }) => { + const plugin = row.original; + const badgeColor = getCategoryBadgeColor(plugin.category); - return allColumns; -}; + return plugin.category ? ( + + {plugin.category} + + ) : ( + + Uncategorized + + ); + }, + meta: { + className: "hidden lg:table-cell", + }, + }, + { + header: "Source", + accessorKey: "source", + enableSorting: false, + cell: ({ row }) => { + const plugin = row.original; + return ( + + {getSourceDisplayText(plugin.source)} + + ); + }, + meta: { + className: "hidden xl:table-cell", + }, + }, + { + header: "Keywords", + accessorKey: "keywords", + enableSorting: false, + cell: ({ row }) => { + const plugin = row.original; + const keywords = plugin.keywords?.slice(0, 3) || []; + const remaining = (plugin.keywords?.length || 0) - 3; + + return ( +
+ {keywords.map((keyword, index) => ( + + {keyword} + + ))} + {remaining > 0 && ( + + +{remaining} + + )} +
+ ); + }, + meta: { + className: "hidden xl:table-cell", + }, + }, + { + header: "Install Command", + id: "install_command", + enableSorting: false, + cell: ({ row }) => { + const plugin = row.original; + const installCommand = formatInstallCommand(plugin); + + return ( +
+ + {installCommand} + + + + + + + Copy command + + +
+ ); + }, + }, +];