/**
 * Donors List Block - Editor Registration
 */
( function( blocks, element, i18n, serverSideRender ) {
	var el = element.createElement;
	var __ = i18n.__;

	blocks.registerBlockType( 'ambassadorhub/donors-list', {
		title: __( 'Donors List', 'ambassadorhub' ),
		icon: 'groups',
		category: 'ambassadorhub',
		attributes: {
			limit: {
				type: 'number',
				default: 10
			},
			showAmount: {
				type: 'boolean',
				default: true
			}
		},
		edit: function( props ) {
			var blockProps = wp.blockEditor.useBlockProps();
			return el( 'div', blockProps,
				el( serverSideRender, {
					block: 'ambassadorhub/donors-list',
					attributes: props.attributes
				} )
			);
		},
		save: function() {
			return null; // Server-side render
		}
	} );
} (
	window.wp.blocks,
	window.wp.element,
	window.wp.i18n,
	window.wp.serverSideRender
) );
