Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

989 B
Raw Blame
'use client'

import type { ButtonProps } from '@langgenius/dify-ui/button'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { useTranslation } from 'react-i18next'
import { useAgentOrchestrateViewingVersion } from '../read-only-context'

type ConfigureSectionAddButtonProps = Omit<
  ButtonProps,
  'aria-label' | 'children' | 'size' | 'variant'
> & {
  ariaLabel: string
}

export function ConfigureSectionAddButton({
  ariaLabel,
  className,
  ...props
}: ConfigureSectionAddButtonProps) {
  const { t } = useTranslation(['common'])
  const isViewingVersion = useAgentOrchestrateViewingVersion()

  if (isViewingVersion) return null

  return (
    <Button
      {...props}
      aria-label={ariaLabel}
      variant="ghost"
      size="small"
      className={cn('shrink-0 px-2', className)}
    >
      <span aria-hidden className="i-ri-add-line size-3.5" />
      <span>{t(($) => $['operation.add'])}</span>
    </Button>
  )
}