????JFIF??x?x????'
Server IP : 104.21.48.1 / Your IP : 216.73.216.145 Web Server : LiteSpeed System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : tempvsty ( 647) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/tempvsty/pontiacques.org/wp-content/plugins/give/src/Campaigns/Blocks/CampaignStats/ |
Upload File : |
import {InspectorControls, useBlockProps} from '@wordpress/block-editor'; import {__} from '@wordpress/i18n'; import {BlockEditProps} from '@wordpress/blocks'; import {PanelBody, SelectControl} from '@wordpress/components'; import CampaignSelector from '../shared/components/CampaignSelector'; import ServerSideRender from '@wordpress/server-side-render'; import useCampaign from '../shared/hooks/useCampaign'; import './styles.scss'; type statisticType = 'top-donation' | 'average-donation'; export default function Edit({ attributes, setAttributes, }: BlockEditProps<{ campaignId: number; statistic: statisticType; }>) { const blockProps = useBlockProps(); const {campaign, hasResolved} = useCampaign(attributes?.campaignId); const statsHelpText = attributes.statistic === 'top-donation' ? __('Displays the top donation of the selected campaign.', 'give') : __('Displays the average donation of the selected campaign.', 'give'); return ( <div {...blockProps}> <CampaignSelector campaignId={attributes.campaignId} handleSelect={(campaignId: number) => setAttributes({campaignId})} > <ServerSideRender block="givewp/campaign-stats-block" attributes={attributes} /> </CampaignSelector> {hasResolved && campaign?.id && ( <InspectorControls> <PanelBody title="Settings" initialOpen={true}> <SelectControl label={__('Type', 'give')} help={statsHelpText} value={attributes.statistic} options={[ {value: 'top-donation', label: __('Top Donation', 'give')}, {value: 'average-donation', label: __('Average Donation', 'give')}, ]} onChange={(value: statisticType) => setAttributes({statistic: value})} /> </PanelBody> </InspectorControls> )} </div> ); }