'use client' import type { BuiltInMetadataItem } from '../types' import { Button } from '@langgenius/dify-ui/button' import { Input } from '@langgenius/dify-ui/input' import { noop } from 'es-toolkit/function' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import OptionCard from '../../../workflow/nodes/_base/components/option-card' import { DataType } from '../types' import Field from './field' const i18nPrefix = 'metadata.createMetadata' export type Props = Readonly<{ onClose?: () => void onSave: (data: BuiltInMetadataItem) => void hasBack?: boolean onBack?: () => void }> export function CreateContent({ onClose = noop, hasBack, onBack, onSave }: Props) { const { t } = useTranslation() const [type, setType] = useState(DataType.string) const handleTypeChange = useCallback( (newType: DataType) => { return () => setType(newType) }, [setType], ) const [name, setName] = useState('') const handleSave = useCallback(() => { onSave({ type, name, }) }, [onSave, type, name]) return (