Files
jiang13-forum/frontend/src/components/UnsavedChangesDialog.tsx
freefire 55c256654b 支持板块图标与主题色自定义,并优化列表加载与未保存离开提示。
新增后端图标校验与色槽规范化,前端展示 BoardBadge/骨架屏,发帖与板块管理页增加未保存确认。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 17:13:32 +08:00

46 lines
1.3 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.
import { Button } from '@/components/ui/button';
import {
AlertDialog,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/ui/alert-dialog';
interface Props {
open: boolean;
onStay: () => void;
onLeave: () => void;
/** 编辑已有帖子时为 true */
isEdit?: boolean;
}
export default function UnsavedChangesDialog({ open, onStay, onLeave, isEdit = false }: Props) {
return (
<AlertDialog open={open}>
<AlertDialogContent onEscapeKeyDown={onStay}>
<AlertDialogHeader>
<AlertDialogTitle></AlertDialogTitle>
<AlertDialogDescription>
{isEdit
? '你对这篇文章的修改尚未保存,离开后将无法恢复。'
: '你正在撰写的内容尚未发布,离开后将无法恢复。'}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel onClick={onStay}></AlertDialogCancel>
<Button
type="button"
variant="destructive"
onClick={onLeave}
>
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}