Skip to content

Commit

Permalink
Blocks: only use strings in block descriptions
Browse files Browse the repository at this point in the history
Closes #29402

Discussion: #26792

Until we have a better way to have custom descriptions for blocks, let's keep only strings to avoid notices.
  • Loading branch information
jeherve committed Mar 28, 2023
1 parent 60a158b commit 201d3d0
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 216 deletions.
@@ -0,0 +1,4 @@
Significance: patch
Type: compat

Blocks: avoid using complex block descriptions to avoid notices with WordPress 6.2.
24 changes: 3 additions & 21 deletions projects/plugins/jetpack/extensions/blocks/ai-image/index.js
@@ -1,6 +1,3 @@
import { getRedirectUrl } from '@automattic/jetpack-components';
import { ExternalLink } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { __, _x } from '@wordpress/i18n';
import { getIconColor } from '../../shared/block-icons';
import attributes from './attributes';
Expand All @@ -16,24 +13,9 @@ export const title = __( 'AI Image (Experimental)', 'jetpack' );
export const settings = {
apiVersion: 2,
title,
description: (
<Fragment>
<p>
{ __(
'Automatically generate an illustration for your post, powered by AI magic.',
'jetpack'
) }
</p>
<p>
{ __(
'We are experimenting with this feature and can tweak or remove it at any point.',
'jetpack'
) }
</p>
<ExternalLink href={ getRedirectUrl( 'jetpack_ai_feedback' ) }>
{ __( 'Share your feedback.', 'jetpack' ) }
</ExternalLink>
</Fragment>
description: __(
'Automatically generate an illustration for your post, powered by AI magic. We are experimenting with this feature and can tweak or remove it at any point.',
'jetpack'
),
icon: {
src: 'superhero',
Expand Down
25 changes: 4 additions & 21 deletions projects/plugins/jetpack/extensions/blocks/ai-paragraph/index.js
@@ -1,8 +1,6 @@
import { getRedirectUrl } from '@automattic/jetpack-components';
import { useBlockProps } from '@wordpress/block-editor';
import { createBlock } from '@wordpress/blocks';
import { ExternalLink } from '@wordpress/components';
import { Fragment, RawHTML } from '@wordpress/element';
import { RawHTML } from '@wordpress/element';
import { __, _x } from '@wordpress/i18n';
import { getIconColor } from '../../shared/block-icons';
import attributes from './attributes';
Expand All @@ -18,24 +16,9 @@ export const title = __( 'AI Paragraph (Experimental)', 'jetpack' );
export const settings = {
apiVersion: 2,
title,
description: (
<Fragment>
<p>
{ __(
'Automatically generate new paragraphs using your existing content, powered by AI magic.',
'jetpack'
) }
</p>
<p>
{ __(
'We are experimenting with this feature and can tweak or remove it at any point.',
'jetpack'
) }
</p>
<ExternalLink href={ getRedirectUrl( 'jetpack_ai_feedback' ) }>
{ __( 'Share your feedback.', 'jetpack' ) }
</ExternalLink>
</Fragment>
description: __(
'Automatically generate new paragraphs using your existing content, powered by AI magic. We are experimenting with this feature and can tweak or remove it at any point.',
'jetpack'
),
icon: {
src: 'superhero',
Expand Down
25 changes: 4 additions & 21 deletions projects/plugins/jetpack/extensions/blocks/markdown/index.js
@@ -1,6 +1,4 @@
import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils';
import { ExternalLink, Path, Rect, SVG } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { Path, Rect, SVG } from '@wordpress/components';
import { __, _x } from '@wordpress/i18n';
import { getIconColor } from '../../shared/block-icons';
import getCategoryWithFallbacks from '../../shared/get-category-with-fallbacks';
Expand Down Expand Up @@ -33,31 +31,16 @@ const icon = (
</SVG>
);

const supportLink =
isSimpleSite() || isAtomicSite()
? 'https://en.support.wordpress.com/markdown-quick-reference/'
: 'https://jetpack.com/support/jetpack-blocks/markdown-block/';

export const settings = {
title: __( 'Markdown', 'jetpack' ),

description: (
<Fragment>
<p>
{ __(
'Use regular characters and punctuation to style text, links, and lists.',
'jetpack'
) }
</p>
<ExternalLink href={ supportLink }>{ __( 'Support reference', 'jetpack' ) }</ExternalLink>
</Fragment>
description: __(
'Use regular characters and punctuation to style text, links, and lists.',
'jetpack'
),

icon: {
src: icon,
foreground: getIconColor(),
},

category: getCategoryWithFallbacks( 'text', 'formatting' ),
keywords: [
_x( 'formatting', 'block search term', 'jetpack' ),
Expand Down
@@ -1,6 +1,4 @@
import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils';
import { Path, Rect, SVG, G, ExternalLink } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { Path, Rect, SVG, G } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { getIconColor } from '../../shared/block-icons';
import { settings as paymentButtonSettings } from '../recurring-payments';
Expand All @@ -19,28 +17,16 @@ export const icon = (
</SVG>
);

const supportLink =
isSimpleSite() || isAtomicSite()
? 'https://wordpress.com/support/video-tutorials-add-payments-features-to-your-site-with-our-guides/#how-to-use-the-payments-block-video'
: 'https://jetpack.com/support/jetpack-blocks/payments-block/';

export const settings = {
apiVersion: 2,
title,
icon: {
src: icon,
foreground: getIconColor(),
},
description: (
<Fragment>
<p>
{ __(
'Prompt visitors to purchase your products and subscriptions with a group of buttons.',
'jetpack'
) }
</p>
<ExternalLink href={ supportLink }>{ __( 'Support reference', 'jetpack' ) }</ExternalLink>
</Fragment>
description: __(
'Prompt visitors to purchase your products and subscriptions with a group of buttons.',
'jetpack'
),
category: 'earn',
keywords: [ ...new Set( [ paymentButtonSettings.title, ...paymentButtonSettings.keywords ] ) ],
Expand Down
@@ -1,4 +1,3 @@
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { getIconColor } from '../../../shared/block-icons';
import icon from '../icon';
Expand All @@ -12,11 +11,7 @@ export const name = 'recipe-details';

export const settings = {
title: __( 'Recipe Details', 'jetpack' ),
description: (
<Fragment>
<p>{ __( 'Recipe Details', 'jetpack' ) }</p>
</Fragment>
),
description: __( 'Recipe Details', 'jetpack' ),
keywords: [],
supports: {
align: [ 'left', 'right', 'center' ],
Expand Down
@@ -1,4 +1,3 @@
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { getIconColor } from '../../../shared/block-icons';
import icon from '../icon';
Expand All @@ -9,11 +8,7 @@ export const name = 'recipe-hero';
export const title = __( 'Recipe Hero', 'jetpack' );
export const settings = {
title,
description: (
<Fragment>
<p>{ __( 'Image area for the recipe.', 'jetpack' ) }</p>
</Fragment>
),
description: __( 'Image area for the recipe.', 'jetpack' ),
keywords: [],
icon: {
src: icon,
Expand Down
15 changes: 3 additions & 12 deletions projects/plugins/jetpack/extensions/blocks/recipe/index.js
@@ -1,5 +1,3 @@
import { ExternalLink } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { getIconColor } from '../../shared/block-icons';
import { name as detailsName, settings as detailsSettings } from './details/';
Expand All @@ -19,16 +17,9 @@ export const name = 'recipe';
export const title = __( 'Recipe', 'jetpack' );
export const settings = {
title,
description: (
<Fragment>
<p>
{ __(
'Add images, ingredients and cooking steps to display an easy to read recipe.',
'jetpack'
) }
</p>
<ExternalLink href="#">{ __( 'Learn more about Recipe', 'jetpack' ) }</ExternalLink>
</Fragment>
description: __(
'Add images, ingredients and cooking steps to display an easy to read recipe.',
'jetpack'
),
icon: {
src: icon,
Expand Down
@@ -1,4 +1,3 @@
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { getIconColor } from '../../../shared/block-icons';
import icon from '../icon';
Expand All @@ -10,11 +9,7 @@ export const name = 'recipe-ingredient-item';
export const title = __( 'Recipe Ingredient Item', 'jetpack' );
export const settings = {
title,
description: (
<Fragment>
<p>{ __( 'A single ingredient associated with a recipe.', 'jetpack' ) }</p>
</Fragment>
),
description: __( 'A single ingredient associated with a recipe.', 'jetpack' ),
keywords: [],
icon: {
src: icon,
Expand Down
@@ -1,4 +1,3 @@
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { getIconColor } from '../../../shared/block-icons';
import icon from '../icon';
Expand All @@ -12,11 +11,7 @@ export const name = 'recipe-ingredients-list';
export const title = __( 'Recipe Ingredients List', 'jetpack' );
export const settings = {
title,
description: (
<Fragment>
<p>{ __( 'Recipe ingredient list', 'jetpack' ) }</p>
</Fragment>
),
description: __( 'Recipe ingredient list', 'jetpack' ),
icon: {
src: icon,
foreground: getIconColor(),
Expand Down
@@ -1,4 +1,3 @@
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { getIconColor } from '../../../shared/block-icons';
import icon from '../icon';
Expand All @@ -9,11 +8,7 @@ export const name = 'recipe-step';
export const title = __( 'Recipe Step', 'jetpack' );
export const settings = {
title,
description: (
<Fragment>
<p>{ __( 'A single recipe step.', 'jetpack' ) }</p>
</Fragment>
),
description: __( 'A single recipe step.', 'jetpack' ),
keywords: [],
icon: {
src: icon,
Expand Down
@@ -1,4 +1,3 @@
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { getIconColor } from '../../../shared/block-icons';
import icon from '../icon';
Expand All @@ -12,11 +11,7 @@ export const name = 'recipe-steps';
export const title = __( 'Recipe Steps', 'jetpack' );
export const settings = {
title,
description: (
<Fragment>
<p>{ __( 'Step by step instructions for the recipe.', 'jetpack' ) }</p>
</Fragment>
),
description: __( 'Step by step instructions for the recipe.', 'jetpack' ),
keywords: [],
icon: {
src: icon,
Expand Down
@@ -1,7 +1,5 @@
import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils';
import { createBlock } from '@wordpress/blocks';
import { Path, Rect, SVG, G, ExternalLink } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { Path, Rect, SVG, G } from '@wordpress/components';
import { __, _x } from '@wordpress/i18n';
import { getIconColor } from '../../shared/block-icons';
import { isPriceValid } from '../../shared/currencies';
Expand All @@ -22,24 +20,14 @@ export const icon = (
</SVG>
);

const supportLink =
isSimpleSite() || isAtomicSite()
? 'https://wordpress.com/support/video-tutorials-add-payments-features-to-your-site-with-our-guides/#how-to-use-the-payments-block-video'
: 'https://jetpack.com/support/jetpack-blocks/payments-block/';

export const settings = {
apiVersion: 2,
title,
icon: {
src: icon,
foreground: getIconColor(),
},
description: (
<Fragment>
<p>{ __( 'Button allowing you to sell products and subscriptions.', 'jetpack' ) }</p>
<ExternalLink href={ supportLink }>{ __( 'Support reference', 'jetpack' ) }</ExternalLink>
</Fragment>
),
description: __( 'Button allowing you to sell products and subscriptions.', 'jetpack' ),
category: 'earn',
keywords: [
_x( 'buy', 'block search term', 'jetpack' ),
Expand Down
@@ -1,6 +1,4 @@
import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils';
import { ExternalLink, Path, SVG } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { Path, SVG } from '@wordpress/components';
import { __, _x } from '@wordpress/i18n';
import { getIconColor } from '../../../../shared/block-icons';
import { DEFAULT_CURRENCY } from '../../constants';
Expand All @@ -14,29 +12,12 @@ export const icon = (
</SVG>
);

const supportLink =
isSimpleSite() || isAtomicSite()
? 'https://wordpress.com/support/pay-with-paypal/'
: 'https://jetpack.com/support/jetpack-blocks/pay-with-paypal/';

const settings = {
title: __( 'Pay with PayPal', 'jetpack' ),

description: (
<Fragment>
<p>
{ __(
'Lets you add credit and debit card payment buttons with minimal setup.',
'jetpack'
) }
</p>
<p>
{ __( 'Good for collecting donations or payments for products and services.', 'jetpack' ) }
</p>
<ExternalLink href={ supportLink }>{ __( 'Support reference', 'jetpack' ) }</ExternalLink>
</Fragment>
description: __(
'Lets you add credit and debit card payment buttons with minimal setup. Good for collecting donations or payments for products and services.',
'jetpack'
),

icon: {
src: icon,
foreground: getIconColor(),
Expand Down

0 comments on commit 201d3d0

Please sign in to comment.