'use client' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import { ClipboardDocumentIcon, HandThumbDownIcon, HandThumbUpIcon } from '@heroicons/react/24/outline' import copy from 'copy-to-clipboard' import type { FeedbackType } from '@/app/components/base/chat/chat/type' import Button from '@/app/components/base/button' import Toast from '@/app/components/base/toast' import Tooltip from '@/app/components/base/tooltip' type IResultHeaderProps = { result: string showFeedback: boolean feedback: FeedbackType onFeedback: (feedback: FeedbackType) => void } const Header: FC = ({ feedback, showFeedback, onFeedback, result, }) => { const { t } = useTranslation() return (
{t('share.generation.resultTitle')}
{showFeedback && feedback.rating && feedback.rating === 'like' && (
{ onFeedback({ rating: null, }) }} className='flex w-7 h-7 items-center justify-center rounded-md cursor-pointer !text-primary-600 border border-primary-200 bg-primary-100 hover:border-primary-300 hover:bg-primary-200'>
)} {showFeedback && feedback.rating && feedback.rating === 'dislike' && (
{ onFeedback({ rating: null, }) }} className='flex w-7 h-7 items-center justify-center rounded-md cursor-pointer !text-red-600 border border-red-200 bg-red-100 hover:border-red-300 hover:bg-red-200'>
)} {showFeedback && !feedback.rating && (
{ onFeedback({ rating: 'like', }) }} className='flex w-6 h-6 items-center justify-center rounded-md cursor-pointer hover:bg-gray-100'>
{ onFeedback({ rating: 'dislike', }) }} className='flex w-6 h-6 items-center justify-center rounded-md cursor-pointer hover:bg-gray-100'>
)}
) } export default React.memo(Header)