import type { FC } from 'react' import React from 'react' import { RiResetLeftLine } from '@remixicon/react' import { useTranslation } from 'react-i18next' import type { Theme } from '../theme/theme-context' import { CssTransform } from '../theme/utils' import { useEmbeddedChatbotContext, } from '../context' import Tooltip from '@/app/components/base/tooltip' import ActionButton from '@/app/components/base/action-button' import Divider from '@/app/components/base/divider' import ViewFormDropdown from '@/app/components/base/chat/embedded-chatbot/inputs-form/view-form-dropdown' import LogoSite from '@/app/components/base/logo/logo-site' import cn from '@/utils/classnames' export type IHeaderProps = { isMobile?: boolean customerIcon?: React.ReactNode title: string theme?: Theme onCreateNewChat?: () => void } const Header: FC = ({ isMobile, customerIcon, title, theme, onCreateNewChat, }) => { const { t } = useTranslation() const { appData, currentConversationId, inputsForms, } = useEmbeddedChatbotContext() if (!isMobile) { return (
{/* powered by */}
{!appData?.custom_config?.remove_webapp_brand && (
{t('share.chat.poweredBy')}
{appData?.custom_config?.replace_webapp_logo && ( logo )} {!appData?.custom_config?.replace_webapp_logo && ( )}
)}
{currentConversationId && ( )} {currentConversationId && ( )} {currentConversationId && inputsForms.length > 0 && ( )}
) } return (
{customerIcon}
{title}
{currentConversationId && ( )} {currentConversationId && inputsForms.length > 0 && ( )}
) } export default React.memo(Header)