From 041b51adc111e5fb7368df3da897d24dcc14b9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 5 Sep 2026 12:46:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=92=E4=B8=80=E5=8C=96UI=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E5=AE=8C=E6=88=90=E6=80=81=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将旧 visual-binding 初始步骤归一到联合识别绑定步骤 简化工作流步骤索引计算 --- .../src/view/ui-editor/useUiEditorPage.ts | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts b/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts index eea2aca08..e31f9a3f3 100644 --- a/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts +++ b/apps/ai-game-creator-shell/src/view/ui-editor/useUiEditorPage.ts @@ -184,17 +184,17 @@ export function useUiEditorSession( const [isSaving, setIsSaving] = useState(false); const [generateError, setGenerateError] = useState(null); const [isGenerating, setIsGenerating] = useState(false); + const normalizedInitialStep = + initialStep === 'visual-binding' ? 'structure-recognition' : initialStep; const normalizedInitialStepIndex = - initialStep === 'reference-analysis' - ? 0 - : initialStep === 'structure-recognition' - ? 1 - : 1; + normalizedInitialStep === 'reference-analysis' ? 0 : 1; const normalizedInitialFurthestStepIndex = Math.max( normalizedInitialStepIndex, Math.min(1, Math.max(0, Math.trunc(initialFurthestStepIndex))), ); - const [activeStep, setActiveStep] = useState(initialStep); + const [activeStep, setActiveStep] = useState( + normalizedInitialStep, + ); const [furthestStepIndex, setFurthestStepIndex] = useState( normalizedInitialFurthestStepIndex, ); @@ -244,7 +244,7 @@ export function useUiEditorSession( const [hasBound, setHasBound] = useState(false); useEffect(() => { - setActiveStep(initialStep); + setActiveStep(normalizedInitialStep); setFurthestStepIndex(normalizedInitialFurthestStepIndex); setPendingWorkflowStepChange(null); if (!resourceId) { @@ -348,6 +348,7 @@ export function useUiEditorSession( }; }, [ initialStep, + normalizedInitialStep, normalizedInitialFurthestStepIndex, projectPath, replaceEditorState, @@ -649,12 +650,7 @@ export function useUiEditorSession( function enterStep(step: UiEditorStepId) { setActiveStep(step); - const index = - step === 'reference-analysis' - ? 0 - : step === 'structure-recognition' - ? 1 - : 1; + const index = step === 'reference-analysis' ? 0 : 1; setFurthestStepIndex((current) => Math.max(current, index)); }