Show error in activity panel if no actionable order statuses exist (https://github.com/woocommerce/woocommerce-admin/pull/1799)

* Show error in activity panel if no actionable order statuses exist

* Localize empty actionable statuses string

* Add padding around empty content component in activity panels
This commit is contained in:
Joshua T Flowers 2019-03-15 09:26:16 +08:00 committed by GitHub
parent df5f001140
commit 26de74dc30
2 changed files with 22 additions and 3 deletions

View File

@ -35,8 +35,22 @@ import ActivityOutboundLink from '../activity-outbound-link';
import { QUERY_DEFAULTS } from 'wc-api/constants';
import withSelect from 'wc-api/with-select';
function OrdersPanel( { orders, isRequesting, isError } ) {
function OrdersPanel( { orders, isRequesting, isError, orderStatuses } ) {
if ( isError ) {
if ( ! orderStatuses.length ) {
return (
<EmptyContent
title={ __(
"You currently don't have any actionable statuses. " +
'To display orders here, select orders that require further review in settings.',
'woocommerce-admin'
) }
actionLabel={ __( 'Settings', 'woocommerce-admin' ) }
actionURL={ getAdminLink( 'admin.php?page=wc-admin#/analytics/settings' ) }
/>
);
}
const title = __(
'There was an error getting your orders. Please try again.',
'woocommerce-admin'
@ -217,13 +231,13 @@ export default compose(
};
if ( ! orderStatuses.length ) {
return { orders: [], isError: false, isRequesting: false };
return { orders: [], isError: true, isRequesting: false, orderStatuses };
}
const orders = getReportItems( 'orders', ordersQuery ).data;
const isError = Boolean( getReportItemsError( 'orders', ordersQuery ) );
const isRequesting = isReportItemsRequesting( 'orders', ordersQuery );
return { orders, isError, isRequesting };
return { orders, isError, isRequesting, orderStatuses };
} )
)( OrdersPanel );

View File

@ -237,6 +237,11 @@
animation: none;
}
}
.woocommerce-empty-content {
padding-left: $gap-large;
padding-right: $gap-large;
}
}
.woocommerce-layout__activity-panel-avatar-flag-overlay {