/** @format */
/**
* External dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { Component, Fragment } from '@wordpress/element';
import { compose } from '@wordpress/compose';
import Gridicon from 'gridicons';
import interpolateComponents from 'interpolate-components';
import { noop, isNull } from 'lodash';
import PropTypes from 'prop-types';
/**
* WooCommerce dependencies
*/
import {
EmptyContent,
Gravatar,
Link,
ProductImage,
ReviewRating,
Section,
SplitButton,
} from '@woocommerce/components';
/**
* Internal dependencies
*/
import { ActivityCard, ActivityCardPlaceholder } from '../activity-card';
import ActivityHeader from '../activity-header';
import { QUERY_DEFAULTS } from 'wc-api/constants';
import sanitizeHTML from 'lib/sanitize-html';
import withSelect from 'wc-api/with-select';
class ReviewsPanel extends Component {
renderReview( review ) {
const product =
( review && review._embedded && review._embedded.up && review._embedded.up[ 0 ] ) || null;
if ( isNull( product ) ) {
return null;
}
const title = interpolateComponents( {
mixedString: sprintf(
__(
'{{productLink}}%s{{/productLink}} reviewed by {{authorLink}}%s{{/authorLink}}',
'wc-admin'
),
product.name,
review.reviewer
),
components: {
productLink: ,
authorLink: ,
},
} );
const subtitle = (