抽出策划输入区与提交按钮共用的禁用判据

- apps/ai-game-creator-shell/src/view/project-development/planning/PlanningChatView.tsx 新增 composerDisabled,替换 ResourceReferenceInput 与提交按钮上逐字重复的四条件表达式
- 判据取值不变,后续改条件时不会只改到其中一处
This commit is contained in:
2026-09-19 23:08:02 +08:00
parent cb3d452a44
commit 00063ba882
@@ -200,6 +200,12 @@ export function PlanningChatView({
submitLabel = '思考中';
}
const submitting = controlBusy && !needsUserInput;
// 输入区与提交按钮共用同一个禁用判据,避免两处条件各改一半而漂移。
const composerDisabled =
controlBusy ||
needsUserInput ||
Boolean(designView?.session.pendingApproval) ||
Boolean(designView?.session.pendingClarification);
const renderMessage = (message: ChatMessage, index: number) => (
<div
@@ -390,12 +396,7 @@ export function PlanningChatView({
versions={versions}
assets={chatProjectAssets}
projectPath={projectPath}
disabled={
controlBusy ||
needsUserInput ||
Boolean(designView?.session.pendingApproval) ||
Boolean(designView?.session.pendingClarification)
}
disabled={composerDisabled}
rows={3}
value={chatInput}
references={chatReferences}
@@ -411,12 +412,7 @@ export function PlanningChatView({
className="project-chat-submit-button"
aria-label={submitLabel}
title={submitLabel}
disabled={
controlBusy ||
needsUserInput ||
Boolean(designView?.session.pendingApproval) ||
Boolean(designView?.session.pendingClarification)
}
disabled={composerDisabled}
>
{submitting ? (
<Loader2