Remove unused variables h/t @KokkieH
This commit is contained in:
parent
c3710a9387
commit
a10eb02a40
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import { __, _n, sprintf } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import {
|
import {
|
||||||
createInterpolateElement,
|
createInterpolateElement,
|
||||||
useContext,
|
useContext,
|
||||||
|
@ -54,9 +54,8 @@ const LABELS = {
|
||||||
|
|
||||||
export default function Products( props: ProductsProps ) {
|
export default function Products( props: ProductsProps ) {
|
||||||
const marketplaceContextValue = useContext( MarketplaceContext );
|
const marketplaceContextValue = useContext( MarketplaceContext );
|
||||||
const { isLoading, selectedTab } = marketplaceContextValue;
|
const { isLoading } = marketplaceContextValue;
|
||||||
const label = LABELS[ props.type ].label;
|
const label = LABELS[ props.type ].label;
|
||||||
const singularLabel = LABELS[ props.type ].singularLabel;
|
|
||||||
const query = useQuery();
|
const query = useQuery();
|
||||||
const category = query?.category;
|
const category = query?.category;
|
||||||
const perPage = props.perPage ?? MARKETPLACE_ITEMS_PER_PAGE;
|
const perPage = props.perPage ?? MARKETPLACE_ITEMS_PER_PAGE;
|
||||||
|
@ -94,37 +93,14 @@ export default function Products( props: ProductsProps ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the total number of products before we slice it later.
|
// Store the total number of products before we slice it later.
|
||||||
const productTotalCount = props.products?.length ?? 0;
|
|
||||||
const products = props.products?.slice( 0, perPage ) ?? [];
|
const products = props.products?.slice( 0, perPage ) ?? [];
|
||||||
|
|
||||||
let title = sprintf(
|
|
||||||
// translators: %s: plural item type (e.g. extensions, themes)
|
|
||||||
__( '0 %s found', 'woocommerce' ),
|
|
||||||
label
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( productTotalCount > 0 ) {
|
|
||||||
title = sprintf(
|
|
||||||
// translators: %1$s: number of items, %2$s: singular item label, %3$s: plural item label
|
|
||||||
_n( '%1$s %2$s', '%1$s %3$s', productTotalCount, 'woocommerce' ),
|
|
||||||
productTotalCount,
|
|
||||||
singularLabel,
|
|
||||||
label
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const labelForClassName =
|
const labelForClassName =
|
||||||
label === 'business services' ? 'business-services' : label;
|
label === 'business services' ? 'business-services' : label;
|
||||||
|
|
||||||
const baseContainerClass = 'woocommerce-marketplace__search-';
|
const baseContainerClass = 'woocommerce-marketplace__search-';
|
||||||
const baseProductListTitleClass = 'product-list-title--';
|
|
||||||
|
|
||||||
const containerClassName = clsx( baseContainerClass + labelForClassName );
|
const containerClassName = clsx( baseContainerClass + labelForClassName );
|
||||||
const productListTitleClassName = clsx(
|
|
||||||
'woocommerce-marketplace__product-list-title',
|
|
||||||
baseContainerClass + baseProductListTitleClass + labelForClassName,
|
|
||||||
{ 'is-loading': isLoading }
|
|
||||||
);
|
|
||||||
const viewAllButonClassName = clsx(
|
const viewAllButonClassName = clsx(
|
||||||
'woocommerce-marketplace__view-all-button',
|
'woocommerce-marketplace__view-all-button',
|
||||||
baseContainerClass + 'button-' + labelForClassName
|
baseContainerClass + 'button-' + labelForClassName
|
||||||
|
|
Loading…
Reference in New Issue