| 1 | import { ComputerDesktopIcon, SparklesIcon } from "@heroicons/react/24/outline"; |
| 2 | import { ProfileDescription } from "core/config/ProfileLifecycleManager"; |
| 3 | import { isLocalProfile } from "../../util"; |
| 4 | |
| 5 | export interface AssistantIconProps { |
| 6 | assistant: ProfileDescription; |
| 7 | size?: number; |
| 8 | } |
| 9 | |
| 10 | export function AssistantIcon({ assistant, size }: AssistantIconProps) { |
| 11 | const sizeTw = size ?? 4; |
| 12 | if (isLocalProfile(assistant)) { |
| 13 | return ( |
| 14 | <div |
| 15 | className={`h-${sizeTw} w-${sizeTw} bg-lightgray flex items-center justify-center rounded-full`} |
| 16 | > |
| 17 | <ComputerDesktopIcon |
| 18 | className={`h-${sizeTw - 1} w-${sizeTw - 1} font-bold text-black`} |
| 19 | /> |
| 20 | </div> |
| 21 | ); |
| 22 | } else if (assistant.iconUrl) { |
| 23 | return ( |
| 24 | <img |
| 25 | src={assistant.iconUrl} |
| 26 | className={`h-${sizeTw} w-${sizeTw} rounded-full`} |
| 27 | alt="" |
| 28 | /> |
| 29 | ); |
| 30 | } else { |
| 31 | return <SparklesIcon />; |
| 32 | } |
| 33 | } |