index.tsx 1.3 KB
/*
 * @Author: yangming@didihu.com.cn yangming@didihu.com.cn
 * @Date: 2025-04-22 09:29:17
 * @LastEditors: limin
 * @LastEditTime: 2025-07-14 19:42:31
 * @FilePath: \ai-assistant\app\components\base\answer-icon\index.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
'use client'

import { memo, type FC } from 'react'
import { init } from 'emoji-mart'
import data from '@emoji-mart/data'
import classNames from '@/utils/classnames'
import type { AppIconType } from '@/types/app'
import { AVATAR_AI_URL } from '@/app/components/base/chat/constants'
init({ data })

export type AnswerIconProps = {
  iconType?: AppIconType | null
  icon?: string | null
  background?: string | null
  imageUrl?: string
}

const AnswerIcon: FC<AnswerIconProps> = ({ iconType, background, imageUrl }) => {
  const wrapperClassName = classNames('flex', 'items-center', 'justify-center', 'w-full', 'h-full', 'rounded-full', 'text-xl')
  return (
    <div className={wrapperClassName}>
      <img src={imageUrl||AVATAR_AI_URL} className="h-full w-full rounded-full" alt="answer icon" />
    </div>
  )
}
const meAnswerIcon = memo(AnswerIcon, (prev, next) => prev.imageUrl === next.imageUrl)
export default meAnswerIcon