Skip to content

Commit

Permalink
move SEO assistant CTA to Jetpack sidebar under SEO panel
Browse files Browse the repository at this point in the history
  • Loading branch information
CGastrell committed Jan 8, 2025
1 parent d1317a2 commit 9177794
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import useAICheckout from '../../../../blocks/ai-assistant/hooks/use-ai-checkout
import useAiFeature from '../../../../blocks/ai-assistant/hooks/use-ai-feature';
import useAiProductPage from '../../../../blocks/ai-assistant/hooks/use-ai-product-page';
import { getFeatureAvailability } from '../../../../blocks/ai-assistant/lib/utils/get-feature-availability';
import { isBetaExtension } from '../../../../editor';
// import { isBetaExtension } from '../../../../editor';
import JetpackPluginSidebar from '../../../../shared/jetpack-plugin-sidebar';
import { PLAN_TYPE_FREE, PLAN_TYPE_UNLIMITED, usePlanType } from '../../../../shared/use-plan-type';
import { FeaturedImage } from '../ai-image';
import { Breve, registerBreveHighlights, Highlight } from '../breve';
import { getBreveAvailability, canWriteBriefBeEnabled } from '../breve/utils/get-availability';
import Feedback from '../feedback';
import SeoAssistant from '../seo-assistant';
// import SeoAssistant from '../seo-assistant';
import TitleOptimization from '../title-optimization';
import UsagePanel from '../usage-panel';
import {
Expand Down Expand Up @@ -60,7 +60,7 @@ const isAITitleOptimizationKeywordsFeatureAvailable = getFeatureAvailability(
'ai-title-optimization-keywords-support'
);

const isSeoAssistantEnabled = getFeatureAvailability( 'ai-seo-assistant' );
// const isSeoAssistantEnabled = getFeatureAvailability( 'ai-seo-assistant' );

const JetpackAndSettingsContent = ( {
placement,
Expand All @@ -72,14 +72,14 @@ const JetpackAndSettingsContent = ( {
const { checkoutUrl } = useAICheckout();
const { productPageUrl } = useAiProductPage();
const isBreveAvailable = getBreveAvailability();
const isViewable = useSelect( select => {
const postTypeName = select( editorStore ).getCurrentPostType();
const postTypeObject = ( select( coreStore ) as unknown as CoreSelect ).getPostType(
postTypeName
);
// const isViewable = useSelect( select => {
// const postTypeName = select( editorStore ).getCurrentPostType();
// const postTypeObject = ( select( coreStore ) as unknown as CoreSelect ).getPostType(
// postTypeName
// );

return postTypeObject?.viewable;
}, [] );
// return postTypeObject?.viewable;
// }, [] );

const currentTitleOptimizationSectionLabel = __( 'Optimize Publishing', 'jetpack' );
const SEOTitleOptimizationSectionLabel = __( 'Optimize Title', 'jetpack' );
Expand All @@ -97,7 +97,7 @@ const JetpackAndSettingsContent = ( {
</PanelRow>
) }

{ isSeoAssistantEnabled && isViewable && (
{ /* { isSeoAssistantEnabled && isViewable && (
<PanelRow
className={ `jetpack-ai-sidebar__feature-section ${
isBetaExtension( 'ai-seo-assistant' ) ? 'is-beta-extension' : ''
Expand All @@ -108,7 +108,7 @@ const JetpackAndSettingsContent = ( {
<SeoAssistant disabled={ false } />
</BaseControl>
</PanelRow>
) }
) } */ }

{ canWriteBriefBeEnabled() && isBreveAvailable && (
<PanelRow>
Expand Down
15 changes: 15 additions & 0 deletions projects/plugins/jetpack/extensions/plugins/seo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
useModuleStatus,
isSimpleSite,
isAtomicSite,
getJetpackExtensionAvailability,
getRequiredPlan,
} from '@automattic/jetpack-shared-extension-utils';
import { PanelBody, PanelRow } from '@wordpress/components';
Expand All @@ -12,7 +13,9 @@ import { PluginPrePublishPanel } from '@wordpress/edit-post';
import { store as editorStore } from '@wordpress/editor';
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { isBetaExtension } from '../../editor';
import JetpackPluginSidebar from '../../shared/jetpack-plugin-sidebar';
import SeoAssistant from '../ai-assistant-plugin/components/seo-assistant';
import { SeoPlaceholder } from './components/placeholder';
import { SeoSkeletonLoader } from './components/skeleton-loader';
import UpsellNotice from './components/upsell';
Expand All @@ -24,6 +27,9 @@ import './editor.scss';

export const name = 'seo';

const isSeoAssistantEnabled =
getJetpackExtensionAvailability( 'ai-seo-assistant' )?.available === true;

const Seo = () => {
const { isLoadingModules, isChangingStatus, isModuleActive, changeStatus } =
useModuleStatus( 'seo-tools' );
Expand Down Expand Up @@ -95,6 +101,15 @@ const Seo = () => {
<Fragment>
<JetpackPluginSidebar>
<PanelBody className="jetpack-seo-panel" { ...jetpackSeoPanelProps }>
{ isSeoAssistantEnabled && isViewable && (
<PanelRow
className={ `jetpack-ai-sidebar__feature-section ${
isBetaExtension( 'ai-seo-assistant' ) ? 'is-beta-extension' : ''
}` }
>
<SeoAssistant disabled={ false } />
</PanelRow>
) }
<PanelRow>
<SeoTitlePanel />
</PanelRow>
Expand Down

0 comments on commit 9177794

Please sign in to comment.