Skip to content

Commit bcd98c6

Browse files
committed
hide button when ai feature is disabled
1 parent 47890d1 commit bcd98c6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/js/src/components/fills/MetaboxFill.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ const BlackFridayPromotionWithMetaboxWarningsCheck = withMetaboxWarningsCheck( B
3838
* @returns {wp.Element} The Metabox component.
3939
*/
4040
export default function MetaboxFill( { settings } ) {
41-
const { isTerm, isPost } = useSelect( ( select ) => ( {
41+
const { isTerm, isPost, isAiFeatureActive } = useSelect( ( select ) => ( {
4242
isTerm: select( "yoast-seo/editor" ).getIsTerm(),
4343
isPost: select( "yoast-seo/editor" ).getPostType() === "post",
44+
isAiFeatureActive: select( "yoast-seo/editor" ).getPreference( "isAiFeatureActive" ),
4445
} ), [] );
4546

4647
const isBlockEditorActive = isBlockEditor();
@@ -64,7 +65,7 @@ export default function MetaboxFill( { settings } ) {
6465
>
6566
<EditorIntro isBlockEditor={ isBlockEditorActive } isPost={ isPost } />
6667
</SidebarItem>
67-
{ isPost && isBlockEditorActive && <SidebarItem key="next-post" renderPriority={ 2 }>
68+
{ isPost && isBlockEditorActive && isAiFeatureActive && <SidebarItem key="next-post" renderPriority={ 2 }>
6869
<NextPostEditorItem location="metabox" />
6970
</SidebarItem> }
7071
<SidebarItem

packages/js/src/components/fills/SidebarFill.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ import { EditorIntro } from "../EditorIntro";
4141
export default function SidebarFill( { settings } ) {
4242
const webinarIntroUrl = get( window, "wpseoScriptData.webinarIntroBlockEditorUrl", "https://yoa.st/webinar-intro-block-editor" );
4343
const FirstEligibleNotification = useFirstEligibleNotification( { webinarIntroUrl } );
44-
const isPost = useSelect( ( select ) => select( "yoast-seo/editor" ).getPostType() === "post", [] );
44+
const { isAiFeatureActive, isPost } = useSelect( ( select ) => ( {
45+
isAiFeatureActive: select( "yoast-seo/editor" ).getPreference( "isAiFeatureActive" ),
46+
isPost: select( "yoast-seo/editor" ).getPostType() === "post",
47+
} ), [] );
4548

4649
const isBlockEditorActive = isBlockEditor();
4750
if ( isBlockEditorActive ) {
@@ -63,7 +66,7 @@ export default function SidebarFill( { settings } ) {
6366
>
6467
<EditorIntro isBlockEditor={ isBlockEditorActive } isPost={ isPost } />
6568
</SidebarItem>
66-
{ isPost && isBlockEditorActive && <SidebarItem key="next-post" renderPriority={ 2 }>
69+
{ isPost && isBlockEditorActive && isAiFeatureActive && <SidebarItem key="next-post" renderPriority={ 2 }>
6770
<NextPostEditorItem location="sidebar" />
6871
</SidebarItem> }
6972
{ settings.isKeywordAnalysisActive && <SidebarItem key="keyword-input" renderPriority={ 8 }>

0 commit comments

Comments
 (0)