'use client' import { AlertDialog, AlertDialogActions, AlertDialogCancelButton, AlertDialogConfirmButton, AlertDialogContent, AlertDialogDescription, AlertDialogTitle, } from '@langgenius/dify-ui/alert-dialog' import { useTranslation } from 'react-i18next' export type CreateKnowledgeExitReason = 'discard' | 'partial' export function CreateKnowledgeExitDialog({ onCancel, onConfirm, reason, }: { onCancel: () => void onConfirm: () => void reason: CreateKnowledgeExitReason | null }) { const { t } = useTranslation('dataset') const { t: tCommon } = useTranslation('common') const isPartial = reason === 'partial' return ( { if (!open) onCancel() }} >
{t(($) => isPartial ? $['newKnowledge.leavePartialSetupTitle'] : $['newKnowledge.discardDraftTitle'], )} } className="system-md-regular text-text-secondary" > {t(($) => isPartial ? $['newKnowledge.leavePartialSetupDescription'] : $['newKnowledge.discardDraftDescription'], )}
{tCommon(($) => $['operation.cancel'])} {t(($) => isPartial ? $['newKnowledge.leavePartialSetupConfirm'] : $['newKnowledge.discardDraftConfirm'], )}
) }