/** @format */
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
import { Component, Fragment } from '@wordpress/element';
import { compose } from '@wordpress/compose';
import Gridicon from 'gridicons';
import { withSelect } from '@wordpress/data';
/**
* Internal dependencies
*/
import { ActivityCard, ActivityCardPlaceholder } from '../activity-card';
import ActivityHeader from '../activity-header';
import sanitizeHTML from 'lib/sanitize-html';
import { Section } from '@woocommerce/components';
class InboxPanel extends Component {
render() {
const { loading, notes } = this.props;
const getButtonsFromActions = actions => {
if ( ! actions ) {
return [];
}
return actions.map( action => (
) );
};
return (
{ loading ? (
) : (
Object.keys( notes ).map( key => (
}
unread={ 'unread' === notes[ key ].status }
actions={ getButtonsFromActions( notes[ key ].actions ) }
>
) )
) }
);
}
}
export default compose(
withSelect( select => {
const { getNotes } = select( 'wc-admin' );
const notes = getNotes();
const loading = select( 'core/data' ).isResolving( 'wc-admin', 'getNotes' );
return { loading, notes };
} )
)( InboxPanel );