Files
Genarrative/src/components/platform-entry/PlatformErrorDialog.tsx
T
kdletters 7411b9a435 收口平台报告弹窗
新增 PlatformReportDialog 公共可复制报告弹窗组件
将 PlatformErrorDialog 与 PlatformTaskCompletionDialog 改为薄包装
同步更新 PlatformUiKit 收口文档与团队决策记录
2026-06-10 15:50:11 +08:00

54 lines
1.4 KiB
TypeScript

import { PlatformReportDialog } from '../common/PlatformReportDialog';
export type PlatformErrorDialogPayload = {
source: string;
message: string;
};
type PlatformErrorDialogProps = {
error: PlatformErrorDialogPayload | null;
onClose: () => void;
overlayClassName?: string;
panelClassName?: string;
};
function isBlacklistedPlatformError(error: PlatformErrorDialogPayload | null) {
// 中文注释:入口关闭是平台开关状态,不作为全局错误弹窗打扰用户。
return Boolean(error?.message.includes('creation_entry_disabled'));
}
export function PlatformErrorDialog({
error,
onClose,
overlayClassName = 'platform-theme platform-theme--light !items-center',
panelClassName = 'platform-remap-surface rounded-[1.5rem]',
}: PlatformErrorDialogProps) {
const dialogError = isBlacklistedPlatformError(error) ? null : error;
return (
<PlatformReportDialog
open={Boolean(dialogError)}
title="发生错误"
onClose={onClose}
copyIdleLabel="复制报错"
fields={
dialogError
? [
{
label: '来源',
value: dialogError.source,
},
{
label: '错误',
value: dialogError.message,
multiline: true,
},
]
: []
}
overlayClassName={overlayClassName}
panelClassName={panelClassName}
/>
);
}