PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
← All changes | blocks/donor-wall/edit/block.js +13 -48 2.3.0 → 4.17.0 View file →
@@ -1,22 +1,14 @@
1 1 /**
2 - * External dependencies
2 + * WordPress dependencies
3 3 */
4 -import { isEmpty, pickBy, isUndefined } from 'lodash';
5 -import { stringify } from 'querystringify';
4 +import { Fragment } from '@wordpress/element';
5 +import ServerSideRender from '@wordpress/server-side-render';
6 6
7 7 /**
8 - * Wordpress dependencies
9 - */
10 -const { __ } = wp.i18n;
11 -const { withAPIData } = wp.components;
12 -
13 -/**
14 8 * Internal dependencies
15 9 */
16 -import GiveBlankSlate from '../../components/blank-slate';
17 -import NoForms from '../../components/no-form';
18 -import DonorWallPreview from './components/preview';
10 +import Inspector from './inspector';
19 11
20 12 /**
21 13 * Render Block UI For Editor
22 14 */
@@ -21,45 +13,18 @@
21 13 * Render Block UI For Editor
22 14 */
23 15
24 16 const GiveDonorWall = ( props ) => {
25 - console.log( props )
26 - const { latestForms } = props;
27 - const { isLoading, data } = latestForms;
17 + const { attributes } = props;
28 18
29 - // Render block UI
30 - let blockUI;
31 -
32 - if ( isLoading || isUndefined( data ) ) {
33 - blockUI = <GiveBlankSlate title={ __( 'Loading...' ) } isLoader={ true } />;
34 - } else if ( isEmpty( data ) ) {
35 - blockUI = <NoForms />;
36 - } else {
37 - blockUI = <DonorWallPreview
38 - html={ data }
39 - { ... { ...props } } />;
40 - }
41 -
42 - return ( <div className={ props.className } key="GiveDonorWallBlockUI">{ blockUI }</div> );
19 + return (
20 + <Fragment>
21 + <Inspector { ... { ...props } } />
22 + <ServerSideRender block="give/donor-wall" attributes={ attributes } />
23 + </Fragment>
24 + );
43 25 };
44 26
45 -/**
46 - * Export component attaching withAPIData
47 - */
48 -export default withAPIData( ( props ) => {
49 - const { columns, showAvatar, showName, showTotal, showDate, showComments } = props.attributes;
27 +export default GiveDonorWall;
50 28
51 - const parameters = stringify( pickBy( {
52 - columns: columns,
53 - show_avatar: showAvatar,
54 - show_name: showName,
55 - show_total: showTotal,
56 - show_time: showDate,
57 - show_comments: showComments,
58 - },
59 - value => ! isUndefined( value ) )
60 - );
29 +// @todo show no donor template if donor does not exist.
61 30
62 - return {
63 - latestForms: `/${ giveApiSettings.rest_base }/donor-wall/?${ parameters }`,
64 - };
65 -} )( GiveDonorWall );