Files
dify/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx
Stephen Zhou 6d0e36479b refactor(i18n): use JSON with flattened key and namespace (#30114)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-12-29 14:52:32 +08:00

46 lines
1.4 KiB
TypeScript

import type { FC } from 'react'
import type { VersionHistory } from '@/types/workflow'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import Button from '@/app/components/base/button'
import Modal from '@/app/components/base/modal'
type DeleteConfirmModalProps = {
isOpen: boolean
versionInfo: VersionHistory
onClose: () => void
onDelete: (id: string) => void
}
const DeleteConfirmModal: FC<DeleteConfirmModalProps> = ({
isOpen,
versionInfo,
onClose,
onDelete,
}) => {
const { t } = useTranslation()
return (
<Modal className="p-0" isShow={isOpen} onClose={onClose}>
<div className="flex flex-col gap-y-2 p-6 pb-4 ">
<div className="title-2xl-semi-bold text-text-primary">
{`${t('operation.delete', { ns: 'common' })} ${versionInfo.marked_name || t('versionHistory.defaultName', { ns: 'workflow' })}`}
</div>
<p className="system-md-regular text-text-secondary">
{t('versionHistory.deletionTip', { ns: 'workflow' })}
</p>
</div>
<div className="flex items-center justify-end gap-x-2 p-6">
<Button onClick={onClose}>
{t('operation.cancel', { ns: 'common' })}
</Button>
<Button variant="warning" onClick={onDelete.bind(null, versionInfo.id)}>
{t('operation.delete', { ns: 'common' })}
</Button>
</div>
</Modal>
)
}
export default DeleteConfirmModal