失败弹窗把按钮文案与点击处理绑在一起
- FailureDialog 的 agentAction 改为 { label, onClick },不再按中文文案反查 onAdapt / onRepair
This commit is contained in:
+5
-7
@@ -38,13 +38,14 @@ export function FailureDialog({
|
||||
onDismiss: () => void;
|
||||
}) {
|
||||
const repairability = failure ? classifyXhsMinitoolFailure(failure) : null;
|
||||
// 文案与点击处理一起定:只存一句中文再按它反查 handler 的话,改文案就会静默接错动作。
|
||||
const agentAction =
|
||||
!failure ||
|
||||
repairability === XhsMinitoolFailureRepairability.OnlyHumanRepairable
|
||||
? null
|
||||
: failure.type === 'buildScriptMissing'
|
||||
? '让陶泥儿帮我调通'
|
||||
: '让陶泥儿来修';
|
||||
? { label: '让陶泥儿帮我调通', onClick: onAdapt }
|
||||
: { label: '让陶泥儿来修', onClick: onRepair };
|
||||
|
||||
return (
|
||||
<ThemedModal
|
||||
@@ -61,11 +62,8 @@ export function FailureDialog({
|
||||
<div className="mt-4 flex flex-wrap justify-end gap-2">
|
||||
<PaneButton onClick={onDismiss}>关闭</PaneButton>
|
||||
{agentAction === null ? null : (
|
||||
<PaneButton
|
||||
variant="primary"
|
||||
onClick={agentAction === '让陶泥儿帮我调通' ? onAdapt : onRepair}
|
||||
>
|
||||
{agentAction}
|
||||
<PaneButton variant="primary" onClick={agentAction.onClick}>
|
||||
{agentAction.label}
|
||||
</PaneButton>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user