e6b3199490
之前遇到几次弹窗的样式不生效,bug 现在在画布agent的删除对话弹窗又出现了, 这个pr把类似的修改集中到最下层的UnifiedModal,适用于所有的modal, 一些特殊的modal有特殊处理. 画布agent的删除对话弹窗  --------- 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>
86 lines
2.1 KiB
TypeScript
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>
|
|
);
|
|
}
|