mirror of
https://github.com/langgenius/dify.git
synced 2026-10-04 13:47:55 +08:00
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>
50 lines
1.6 KiB
TypeScript
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)
|