$50 GRAYBYTE WORDPRESS FILE MANAGER $58

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.216.51
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/home/bravetechrwanda/itiministry.org/plugins/give/src/Campaigns/Blocks/CampaignDonations/

HOME
Current File : /home/bravetechrwanda/itiministry.org/plugins/give/src/Campaigns/Blocks/CampaignDonations//edit.tsx
import {InspectorControls, useBlockProps} from '@wordpress/block-editor';
import {BlockEditProps} from '@wordpress/blocks';
import {
    __experimentalNumberControl as NumberControl,
    PanelBody,
    SelectControl,
    TextControl,
    ToggleControl,
} from '@wordpress/components';
import {__} from '@wordpress/i18n';
import ServerSideRender from '@wordpress/server-side-render';
import CampaignSelector from '../shared/components/CampaignSelector';
import useCampaign from '../shared/hooks/useCampaign';

export default function Edit({
                                 attributes,
                                 setAttributes,
                             }: BlockEditProps<{
    campaignId: number;
    showAnonymous: boolean;
    showIcon: boolean;
    showButton: boolean;
    donateButtonText: string;
    sortBy: string;
    donationsPerPage: number;
    loadMoreButtonText: string;
}>) {
    const blockProps = useBlockProps();
    const {campaign, hasResolved} = useCampaign(attributes.campaignId);

    const {showAnonymous, showIcon, showButton, donateButtonText, sortBy, donationsPerPage, loadMoreButtonText} =
        attributes;

    return (
        <div {...blockProps}>
            <CampaignSelector
                campaignId={attributes.campaignId}
                handleSelect={(campaignId: number) => setAttributes({campaignId})}
            >
                <ServerSideRender block="givewp/campaign-donations" attributes={attributes} />
            </CampaignSelector>

            {hasResolved && campaign?.id && (
                <InspectorControls>
                    <PanelBody title={__('Display Elements', 'give')} initialOpen={true}>
                        <ToggleControl
                            label={__('Show anonymous', 'give')}
                            checked={showAnonymous}
                            onChange={(value) => setAttributes({showAnonymous: value})}
                        />
                        <ToggleControl
                            label={__('Show icon', 'give')}
                            checked={showIcon}
                            onChange={(value) => setAttributes({showIcon: value})}
                        />
                        <ToggleControl
                            label={__('Show button', 'give')}
                            checked={showButton}
                            onChange={(value) => setAttributes({showButton: value})}
                        />
                        <TextControl
                            label={__('Donate Button', 'give')}
                            value={donateButtonText}
                            onChange={(value) => setAttributes({donateButtonText: value})}
                            help={__('This shows on the header', 'give')}
                        />
                    </PanelBody>

                    <PanelBody title={__('Settings', 'give')} initialOpen={true}>
                        <SelectControl
                            label={__('Sort by', 'give')}
                            value={sortBy}
                            options={[
                                {label: __('Top donations', 'give'), value: 'top-donations'},
                                {label: __('Recent donations', 'give'), value: 'recent-donations'},
                            ]}
                            onChange={(value) => setAttributes({sortBy: value})}
                            help={__('The order donations are displayed in.', 'give')}
                        />
                        {/* TODO: Revert the label and help text back to what are in the designs once the backend for pagination is ready */}
                        <NumberControl
                            label={__('Limit', 'give')}
                            value={donationsPerPage}
                            min={1}
                            max={100}
                            onChange={(value) => setAttributes({donationsPerPage: parseInt(value)})}
                            help={__('The maximum number of donations to display.', 'give')}
                        />
                        {/* TODO: Revert the field back once the backend for pagination is ready
                        <TextControl
                            label={__('Load More Button', 'give')}
                            value={loadMoreButtonText}
                            onChange={(value) => setAttributes({loadMoreButtonText: value})}
                        />
                        */}
                    </PanelBody>
                </InspectorControls>
            )}
        </div>
    );
}

Current_dir [ WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
25 May 2026 4.20 PM
bravetechrwanda / bravetechrwanda
0755
resources
--
25 May 2026 4.20 PM
bravetechrwanda / bravetechrwanda
0755
CampaignDonationsBlockViewModel.php
1.811 KB
28 Jan 2026 8.00 PM
bravetechrwanda / bravetechrwanda
0644
app.tsx
0.023 KB
31 Mar 2025 11.17 PM
bravetechrwanda / bravetechrwanda
0644
block.json
1.236 KB
31 Mar 2025 11.17 PM
bravetechrwanda / bravetechrwanda
0644
edit.tsx
4.509 KB
31 Mar 2025 11.17 PM
bravetechrwanda / bravetechrwanda
0644
index.tsx
0.276 KB
31 Mar 2025 11.17 PM
bravetechrwanda / bravetechrwanda
0644
render.php
1.961 KB
28 Jan 2026 8.00 PM
bravetechrwanda / bravetechrwanda
0644
styles.scss
4.414 KB
10 Sep 2025 5.42 PM
bravetechrwanda / bravetechrwanda
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF Static GIF