From 750bb6a4639b5024d3cdb5d8784abbef088db210 Mon Sep 17 00:00:00 2001 From: Luiz Kowalski Date: Fri, 12 Apr 2024 11:42:54 -0300 Subject: [PATCH] AI Featured Image: update designs to follow i3 guidance (#36868) * Move carousel navigation to above the images * Update margin on top to match designs * Change usage counter to show cost and request balance * changelog * Update button gaps * Add image cost tooltip to the generate new image button * Update generate new image button copy to match designs --- ...ate-ai-featured-image-update-designs-to-i3 | 4 ++ .../components/featured-image/carrousel.scss | 2 +- .../components/featured-image/carrousel.tsx | 10 ++--- .../components/featured-image/index.tsx | 25 ++++++++----- .../components/featured-image/style.scss | 4 +- .../featured-image/usage-counter.scss | 12 ------ .../featured-image/usage-counter.tsx | 37 ++++--------------- 7 files changed, 36 insertions(+), 58 deletions(-) create mode 100644 projects/plugins/jetpack/changelog/update-ai-featured-image-update-designs-to-i3 diff --git a/projects/plugins/jetpack/changelog/update-ai-featured-image-update-designs-to-i3 b/projects/plugins/jetpack/changelog/update-ai-featured-image-update-designs-to-i3 new file mode 100644 index 0000000000000..c1af7f35772d1 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-ai-featured-image-update-designs-to-i3 @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +AI Featured Image: incorporate i3 updates on style and UI diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/carrousel.scss b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/carrousel.scss index 04e8c5fec595b..ca43ac3ab58d3 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/carrousel.scss +++ b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/carrousel.scss @@ -85,7 +85,7 @@ &-counter { display: flex; - justify-content: flex-start; + justify-content: flex-end; align-items: center; font-size: 13px; padding: 8px 0; diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/carrousel.tsx b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/carrousel.tsx index 145a3aaf67241..a53762a6917a9 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/carrousel.tsx +++ b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/carrousel.tsx @@ -80,6 +80,11 @@ export default function Carrousel( { return (
+
+ { prevButton } + { current + 1 } / { images.length } + { nextButton } +
{ images.length > 1 && prevButton } { images.map( ( { image, generating, error }, index ) => ( @@ -128,11 +133,6 @@ export default function Carrousel( { ) ) } { images.length > 1 && nextButton }
-
- { images.length > 1 && prevButton } - { current + 1 } / { images.length } - { images.length > 1 && nextButton } -
); } diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/index.tsx b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/index.tsx index ac18db8bc6f9c..dbef7f093525e 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/index.tsx +++ b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/featured-image/index.tsx @@ -3,7 +3,7 @@ */ import { useImageGenerator } from '@automattic/jetpack-ai-client'; import { useAnalytics } from '@automattic/jetpack-shared-extension-utils'; -import { Button } from '@wordpress/components'; +import { Button, Tooltip } from '@wordpress/components'; import { useDispatch, useSelect } from '@wordpress/data'; import { useCallback, useRef, useState } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; @@ -232,6 +232,11 @@ export default function FeaturedImage( { busy, disabled }: { busy: boolean; disa ] ); const modalTitle = __( 'Generate a featured image with AI', 'jetpack' ); + const costTooltipText = sprintf( + // Translators: %d is the cost of generating one image. + __( '%d requests per image', 'jetpack' ), + featuredImageCost + ); return (
@@ -288,14 +293,16 @@ export default function FeaturedImage( { busy, disabled }: { busy: boolean; disa { __( 'Try again', 'jetpack' ) } ) : ( - + + + ) }
); }