[WooCommerce Analytics] Add Guest label when no customer name (#49594)

* Show Guest when there is no Customer name

* Show Guest when there is no Customer name
This commit is contained in:
Miguel Pérez Pellicer 2024-07-17 21:12:11 +04:00 committed by GitHub
parent acea491755
commit a5c9db8fac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import { __, _n } from '@wordpress/i18n';
import { Fragment, useContext } from '@wordpress/element'; import { Fragment, useContext } from '@wordpress/element';
import { useSelect } from '@wordpress/data'; import { useSelect } from '@wordpress/data';
import { Tooltip } from '@wordpress/components'; import { Tooltip } from '@wordpress/components';
import { Date, Link } from '@woocommerce/components'; import { Date, Link, Pill } from '@woocommerce/components';
import { formatValue } from '@woocommerce/number'; import { formatValue } from '@woocommerce/number';
import { getAdminLink } from '@woocommerce/settings'; import { getAdminLink } from '@woocommerce/settings';
import { defaultTableDateFormat } from '@woocommerce/date'; import { defaultTableDateFormat } from '@woocommerce/date';
@ -141,6 +141,12 @@ function CustomersReportTable( {
country, country,
} = customer; } = customer;
const countryName = getCountryName( country ); const countryName = getCountryName( country );
const customerName =
name?.trim() !== '' ? (
name
) : (
<Pill>{ __( 'Guest', 'woocommerce' ) }</Pill>
);
const customerNameLink = userId ? ( const customerNameLink = userId ? (
<Link <Link
@ -150,7 +156,7 @@ function CustomersReportTable( {
{ name } { name }
</Link> </Link>
) : ( ) : (
name customerName
); );
const dateLastActiveDisplay = dateLastActive ? ( const dateLastActiveDisplay = dateLastActive ? (

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
Show Guest when there is no Customer name