fix: restore style pro toolbar entry
This commit is contained in:
parent
e81a022b6f
commit
39c8489e8f
@ -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) {
|
||||
</Tooltip>
|
||||
) : null}
|
||||
|
||||
{isAgentWorkspaceEnabled &&
|
||||
isStyleModeToolbarEnabled &&
|
||||
!isVideoMode ? (
|
||||
{shouldShowStyleModeToolbarButton && !isVideoMode ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
@ -10194,19 +10219,26 @@ export default function CanvasEditorLegacyPage({ params }: PageProps) {
|
||||
isVideoMode
|
||||
? VIDEO_CANVAS_TOOLBAR_BUTTON_CLASS
|
||||
: "h-9 w-9 rounded-xl",
|
||||
isAgentMode &&
|
||||
isAgentWorkspaceEnabled &&
|
||||
isAgentMode &&
|
||||
(isVideoMode
|
||||
? VIDEO_CANVAS_TOOLBAR_ACTIVE_BUTTON_CLASS
|
||||
: "bg-primary text-primary-foreground hover:bg-primary/90")
|
||||
)}
|
||||
onClick={handleToggleAgentMode}
|
||||
onClick={handleStyleModeToolbarClick}
|
||||
size="icon"
|
||||
variant={isAgentMode ? "secondary" : "ghost"}
|
||||
variant={
|
||||
isAgentWorkspaceEnabled && isAgentMode
|
||||
? "secondary"
|
||||
: "ghost"
|
||||
}
|
||||
>
|
||||
<CanvasToolbarIcon
|
||||
active={isAgentMode}
|
||||
active={isAgentWorkspaceEnabled && isAgentMode}
|
||||
className="h-4 w-4"
|
||||
fallback={Wand2}
|
||||
fallback={
|
||||
shouldUseStyleModeButtonForStylePro ? Sparkles : Wand2
|
||||
}
|
||||
item={getCanvasToolbarItem(
|
||||
canvasToolbarConfig,
|
||||
"styleMode"
|
||||
@ -10220,7 +10252,7 @@ export default function CanvasEditorLegacyPage({ params }: PageProps) {
|
||||
</Tooltip>
|
||||
) : null}
|
||||
|
||||
{isStyleProToolbarEnabled && !isVideoMode ? (
|
||||
{shouldShowStandaloneStyleProToolbarButton && !isVideoMode ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user