mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-04 17:48:50 +01:00
* a11y: silence miscellaneous icons that should not be read by screen reader (#5723, #5724) * 📝 chore: Update bug report template with additional guidance and version information * 📝 chore: Update bug report template to guide users on using Discussions for general inquiries and setup help --------- Co-authored-by: Danny Avila <danny@librechat.ai>
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import React from 'react';
|
|
import {
|
|
Dices,
|
|
BoxIcon,
|
|
PenLineIcon,
|
|
LightbulbIcon,
|
|
LineChartIcon,
|
|
ShoppingBagIcon,
|
|
PlaneTakeoffIcon,
|
|
GraduationCapIcon,
|
|
TerminalSquareIcon,
|
|
} from 'lucide-react';
|
|
import { cn } from '~/utils';
|
|
|
|
const categoryIconMap: Record<string, React.ElementType> = {
|
|
misc: BoxIcon,
|
|
roleplay: Dices,
|
|
write: PenLineIcon,
|
|
idea: LightbulbIcon,
|
|
shop: ShoppingBagIcon,
|
|
finance: LineChartIcon,
|
|
code: TerminalSquareIcon,
|
|
travel: PlaneTakeoffIcon,
|
|
teach_or_explain: GraduationCapIcon,
|
|
};
|
|
|
|
const categoryColorMap: Record<string, string> = {
|
|
code: 'text-red-500',
|
|
misc: 'text-blue-300',
|
|
shop: 'text-purple-400',
|
|
idea: 'text-yellow-300',
|
|
write: 'text-purple-400',
|
|
travel: 'text-yellow-300',
|
|
finance: 'text-orange-400',
|
|
roleplay: 'text-orange-400',
|
|
teach_or_explain: 'text-blue-300',
|
|
};
|
|
|
|
export default function CategoryIcon({
|
|
category,
|
|
className = '',
|
|
}: {
|
|
category: string;
|
|
className?: string;
|
|
}) {
|
|
const IconComponent = categoryIconMap[category];
|
|
const colorClass = categoryColorMap[category] + ' ' + className;
|
|
if (!IconComponent) {
|
|
return null;
|
|
}
|
|
return <IconComponent className={cn(colorClass, className)} aria-hidden="true" />;
|
|
}
|