settings: - Add actions-brand, brand-config, data-access-brand for brand management - Add admin-file-upload-card, admin-notification-config-card, admin-school-info-card, admin-security-policy-card - Add ai-provider-delete-dialog, ai-provider-selector, brand-config-card - Add security-recent-logins-section, security-two-factor-section - Add config/profile-overview-config, data-access-profile-overview, lib/system-settings-utils questions: - Add batch-operations, import-export-buttons, knowledge-point-selector, options-editor - Add question-bank-results-client, question-cascade-filter, question-content-renderer, utils school: - Add grade-delete-dialog, grade-form-dialog, grade-list-toolbar, grade-overview-cards - Add use-grade-data hook textbooks: - Add textbook-form-fields component - Add use-kp-create, use-kp-delete, use-kp-update hooks
69 lines
1.9 KiB
TypeScript
69 lines
1.9 KiB
TypeScript
"use client"
|
|
|
|
import { useTranslations } from "next-intl"
|
|
import { Loader2, Trash2 } from "lucide-react"
|
|
import { type ReactElement } from "react"
|
|
|
|
import { Button } from "@/shared/components/ui/button"
|
|
import {
|
|
AlertDialog,
|
|
AlertDialogAction,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogDescription,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogTitle,
|
|
AlertDialogTrigger,
|
|
} from "@/shared/components/ui/alert-dialog"
|
|
|
|
interface AiProviderDeleteDialogProps {
|
|
/** 是否禁用删除按钮(无选中项或正在执行其他操作时) */
|
|
disabled: boolean
|
|
/** 是否正在执行删除操作 */
|
|
isPending: boolean
|
|
/** 确认删除回调 */
|
|
onConfirm: () => void
|
|
}
|
|
|
|
/**
|
|
* AI 服务商删除确认对话框
|
|
*
|
|
* 仅负责删除确认交互,具体删除逻辑由父组件通过 onConfirm 回调注入。
|
|
*/
|
|
export function AiProviderDeleteDialog({
|
|
disabled,
|
|
isPending,
|
|
onConfirm,
|
|
}: AiProviderDeleteDialogProps): ReactElement {
|
|
const t = useTranslations("settings.ai.providers")
|
|
|
|
return (
|
|
<AlertDialog>
|
|
<AlertDialogTrigger asChild>
|
|
<Button
|
|
type="button"
|
|
variant="destructive"
|
|
disabled={disabled}
|
|
>
|
|
<Trash2 className="mr-2 h-4 w-4" />
|
|
{t("delete")}
|
|
</Button>
|
|
</AlertDialogTrigger>
|
|
<AlertDialogContent>
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>{t("deleteConfirmTitle")}</AlertDialogTitle>
|
|
<AlertDialogDescription>{t("deleteConfirmDescription")}</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>{t("deleteCancel")}</AlertDialogCancel>
|
|
<AlertDialogAction onClick={onConfirm}>
|
|
{isPending ? <Loader2 className="mr-2 h-4 w-4 animate-spin" /> : null}
|
|
{t("deleteConfirm")}
|
|
</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
)
|
|
}
|