Files
dify/web/app/components/workflow/header/dify-builder-button.tsx
T
Charles YaoandClaude Opus 4.8 7e83264330 refactor: rename Workflow Copilot → Dify Builder
Project rename across api/ + web/: modules, symbols, routes
(/console/api/dify-builder/*), feature flag (DIFY_BUILDER_ENABLED),
Celery queue/tasks, the 7 DB tables (via migration df1b0114de40),
and regenerated contract artifacts. Behavior unchanged; 430 tests green,
ruff clean. Branch renamed feat/copilot-py-backend → dify-builder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-23 11:18:35 -07:00

50 lines
1.6 KiB
TypeScript

import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
import { useStore } from '@/app/components/workflow/store'
import useTheme from '@/hooks/use-theme'
const DifyBuilderButton = ({ disabled }: { disabled: boolean }) => {
const { t } = useTranslation()
const { theme } = useTheme()
const showDifyBuilderPanel = useStore((s) => s.showDifyBuilderPanel)
const setShowDifyBuilderPanel = useStore((s) => s.setShowDifyBuilderPanel)
const label = t(($) => $['difyBuilder.buttonTooltip'], { ns: 'workflow' })
const handleClick = () => {
setShowDifyBuilderPanel(!showDifyBuilderPanel)
}
return (
<Tooltip>
<TooltipTrigger
render={
<Button
aria-label={label}
aria-pressed={showDifyBuilderPanel}
className={cn(
'rounded-lg border border-transparent p-2',
theme === 'dark' &&
showDifyBuilderPanel &&
'border-black/5 bg-white/10 backdrop-blur-xs',
)}
variant="ghost"
disabled={disabled}
onClick={handleClick}
>
<span
aria-hidden
className="i-ri-magic-line size-4 text-components-button-secondary-text"
/>
</Button>
}
/>
<TooltipContent>{label}</TooltipContent>
</Tooltip>
)
}
export default memo(DifyBuilderButton)