import { __, sprintf } from '@wordpress/i18n'; import { Fragment, RawHTML } from '@wordpress/element'; import { Notice, ToggleControl, RangeControl, SelectControl, } from '@wordpress/components'; import { getAdminLink } from '@woocommerce/navigation'; /** * Internal dependencies */ import ToggleButtonControl from '../../components/toggle-button-control'; import { ENABLE_REVIEW_RATING, SHOW_AVATARS } from '../../constants'; export const getSharedReviewContentControls = ( attributes, setAttributes ) => { return ( setAttributes( { showReviewRating: ! attributes.showReviewRating } ) } /> { ( attributes.showReviewRating && ! ENABLE_REVIEW_RATING ) && ( { sprintf( __( 'Product rating is disabled in your %sstore settings%s.', 'woo-gutenberg-products-block' ), ``, '' ) } ) } setAttributes( { showReviewerName: ! attributes.showReviewerName } ) } /> setAttributes( { showReviewImage: ! attributes.showReviewImage } ) } /> setAttributes( { showReviewDate: ! attributes.showReviewDate } ) } /> setAttributes( { showReviewContent: ! attributes.showReviewContent } ) } /> { attributes.showReviewImage && ( setAttributes( { imageType: value } ) } /> { ( attributes.imageType === 'reviewer' && ! SHOW_AVATARS ) && ( { sprintf( __( 'Reviewer photo is disabled in your %ssite settings%s.', 'woo-gutenberg-products-block' ), ``, '' ) } ) } ) } ); }; export const getSharedReviewListControls = ( attributes, setAttributes ) => { const minPerPage = 1; const maxPerPage = 20; return ( setAttributes( { showOrderby: ! attributes.showOrderby } ) } /> setAttributes( { orderby } ) } /> setAttributes( { reviewsOnPageLoad } ) } max={ maxPerPage } min={ minPerPage } /> setAttributes( { showLoadMore: ! attributes.showLoadMore } ) } /> { attributes.showLoadMore && ( setAttributes( { reviewsOnLoadMore } ) } max={ maxPerPage } min={ minPerPage } /> ) } ); };