From 12c1a6d206e5f55d19adfd6da709e1bba5b4b282 Mon Sep 17 00:00:00 2001 From: Paul Sealock Date: Mon, 18 Mar 2024 22:43:02 +1300 Subject: [PATCH] Launch Your Store: Add status dropdown functionality (#45606) * Add basic wp dropdown component * use getAdminLink * Add styling based on state * Add changefile(s) from automation for the following project(s): woocommerce * update store page only text * Add better 'for now' comment * translate links * remove private repo link from comment * lint --------- Co-authored-by: github-actions --- .../woocommerce-admin/client/header/index.js | 7 +- .../client/launch-your-store/status/index.js | 65 +++++++++++++++++-- .../launch-your-store/status/style.scss | 20 ++++++ .../changelog/45606-add-lys-status-dropdown | 4 ++ 4 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 plugins/woocommerce/changelog/45606-add-lys-status-dropdown diff --git a/plugins/woocommerce-admin/client/header/index.js b/plugins/woocommerce-admin/client/header/index.js index a0919f5261f..412d394fded 100644 --- a/plugins/woocommerce-admin/client/header/index.js +++ b/plugins/woocommerce-admin/client/header/index.js @@ -100,7 +100,7 @@ export const Header = ( { sections, isEmbedded = false, query } ) => { } }, [ isEmbedded, sections, siteTitle ] ); - const { isLoading, launchStatus, launchYourStoreEnabled } = + const { isLoading, launchYourStoreEnabled, comingSoon, storePagesOnly } = useLaunchYourStore(); const showLaunchYourStoreStatus = launchYourStoreEnabled && ! isLoading; @@ -137,7 +137,10 @@ export const Header = ( { sections, isEmbedded = false, query } ) => { { showLaunchYourStoreStatus && ( - + ) } diff --git a/plugins/woocommerce-admin/client/launch-your-store/status/index.js b/plugins/woocommerce-admin/client/launch-your-store/status/index.js index e6212387ba0..0ff9904ef63 100644 --- a/plugins/woocommerce-admin/client/launch-your-store/status/index.js +++ b/plugins/woocommerce-admin/client/launch-your-store/status/index.js @@ -1,21 +1,76 @@ /** * External dependencies */ +import { __ } from '@wordpress/i18n'; import { Icon, moreVertical } from '@wordpress/icons'; +import { Dropdown, Button, MenuGroup, MenuItem } from '@wordpress/components'; +import { getAdminLink } from '@woocommerce/settings'; +import classnames from 'classnames'; /** * Internal dependencies */ import './style.scss'; -export const LaunchYourStoreStatus = () => { +export const LaunchYourStoreStatus = ( { comingSoon, storePagesOnly } ) => { + const isComingSoon = comingSoon && comingSoon === 'yes'; + const isStorePagesOnly = + isComingSoon && storePagesOnly && storePagesOnly === 'yes'; + const comingSoonText = isStorePagesOnly + ? __( 'Coming soon - Store pages only', 'woocommerce' ) + : __( 'Coming soon', 'woocommerce' ); + const liveText = __( 'Live', 'woocommerce' ); + const dropdownText = isComingSoon ? comingSoonText : liveText; return (
-
- Coming soon - -
+ ( + + ) } + renderContent={ () => ( + <> + + + { __( + 'Manage site visibility', + 'woocommerce' + ) } + + { isComingSoon && ( + + { __( + 'Customize "Coming soon" page', + 'woocommerce' + ) } + + ) } + + + ) } + />
); diff --git a/plugins/woocommerce-admin/client/launch-your-store/status/style.scss b/plugins/woocommerce-admin/client/launch-your-store/status/style.scss index d0609b37956..e3c47324e9e 100644 --- a/plugins/woocommerce-admin/client/launch-your-store/status/style.scss +++ b/plugins/woocommerce-admin/client/launch-your-store/status/style.scss @@ -18,4 +18,24 @@ line-height: 20px; border-radius: 4px; height: 24px; + + &.is-live { + background-color: #e6f2e8; + color: #005c12; + + &::before { + content: ''; + width: 6px; + height: 6px; + border-radius: 3px; + background-color: #005c12; + margin-right: 4px; + } + } +} + +.woocommerce-lys-status-dropdown .components-button { + padding: 0; + height: auto; + border-radius: 4px; } diff --git a/plugins/woocommerce/changelog/45606-add-lys-status-dropdown b/plugins/woocommerce/changelog/45606-add-lys-status-dropdown new file mode 100644 index 00000000000..85761e5b956 --- /dev/null +++ b/plugins/woocommerce/changelog/45606-add-lys-status-dropdown @@ -0,0 +1,4 @@ +Significance: patch +Type: update +Comment: Updates unreleased component from launch your store +