'use client'
import type { DocPathWithoutLang } from '@/types/doc-paths'
import { cn } from '@langgenius/dify-ui/cn'
import { RiArrowRightLine, RiArrowRightUpLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { buildIntegrationPath } from '@/app/components/integrations/routes'
import { useDocLink } from '@/context/i18n'
import useTheme from '@/hooks/use-theme'
import Link from '@/next/link'
import { NoToolPlaceholder } from '../../base/icons/src/vender/other'
import { ToolTypeEnum } from '../../workflow/block-selector/types'
type Props = Readonly<{
type?: ToolTypeEnum
isAgent?: boolean
}>
const workflowToolStepKeys = [
'workflowToolEmpty.step1',
'workflowToolEmpty.step2',
'workflowToolEmpty.step3',
] as const
const getLink = (type?: ToolTypeEnum) => {
switch (type) {
case ToolTypeEnum.Custom:
return buildIntegrationPath('custom-tool')
case ToolTypeEnum.MCP:
return buildIntegrationPath('mcp')
default:
return buildIntegrationPath('custom-tool')
}
}
const Empty = ({
type,
isAgent,
}: Props) => {
const { t } = useTranslation()
const docLink = useDocLink()
const { theme } = useTheme()
const hasLink = type && [ToolTypeEnum.Custom, ToolTypeEnum.MCP].includes(type)
const renderType = isAgent ? 'agent' as const : type
const hasTitle = renderType && t(`addToolModal.${renderType}.title`, { ns: 'tools' }) !== `addToolModal.${renderType}.title`
const tipClassName = cn(
'flex items-center text-[13px] leading-[18px] text-text-tertiary',
hasLink && 'cursor-pointer hover:text-text-accent',
)
const tipContent = renderType && (
<>
{t(`addToolModal.${renderType}.tip`, { ns: 'tools' })}
{' '}
{hasLink &&