Files
chinese-family-tree-2/components/tree/generation-warning-dialog.tsx
T
freedakgmail 5c8c70097c 0.8.0.0
2025-12-21 17:32:33 +08:00

87 lines
2.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client"
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog"
import { AlertTriangle } from "lucide-react"
interface GenerationWarningDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
memberName: string
relationType: 'father' | 'mother'
onConfirm: () => void
}
/**
* 代数重新计算警告对话框
* 当用户尝试给第1代成员(始祖)添加父母时显示此对话框
*/
export function GenerationWarningDialog({
open,
onOpenChange,
memberName,
relationType,
onConfirm,
}: GenerationWarningDialogProps) {
const relationText = relationType === 'father' ? '父亲' : '母亲'
const handleConfirm = () => {
onOpenChange(false)
onConfirm()
}
return (
<AlertDialog open={open} onOpenChange={onOpenChange}>
<AlertDialogContent className="max-w-md">
<AlertDialogHeader>
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-900/30">
<AlertTriangle className="h-5 w-5 text-amber-600 dark:text-amber-500" />
</div>
<AlertDialogTitle className="text-lg">
</AlertDialogTitle>
</div>
<AlertDialogDescription asChild>
<div className="space-y-3 pt-2">
<p>
<span className="font-semibold text-foreground">{memberName}</span> {relationText}
<span className="text-amber-600 dark:text-amber-500 font-medium"></span>
</p>
<div className="rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 p-3">
<p className="text-sm text-amber-800 dark:text-amber-200">
<span className="font-medium"></span>
<br />
12{relationText}1
</p>
</div>
<p className="text-sm text-muted-foreground">
</p>
</div>
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel></AlertDialogCancel>
<AlertDialogAction
onClick={handleConfirm}
className="bg-amber-600 hover:bg-amber-700 text-white"
>
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}