Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 31 additions & 35 deletions routes/connectors-home/ai-plugin-callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
useState,
} from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { addQueryArgs } from '@wordpress/url';

/**
* Internal dependencies
Expand Down Expand Up @@ -200,16 +201,16 @@ export function AiPluginCallout() {
const getMessage = () => {
if ( isJustConnected ) {
return __(
'The <strong>AI plugin</strong> is ready to use. You can use it to generate featured images, alt text, titles, excerpts and more.'
'The <strong>AI plugin</strong> is ready to use. You can use it to generate featured images, alt text, titles, excerpts and more. <a>Learn more</a>'
);
}
if ( isActiveNoProvider ) {
return __(
'The <strong>AI plugin</strong> is installed. Connect a provider below to generate featured images, alt text, titles, excerpts, and more.'
'The <strong>AI plugin</strong> is installed. Connect a provider below to generate featured images, alt text, titles, excerpts, and more. <a>Learn more</a>'
);
}
return __(
'The <strong>AI plugin</strong> can use your connectors to generate featured images, alt text, titles, excerpts and more.'
'The <strong>AI plugin</strong> can use your connectors to generate featured images, alt text, titles, excerpts and more. <a>Learn more</a>'
);
};

Expand All @@ -218,7 +219,7 @@ export function AiPluginCallout() {
return {
label: isBusy
? __( 'Installing…' )
: __( 'Install AI Experiments' ),
: __( 'Install the AI plugin' ),
disabled: isBusy,
onClick: isBusy ? undefined : installPlugin,
};
Expand All @@ -227,7 +228,7 @@ export function AiPluginCallout() {
return {
label: isBusy
? __( 'Activating…' )
: __( 'Activate AI Experiments' ),
: __( 'Activate the AI plugin' ),
disabled: isBusy,
onClick: isBusy ? undefined : activatePlugin,
};
Expand All @@ -239,38 +240,33 @@ export function AiPluginCallout() {
<p>
{ createInterpolateElement( getMessage(), {
strong: <strong />,
// @ts-ignore children are injected by createInterpolateElement at runtime.
a: <ExternalLink href={ AI_PLUGIN_URL } />,
} ) }
</p>
<div className="ai-plugin-callout__actions">
{ showInstallActivate ? (
<Button
ref={ actionButtonRef }
variant="primary"
size="compact"
isBusy={ isBusy }
disabled={ getPrimaryButtonProps().disabled }
accessibleWhenDisabled
onClick={ getPrimaryButtonProps().onClick }
>
{ getPrimaryButtonProps().label }
</Button>
) : (
justActivated && (
<Button
ref={ actionButtonRef }
variant="secondary"
size="compact"
disabled
accessibleWhenDisabled
>
{ __( 'AI Experiments enabled' ) }
</Button>
)
) }
<ExternalLink href={ AI_PLUGIN_URL }>
{ __( 'Learn more' ) }
</ExternalLink>
</div>
{ showInstallActivate ? (
<Button
variant="primary"
size="compact"
isBusy={ isBusy }
disabled={ getPrimaryButtonProps().disabled }
accessibleWhenDisabled
onClick={ getPrimaryButtonProps().onClick }
>
{ getPrimaryButtonProps().label }
</Button>
) : (
<Button
ref={ actionButtonRef }
variant="secondary"
size="compact"
href={ addQueryArgs( 'options-general.php', {
page: AI_PLUGIN_SLUG,
} ) }
>
{ __( 'Enable features in the AI plugin' ) }
Comment thread
t-hamano marked this conversation as resolved.
Resolved
</Button>
) }
</div>
<WpLogoDecoration />
</div>
Expand Down
3 changes: 2 additions & 1 deletion routes/connectors-home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@wordpress/element": "file:../../packages/element",
"@wordpress/i18n": "file:../../packages/i18n",
"@wordpress/icons": "file:../../packages/icons",
"@wordpress/ui": "file:../../packages/ui"
"@wordpress/ui": "file:../../packages/ui",
"@wordpress/url": "file:../../packages/url"
}
}
7 changes: 1 addition & 6 deletions routes/connectors-home/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ $sticky-header-clearance: 120px;
flex-direction: column;
gap: 12px;
padding-top: 2px;
align-items: flex-start;

p {
margin: 0;
Expand All @@ -68,12 +69,6 @@ $sticky-header-clearance: 120px;
}
}

&__actions {
display: flex;
gap: 12px;
align-items: center;
}

&__decoration {
position: absolute;
inset-inline-end: 8px;
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/specs/admin/connectors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,13 @@ test.describe( 'Connectors', () => {
await expect( banner ).toBeVisible();

// Verify the banner message mentions the AI plugin.
await expect( banner.getByText( 'AI plugin' ) ).toBeVisible();
await expect(
banner.locator( 'p' ).getByText( 'AI plugin' )
).toBeVisible();

// Verify the Install button is present.
await expect(
banner.getByRole( 'button', { name: 'Install AI Experiments' } )
banner.getByRole( 'button', { name: 'Install the AI plugin' } )
).toBeVisible();

// Verify the Learn more link is present.
Expand Down
Loading