mirror of
https://github.com/langgenius/dify.git
synced 2026-05-13 00:33:37 +08:00
51 lines
2.0 KiB
TypeScript
51 lines
2.0 KiB
TypeScript
'use client'
|
|
|
|
import { Button } from '@langgenius/dify-ui/button'
|
|
import { cn } from '@langgenius/dify-ui/cn'
|
|
import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
|
|
|
|
type ConfirmModalProps = {
|
|
show: boolean
|
|
onConfirm?: () => void
|
|
onClose: () => void
|
|
}
|
|
|
|
const ConfirmModal = ({ show, onConfirm, onClose }: ConfirmModalProps) => {
|
|
const { t } = useTranslation()
|
|
|
|
return (
|
|
<Dialog open={show} disablePointerDismissal>
|
|
<DialogContent
|
|
backdropProps={{ forceRender: true }}
|
|
className={cn('w-[600px]! max-w-[600px]! p-8!')}
|
|
>
|
|
<button
|
|
type="button"
|
|
aria-label={t('operation.close', { ns: 'common' })}
|
|
className="absolute top-4 right-4 cursor-pointer border-none bg-transparent p-2"
|
|
onClick={onClose}
|
|
>
|
|
<span aria-hidden className="i-ri-close-line h-4 w-4 text-text-tertiary" />
|
|
</button>
|
|
<div className="h-12 w-12 rounded-xl border-[0.5px] border-divider-regular bg-background-section p-3 shadow-xl">
|
|
<AlertTriangle className="h-6 w-6 text-[rgb(247,144,9)]" />
|
|
</div>
|
|
<DialogTitle className="relative mt-3 text-xl leading-[30px] font-semibold text-text-primary">{t('createTool.confirmTitle', { ns: 'tools' })}</DialogTitle>
|
|
<div className="my-1 text-sm leading-5 text-text-tertiary">
|
|
{t('createTool.confirmTip', { ns: 'tools' })}
|
|
</div>
|
|
<div className="flex items-center justify-end pt-6">
|
|
<div className="flex items-center">
|
|
<Button className="mr-2" onClick={onClose}>{t('operation.cancel', { ns: 'common' })}</Button>
|
|
<Button variant="primary" tone="destructive" onClick={onConfirm}>{t('operation.confirm', { ns: 'common' })}</Button>
|
|
</div>
|
|
</div>
|
|
</DialogContent>
|
|
</Dialog>
|
|
)
|
|
}
|
|
|
|
export default ConfirmModal
|