PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.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 All 257 releases
give / src / Campaigns / resources / admin / components / ExistingUserIntroModal / index.tsx

index.tsx in GiveWP – Donation Plugin and Fundraising Platform 4.18.0, at src/Campaigns/resources/admin/components/ExistingUserIntroModal/index.tsx

102 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import ModalDialog from '@givewp/components/AdminUI/ModalDialog';
2 import {useState} from 'react';
3 import {DismissIcon, StarIcon} from './icons';
4 import {getGiveCampaignsListTableWindowData} from '@givewp/campaigns/admin/components/CampaignsListTable';
5 import {__} from '@wordpress/i18n';
6 import {StepDetails} from '@givewp/campaigns/admin/components/ExistingUserIntroModal/StepDetails';
7 import styles from './ExistingUserIntroModal.module.scss';
8 import {updateUserNoticeOptions} from '@givewp/campaigns/utils';
9
10 /**
11 * @since 4.0.0
12 */
13
14 export type stepConfig = {
15 title: string;
16 description: string;
17 buttonText: string;
18 linkText?: string;
19 badge?: () => JSX.Element;
20 };
21
22 const stepsConfig: stepConfig[] = [
23 {
24 badge: () => (
25 <div className={styles.badge}>
26 <StarIcon />
27 {__('NEW', 'give')}
28 </div>
29 ),
30 title: __('Introducing Campaigns', 'give'),
31 description: __(
32 'We’ve reimagined your online fundraising. Now, you can build a campaign page, track, and optimize entire fundraising campaigns with just a few steps.',
33 'give'
34 ),
35 buttonText: __('Next', 'give'),
36 },
37 {
38 title: __('Empowering your fundraising efforts', 'give'),
39 description: __(
40 'Add multiple donation forms, update your campaign on the go, and get tailored performance reports — all in one place.',
41 'give'
42 ),
43 linkText: __('Read more on campaigns', 'give'),
44 buttonText: __('Continue', 'give'),
45 },
46 ];
47
48 /**
49 * @since 4.0.0
50 */
51
52 type ExisingUserIntroModalProps = {
53 isOpen: boolean;
54 setOpen: (value: boolean) => void;
55 };
56
57 export default function ExistingUserIntroModal({isOpen, setOpen}: ExisingUserIntroModalProps) {
58 const [step, setStep] = useState<number>(0);
59
60 const stepConfig = stepsConfig[step];
61
62 const handleClose = async () => {
63 setStep(0);
64 setOpen(false);
65 updateUserNoticeOptions('givewp_campaign_existing_user_intro_notice');
66 };
67
68 const handleNextStep = () => {
69 if (step >= stepsConfig.length - 1) {
70 handleClose();
71 } else {
72 setStep((prevStep) => prevStep + 1);
73 }
74 };
75
76 return (
77 <ModalDialog
78 isOpen={isOpen}
79 showHeader={true}
80 handleClose={handleClose}
81 wrapperClassName={`givewp-existing-user-intro-modal ${styles.introModal}`}
82 showCloseIcon={false}
83 title={''}
84 >
85 <div className={styles.preview}>
86 <button type={'button'} className={styles.dismiss} onClick={handleClose}>
87 <DismissIcon />
88 </button>
89 <img
90 className={styles.previewImage}
91 src={`${
92 getGiveCampaignsListTableWindowData().pluginUrl
93 }/build/assets/dist/images/admin/campaigns/campaigns-cover.jpg`}
94 alt={'Campaign Preview Image'}
95 />
96 </div>
97
98 {stepConfig && <StepDetails stepConfig={stepConfig} handleClick={handleNextStep} />}
99 </ModalDialog>
100 );
101 }
102