From 39c8489e8f3582e6b8c7a2099323b608fb627354 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 17 May 2026 00:14:16 +0800 Subject: [PATCH] fix: restore style pro toolbar entry --- .../[id]/CanvasEditorLegacyPageClient.tsx | 52 +++++++++++++++---- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/app/canvas/[id]/CanvasEditorLegacyPageClient.tsx b/app/canvas/[id]/CanvasEditorLegacyPageClient.tsx index 965214ee7..889e88a73 100644 --- a/app/canvas/[id]/CanvasEditorLegacyPageClient.tsx +++ b/app/canvas/[id]/CanvasEditorLegacyPageClient.tsx @@ -1976,9 +1976,19 @@ export default function CanvasEditorLegacyPage({ params }: PageProps) { canvasToolbarConfig, "styleMode" ); + const isStyleProFeatureEnabled = siteSettingsData?.styleProEnabled !== false; const isStyleProToolbarEnabled = isCanvasToolbarItemEnabled(canvasToolbarConfig, "stylePro") && - siteSettingsData?.styleProEnabled !== false; + isStyleProFeatureEnabled; + const shouldUseStyleModeButtonForStylePro = + !isAgentWorkspaceEnabled && + isStyleProFeatureEnabled && + isStyleModeToolbarEnabled; + const shouldShowStyleModeToolbarButton = + isStyleModeToolbarEnabled && + (isAgentWorkspaceEnabled || shouldUseStyleModeButtonForStylePro); + const shouldShowStandaloneStyleProToolbarButton = + isStyleProToolbarEnabled && !shouldUseStyleModeButtonForStylePro; const sanitizedWorkflowSelections = useMemo( () => sanitizeAgentWorkflowSelections({ @@ -2830,6 +2840,23 @@ export default function CanvasEditorLegacyPage({ params }: PageProps) { setPanelMode("chat"); }, [agentProjectId, isAgentMode, updateCanvasSearchParams]); + const handleStyleModeToolbarClick = useCallback(() => { + if (isAgentWorkspaceEnabled) { + handleToggleAgentMode(); + return; + } + + if (isStyleProFeatureEnabled) { + router.push(`/canvas/${id}/style-pro`); + } + }, [ + handleToggleAgentMode, + id, + isAgentWorkspaceEnabled, + isStyleProFeatureEnabled, + router, + ]); + const buildCurrentWorkflowPersistedState = useCallback((): AgentWorkflowPersistedState => { const persistedMaterials = appearanceRecognitionEnabled @@ -10184,9 +10211,7 @@ export default function CanvasEditorLegacyPage({ params }: PageProps) { ) : null} - {isAgentWorkspaceEnabled && - isStyleModeToolbarEnabled && - !isVideoMode ? ( + {shouldShowStyleModeToolbarButton && !isVideoMode ? (