import React from 'react'; import { useAgentCategories } from '~/hooks/Agents'; import { cn } from '~/utils'; interface AgentCategoryDisplayProps { category?: string; className?: string; showIcon?: boolean; iconClassName?: string; showEmptyFallback?: boolean; } /** * Component to display an agent category with proper translation * * @param category - The category value (e.g., "general", "hr", etc.) * @param className - Optional className for the container * @param showIcon - Whether to show the category icon * @param iconClassName - Optional className for the icon * @param showEmptyFallback - Whether to show a fallback for empty categories */ const AgentCategoryDisplay: React.FC = ({ category, className = '', showIcon = true, iconClassName = 'h-4 w-4 mr-2', showEmptyFallback = false, }) => { const { categories, emptyCategory } = useAgentCategories(); // Find the category in our processed categories list const categoryItem = categories.find((c) => c.value === category); // Handle empty string case differently than undefined/null if (category === '') { if (!showEmptyFallback) { return null; } // Show the empty category placeholder return (
{emptyCategory.label}
); } // No category or unknown category if (!category || !categoryItem) { return null; } return (
{showIcon && categoryItem.icon && ( {categoryItem.icon} )} {categoryItem.label}
); }; export default AgentCategoryDisplay;