diff --git a/app/client/src/pages/Editor/CustomWidgetBuilder/Editor/index.tsx b/app/client/src/pages/Editor/CustomWidgetBuilder/Editor/index.tsx index a586f0fb131..9f1a6a3eae1 100644 --- a/app/client/src/pages/Editor/CustomWidgetBuilder/Editor/index.tsx +++ b/app/client/src/pages/Editor/CustomWidgetBuilder/Editor/index.tsx @@ -1,4 +1,4 @@ -import React, { useContext } from "react"; +import React, { useContext, useMemo } from "react"; import styles from "./styles.module.css"; import Layout from "./Layouts"; import Header from "./Header"; @@ -9,9 +9,41 @@ import JSEditor from "./CodeEditors/JSEditor"; import type { ContentProps } from "./CodeEditors/types"; import References from "./References"; import { ChatBot } from "./ChatBot/ChatBot"; +import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; +import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; export default function Editor() { const { isReferenceOpen } = useContext(CustomWidgetBuilderContext); + const isAIEnabled = useFeatureFlag( + FEATURE_FLAG.release_custom_widget_ai_builder, + ); + + const tabs = useMemo(() => { + const defaultTabs = [ + { + title: "HTML", + children: (props: ContentProps) => , + }, + { + title: "Style", + titleControls: , + children: (props: ContentProps) => , + }, + { + title: "Javascript", + children: (props: ContentProps) => , + }, + ]; + + if (isAIEnabled) { + defaultTabs.push({ + title: "AI", + children: (props: ContentProps) => , + }); + } + + return defaultTabs; + }, [isAIEnabled]); return (
@@ -19,27 +51,7 @@ export default function Editor() {
- , - }, - { - title: "Style", - titleControls: , - children: (props: ContentProps) => , - }, - { - title: "Javascript", - children: (props: ContentProps) => , - }, - { - title: "AI", - children: (props: ContentProps) => , - }, - ]} - /> + {isReferenceOpen && }