mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 02:43:49 +08:00
Co-authored-by: Jingyi-Dify <jingyi.qi@dify.ai> Co-authored-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: hjlarry <hjlarry@163.com> Co-authored-by: Bond Zhu <783504079@qq.com> Co-authored-by: Yansong Zhang <916125788@qq.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
'use client'
|
|
|
|
import { cn } from '@langgenius/dify-ui/cn'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
export function AgentPreviewHeader({
|
|
isChatFeaturesOpen,
|
|
onToggleChatFeatures,
|
|
onRestart,
|
|
}: {
|
|
isChatFeaturesOpen: boolean
|
|
onToggleChatFeatures: () => void
|
|
onRestart: () => void
|
|
}) {
|
|
const { t } = useTranslation('agentV2')
|
|
|
|
return (
|
|
<div className="flex h-12 shrink-0 items-center gap-3 py-3 pr-3 pl-6">
|
|
<h2 className="min-w-0 flex-1 truncate title-xl-semi-bold text-text-primary">
|
|
{t('agentDetail.configure.preview.title')}
|
|
</h2>
|
|
<div className="flex shrink-0 items-center gap-1">
|
|
<button
|
|
type="button"
|
|
onClick={onRestart}
|
|
className="flex size-6 items-center justify-center rounded-md p-0.5 text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
|
|
aria-label={t('agentDetail.configure.preview.restart')}
|
|
>
|
|
<span aria-hidden className="i-custom-vender-other-replay-line size-4" />
|
|
</button>
|
|
<button
|
|
type="button"
|
|
aria-pressed={isChatFeaturesOpen}
|
|
onClick={onToggleChatFeatures}
|
|
className={cn(
|
|
'flex h-8 items-center justify-center gap-0.5 rounded-lg px-3 py-2 text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden',
|
|
isChatFeaturesOpen && 'bg-state-base-hover text-text-secondary',
|
|
)}
|
|
aria-label={t('agentDetail.configure.preview.chatFeatures')}
|
|
>
|
|
<span aria-hidden className="i-ri-apps-2-add-line size-4" />
|
|
<span className="px-0.5 system-sm-medium">{t('agentDetail.configure.preview.chatFeatures')}</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|