import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog" import { StatusBadge } from "@/components/question/StatusBadge" import { TRANSITION_LABELS } from "@/lib/constants" import type { Question, QuestionStatus } from "@/types/question" interface StatusTransitionDialogProps { open: boolean onOpenChange: (open: boolean) => void question: Question | null targetStatus: QuestionStatus | null onConfirm: () => void } export function StatusTransitionDialog({ open, onOpenChange, question, targetStatus, onConfirm, }: StatusTransitionDialogProps) { if (!question || !targetStatus) return null const label = TRANSITION_LABELS[targetStatus] const description = getDescription(question.status, targetStatus) return ( {label.title} {description} → 题目:{question.stem.length > 40 ? question.stem.slice(0, 40) + "..." : question.stem} 取消 {label.action} ) } function getDescription(from: QuestionStatus, to: QuestionStatus): string { const descriptions: Record = { "draft→reviewing": "提交后题目将进入审核队列,等待审核通过后才能发布。", "reviewing→published": "审核通过后题目将对所有用户可见,请确认题目内容无误。", "reviewing→draft": "将题目退回草稿状态,可以继续修改后重新提交。", "published→archived": "下架后题目将对用户不可见,但数据会保留。可随时恢复为草稿。", "archived→draft": "恢复为草稿后可以重新编辑并提交审核。", } return descriptions[`${from}→${to}`] ?? `确定要将题目状态从「${from}」改为「${to}」吗?` }
{description}
题目:{question.stem.length > 40 ? question.stem.slice(0, 40) + "..." : question.stem}