Files
Genarrative/src/components/common/PlatformDangerConfirmDialog.tsx
T
k88936 e6b3199490
Project CI / Repository checks (push) Successful in 48s
Project CI / Frontend tests (push) Successful in 3m21s
Project CI / Backend tests (push) Successful in 3m53s
Project CI / Native shell tests (push) Successful in 11m16s
Fix/统一修复modal样式失效 (#122)
之前遇到几次弹窗的样式不生效,bug 现在在画布agent的删除对话弹窗又出现了,
这个pr把类似的修改集中到最下层的UnifiedModal,适用于所有的modal,
一些特殊的modal有特殊处理.

画布agent的删除对话弹窗
![shotmd-1785399342.jpg](/attachments/d63d7dc6-bf7e-4f13-bfe8-bc4716cd798f)

---------

Co-authored-by: 段舒康 <kdletters@qq.com>
Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/122
Reviewed-by: 段舒康 <kdletters@qq.com>
Co-authored-by: 王德宇 <kvtodev@outlook.com>
Co-committed-by: 王德宇 <kvtodev@outlook.com>
2026-08-03 17:55:47 +08:00

86 lines
2.1 KiB
TypeScript

import type { ReactNode } from 'react';
import { UnifiedConfirmDialog } from './UnifiedConfirmDialog';
type PlatformDangerConfirmDialogProps = {
open: boolean;
title: string;
onClose: () => void;
onConfirm?: () => void;
description?: ReactNode;
children?: ReactNode;
confirmLabel?: string;
busy?: boolean;
busyConfirmLabel?: string;
cancelLabel?: string;
closeOnBackdrop?: boolean;
showCloseButton?: boolean;
portal?: boolean;
size?: 'sm' | 'md';
overlayClassName?: string;
panelClassName?: string;
footerClassName?: string;
confirmClassName?: string;
zIndexClassName?: string;
};
function joinClassNames(...classNames: Array<string | undefined>) {
return classNames.filter(Boolean).join(' ');
}
/**
* 平台危险确认弹窗。
* 统一承接需要“确认 / 取消 + 危险主动作”语义的标准弹窗壳层。
*/
export function PlatformDangerConfirmDialog({
open,
title,
onClose,
onConfirm,
description,
children,
confirmLabel = '确认',
busy = false,
busyConfirmLabel,
cancelLabel = '取消',
closeOnBackdrop = true,
showCloseButton = true,
portal = true,
size = 'sm',
overlayClassName,
panelClassName,
footerClassName,
confirmClassName,
zIndexClassName = 'z-[140]',
}: PlatformDangerConfirmDialogProps) {
return (
<UnifiedConfirmDialog
open={open}
title={title}
description={description}
onClose={onClose}
onConfirm={onConfirm}
confirmLabel={confirmLabel}
busy={busy}
busyConfirmLabel={busyConfirmLabel}
cancelLabel={cancelLabel}
closeOnBackdrop={closeOnBackdrop}
showCloseButton={showCloseButton}
showCancel
confirmTone="danger"
portal={portal}
size={size}
overlayClassName={overlayClassName}
panelClassName={joinClassNames(
'platform-remap-surface shadow-[0_24px_80px_rgba(0,0,0,0.55)]',
panelClassName,
)}
footerClassName={footerClassName}
confirmClassName={confirmClassName}
zIndexClassName={zIndexClassName}
>
{children}
</UnifiedConfirmDialog>
);
}