import { useState } from 'react' import { useTranslation } from 'react-i18next' import { useEmbeddedChatbotContext } from '../context' import { useThemeContext } from '../theme/theme-context' import { CssTransform } from '../theme/utils' import Form from './form' import cn from '@/utils/classnames' import Button from '@/app/components/base/button' import AppIcon from '@/app/components/base/app-icon' import { MessageDotsCircle } from '@/app/components/base/icons/src/vender/solid/communication' import { Edit02 } from '@/app/components/base/icons/src/vender/line/general' import { Star06 } from '@/app/components/base/icons/src/vender/solid/shapes' import LogoSite from '@/app/components/base/logo/logo-site' const ConfigPanel = () => { const { t } = useTranslation() const { appData, inputsForms, handleStartChat, showConfigPanelBeforeChat, isMobile, } = useEmbeddedChatbotContext() const [collapsed, setCollapsed] = useState(true) const customConfig = appData?.custom_config const site = appData?.site const themeBuilder = useThemeContext() return (
{ showConfigPanelBeforeChat && ( <>
{appData?.site.title}
{ appData?.site.description && (
{appData?.site.description}
) } ) } { !showConfigPanelBeforeChat && collapsed && ( <>
{t('share.chat.configStatusDes')}
) } { !showConfigPanelBeforeChat && !collapsed && ( <>
{t('share.chat.privatePromptConfigTitle')}
) }
{ !collapsed && !showConfigPanelBeforeChat && (
) } { showConfigPanelBeforeChat && (
) }
{ showConfigPanelBeforeChat && (site || customConfig) && (
{site?.privacy_policy ?
{t('share.chat.privacyPolicyLeft')} {t('share.chat.privacyPolicyMiddle')} {t('share.chat.privacyPolicyRight')}
:
} { customConfig?.remove_webapp_brand ? null : (
{t('share.chat.poweredBy')} { customConfig?.replace_webapp_logo ? logo : }
) }
) }
) } export default ConfigPanel