Merge pull request woocommerce/woocommerce-admin#2327 from woocommerce/add/filter-inbox-unactioned

Only show unactioned notes in the Inbox panel.
This commit is contained in:
Jeff Stieler 2019-05-31 10:11:50 -06:00 committed by GitHub
commit 22cdec7e57
4 changed files with 26 additions and 5 deletions

View File

@ -219,6 +219,14 @@
// Needs the double-class for specificity
.woocommerce-activity-card.woocommerce-inbox-activity-card {
grid-template-columns: 72px 1fr;
height: 100%;
opacity: 1;
padding: $fallback-gutter;
padding: $gutter;
@media screen and (prefers-reduced-motion: no-preference) {
transition: opacity 0.3s, height 0s, padding 0s;
}
@include breakpoint( '<782px' ) {
grid-template-columns: 64px 1fr;
@ -227,6 +235,15 @@
.woocommerce-activity-card__header {
margin-bottom: $gap-small;
}
&.actioned {
height: 0;
opacity: 0;
padding: 0;
@media screen and (prefers-reduced-motion: no-preference) {
transition: opacity 0.3s, height 0s 0.3s, padding 0s 0.3s;
}
}
}
.woocommerce-review-activity-card {

View File

@ -18,6 +18,7 @@ import { EmptyContent, Section } from '@woocommerce/components';
import sanitizeHTML from 'lib/sanitize-html';
import { QUERY_DEFAULTS } from 'wc-api/constants';
import withSelect from 'wc-api/with-select';
import classnames from 'classnames';
class InboxPanel extends Component {
constructor( props ) {
@ -76,7 +77,9 @@ class InboxPanel extends Component {
return notesArray.map( note => (
<ActivityCard
key={ note.id }
className="woocommerce-inbox-activity-card"
className={ classnames( 'woocommerce-inbox-activity-card', {
actioned: 'unactioned' !== note.status,
} ) }
title={ note.title }
date={ note.date_created_gmt }
icon={ <Gridicon icon={ note.icon } size={ 48 } /> }
@ -150,6 +153,7 @@ export default compose(
type: 'info,warning',
orderby: 'date',
order: 'desc',
status: 'unactioned',
};
const notes = getNotes( inboxQuery );

View File

@ -58,7 +58,7 @@ class WC_Admin_REST_Admin_Note_Action_Controller extends WC_Admin_REST_Admin_Not
if ( ! $note ) {
return new WP_Error(
'woocommerce_admin_notes_invalid_id',
__( 'Sorry, there is no resouce with that ID.', 'woocommerce-admin' ),
__( 'Sorry, there is no resource with that ID.', 'woocommerce-admin' ),
array( 'status' => 404 )
);
}
@ -77,7 +77,7 @@ class WC_Admin_REST_Admin_Note_Action_Controller extends WC_Admin_REST_Admin_Not
if ( ! $triggered_action ) {
return new WP_Error(
'woocommerce_admin_note_action_invalid_id',
__( 'Sorry, there is no resouce with that ID.', 'woocommerce-admin' ),
__( 'Sorry, there is no resource with that ID.', 'woocommerce-admin' ),
array( 'status' => 404 )
);
}

View File

@ -86,7 +86,7 @@ class WC_Admin_REST_Admin_Notes_Controller extends WC_REST_CRUD_Controller {
if ( ! $note ) {
return new WP_Error(
'woocommerce_admin_notes_invalid_id',
__( 'Sorry, there is no resouce with that ID.', 'woocommerce-admin' ),
__( 'Sorry, there is no resource with that ID.', 'woocommerce-admin' ),
array( 'status' => 404 )
);
}
@ -199,7 +199,7 @@ class WC_Admin_REST_Admin_Notes_Controller extends WC_REST_CRUD_Controller {
if ( ! $note ) {
return new WP_Error(
'woocommerce_admin_notes_invalid_id',
__( 'Sorry, there is no resouce with that ID.', 'woocommerce-admin' ),
__( 'Sorry, there is no resource with that ID.', 'woocommerce-admin' ),
array( 'status' => 404 )
);
}