refactor: LdapConfigPage 删除确认弹框统一使用 ConfirmDialog 公共组件
- 移除 LdapConfigPage 自定义 ModalOverlay 确认弹框 - 替换为 ConfirmDialog(variant=danger) 保持风格统一 - 清理未使用的 AlertTriangle import - 全站确认弹框现已全部统一使用 ConfirmDialog 组件
This commit is contained in:
1 parent
bef2f98f28
commit
dce6b8cc28
1 file changed
+11
-26
@@ -2,11 +2,12 @@ import { useState, useEffect, useCallback } from 'react';
|
|||||||
import api from '@/api/request';
|
import api from '@/api/request';
|
||||||
import { FormDialog } from '@/components/FormDialog';
|
import { FormDialog } from '@/components/FormDialog';
|
||||||
import { ModalOverlay } from '@/components/ModalOverlay';
|
import { ModalOverlay } from '@/components/ModalOverlay';
|
||||||
|
import { ConfirmDialog } from '@/components/ConfirmDialog';
|
||||||
import { toast } from '@/hooks/useToast';
|
import { toast } from '@/hooks/useToast';
|
||||||
import {
|
import {
|
||||||
Save, ChevronRight, ChevronDown, RefreshCw,
|
Save, ChevronRight, ChevronDown, RefreshCw,
|
||||||
CheckCircle, XCircle, Trash2, KeyRound, FolderOpen, Users,
|
CheckCircle, XCircle, Trash2, KeyRound, FolderOpen, Users,
|
||||||
Shield, AlertTriangle, Import, UserPlus,
|
Shield, Import, UserPlus,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
|
|
||||||
/* ── types ── */
|
/* ── types ── */
|
||||||
@@ -845,31 +846,15 @@ export default function LdapConfigPage() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* ── 删除确认弹框 ── */}
|
{/* ── 删除确认弹框 ── */}
|
||||||
{showDeleteConfirm && (
|
<ConfirmDialog
|
||||||
<ModalOverlay open={true} onClose={() => setShowDeleteConfirm(false)} width="max-w-sm">
|
open={showDeleteConfirm}
|
||||||
<div className="w-full bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded-xl p-5 shadow-xl">
|
title="确认删除"
|
||||||
<div className="flex items-center justify-between mb-4">
|
description={`确认删除 ${selectedDns.size} 个 LDAP 用户?此操作不可逆。`}
|
||||||
<div className="flex items-center gap-2">
|
confirmText="确认删除"
|
||||||
<AlertTriangle className="w-4 h-4 text-red-400" />
|
variant="danger"
|
||||||
<h3 className="text-sm font-semibold text-[var(--dg-text-primary)]">确认删除</h3>
|
onConfirm={() => { confirmDelete(); }}
|
||||||
</div>
|
onCancel={() => setShowDeleteConfirm(false)}
|
||||||
<button onClick={() => setShowDeleteConfirm(false)} className="text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)] transition-colors">✕</button>
|
/>
|
||||||
</div>
|
|
||||||
<p className="text-sm text-[var(--dg-text-secondary)] mb-5">
|
|
||||||
确认删除 <span className="text-red-400 font-medium">{selectedDns.size}</span> 个 LDAP 用户?此操作不可逆。
|
|
||||||
</p>
|
|
||||||
<div className="flex justify-end gap-2">
|
|
||||||
<button onClick={() => setShowDeleteConfirm(false)} className="px-4 py-2 text-sm text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)] transition-colors">取消</button>
|
|
||||||
<button
|
|
||||||
onClick={confirmDelete}
|
|
||||||
className="flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-lg bg-red-500 text-white hover:bg-red-600 transition-colors"
|
|
||||||
>
|
|
||||||
<Trash2 className="w-3.5 h-3.5" />确认删除
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ModalOverlay>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user