diff --git a/ui/litellm-dashboard/src/components/CostTrackingSettings/provider_discount_table.tsx b/ui/litellm-dashboard/src/components/CostTrackingSettings/provider_discount_table.tsx index 235fe40ee21..0e04c843bc8 100644 --- a/ui/litellm-dashboard/src/components/CostTrackingSettings/provider_discount_table.tsx +++ b/ui/litellm-dashboard/src/components/CostTrackingSettings/provider_discount_table.tsx @@ -1,9 +1,12 @@ import React, { useState } from "react"; -import { TextInput, Icon, Text } from "@tremor/react"; -import { TrashIcon, PencilAltIcon, CheckIcon, XIcon } from "@heroicons/react/outline"; +import { Input } from "@/components/ui/input"; +import { Check, Pencil, Trash2, X } from "lucide-react"; import { SimpleTable } from "../common_components/simple_table"; import { DiscountConfig } from "./types"; -import { getProviderDisplayInfo, handleImageError } from "./provider_display_helpers"; +import { + getProviderDisplayInfo, + handleImageError, +} from "./provider_display_helpers"; interface ProviderDiscountTableProps { discountConfig: DiscountConfig; @@ -44,14 +47,13 @@ const ProviderDiscountTable: React.FC = ({ }; const handleKeyDown = (e: React.KeyboardEvent, provider: string) => { - if (e.key === 'Enter') { + if (e.key === "Enter") { handleSaveEdit(provider); - } else if (e.key === 'Escape') { + } else if (e.key === "Escape") { handleCancelEdit(); } }; - // Convert discount config to array and sort const data: ProviderDiscountRow[] = Object.entries(discountConfig) .map(([provider, discount]) => ({ provider, discount })) .sort((a, b) => { @@ -71,6 +73,7 @@ const ProviderDiscountTable: React.FC = ({ return (
{logo && ( + // eslint-disable-next-line @next/next/no-img-element {`${displayName} = ({
{editingProvider === row.provider ? ( <> - setEditValue(e.target.value)} onKeyDown={(e) => handleKeyDown(e, row.provider)} placeholder="5" - className="w-20" + className="w-20 h-8" autoFocus /> - % - % + + ) : ( <> - {(row.discount * 100).toFixed(1)}% - + {(row.discount * 100).toFixed(1)}% + + )}
@@ -131,12 +142,14 @@ const ProviderDiscountTable: React.FC = ({ cell: (row) => { const { displayName } = getProviderDisplayInfo(row.provider); return ( - onRemoveProvider(row.provider, displayName)} - className="cursor-pointer hover:text-red-600" - /> + className="cursor-pointer hover:text-destructive" + aria-label="Remove" + > + + ); }, width: "80px", @@ -149,4 +162,3 @@ const ProviderDiscountTable: React.FC = ({ }; export default ProviderDiscountTable; -