简化过度设计,恢复原生弹窗

- 删除 ConfirmModal 和 MessageModal 组件
- 恢复原生 alert() 和 confirm() 弹窗
- 移除不必要的加载状态指示器
- 移除切换供应商的确认对话框
- 简化代码,提升响应速度和用户体验
This commit is contained in:
farion1231
2025-08-06 07:59:11 +08:00
parent caa289bd7d
commit 3bd65c2acb
6 changed files with 20 additions and 201 deletions

View File

@@ -5,23 +5,21 @@ import './AddProviderModal.css'
interface AddProviderModalProps {
onAdd: (provider: Omit<Provider, 'id'>) => void
onClose: () => void
onError?: (message: string) => void
}
const AddProviderModal: React.FC<AddProviderModalProps> = ({ onAdd, onClose, onError }) => {
const AddProviderModal: React.FC<AddProviderModalProps> = ({ onAdd, onClose }) => {
const [formData, setFormData] = useState({
name: '',
apiUrl: '',
apiKey: ''
})
const [showPassword, setShowPassword] = useState(false)
const [error, setError] = useState<string>('')
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault()
if (!formData.name || !formData.apiUrl || !formData.apiKey) {
setError('请填写所有必填字段')
alert('请填写所有必填字段')
return
}
@@ -77,12 +75,6 @@ const AddProviderModal: React.FC<AddProviderModalProps> = ({ onAdd, onClose, onE
</div>
<form onSubmit={handleSubmit}>
{error && (
<div style={{ color: 'red', marginBottom: '1rem', padding: '0.5rem', backgroundColor: '#ffe6e6', borderRadius: '4px' }}>
{error}
</div>
)}
<div className="form-group">
<label htmlFor="name"> *</label>
<input