|
1 | 1 | // Dependencies |
2 | | -import { useState, Fragment } from 'react'; |
3 | | -import { __ } from '@wordpress/i18n' |
4 | | -import { getWindowData } from '../../utils'; |
| 2 | +import {Fragment, useState} from 'react'; |
| 3 | +import {__} from '@wordpress/i18n'; |
| 4 | +import {getWindowData} from '../../utils'; |
5 | 5 |
|
6 | 6 | // Store-related dependencies |
7 | | -import { useStoreValue } from '../../store'; |
8 | | -import { disablePeriodSelector } from '../../store/actions'; |
| 7 | +import {useStoreValue} from '../../store'; |
| 8 | +import {disablePeriodSelector} from '../../store/actions'; |
9 | 9 |
|
10 | 10 | // Styles |
11 | 11 | import './style.scss'; |
12 | 12 |
|
13 | | -const NoDataNotice = ( { version } ) => { |
14 | | - const [ {}, dispatch ] = useStoreValue(); |
| 13 | +const NoDataNotice = ({version}) => { |
| 14 | + const [{}, dispatch] = useStoreValue(); |
15 | 15 |
|
16 | | - const [ showNotice, setShowNotice ] = useState( true ); |
| 16 | + const [showNotice, setShowNotice] = useState(true); |
17 | 17 |
|
18 | | - const loadSampleData = () => { |
19 | | - setShowNotice( false ); |
20 | | - dispatch( disablePeriodSelector() ); |
21 | | - }; |
| 18 | + const loadSampleData = () => { |
| 19 | + setShowNotice(false); |
| 20 | + dispatch(disablePeriodSelector()); |
| 21 | + }; |
22 | 22 |
|
23 | | - const goToNewFormUrl = () => { |
24 | | - const url = getWindowData( 'newFormUrl' ); |
25 | | - window.location = url; |
26 | | - }; |
| 23 | + const goToNewFormUrl = () => { |
| 24 | + const url = getWindowData('newFormUrl'); |
| 25 | + window.location = url; |
| 26 | + }; |
27 | 27 |
|
28 | | - return ( |
29 | | - <Fragment> |
30 | | - { showNotice && ( |
31 | | - <div className="givewp-not-found-notice"> |
32 | | - <div className="givewp-not-found-card"> |
33 | | - { version === 'dashboard' ? ( |
34 | | - <Fragment> |
35 | | - <h2>{ __( 'Get a quick view of your', 'give' ) }<br />{ __( 'donation activity', 'give' ) }</h2> |
36 | | - <p> |
37 | | - { __( 'It looks like there hasn\'t been any donations yet on your website.', 'give' ) } <br /> |
38 | | - { __( 'Set up a donation form to begin collecting donations now.', 'give' ) } <br /> |
39 | | - </p> |
40 | | - <button |
41 | | - onClick={ () => goToNewFormUrl() } |
42 | | - className="givewp-not-found-notice-button"> |
43 | | - { __( 'Create a Donation Form', 'give' ) } |
44 | | - </button> |
45 | | - </Fragment> |
46 | | - ) : ( |
47 | | - <Fragment> |
48 | | - <h2>{ __( 'Get a detailed view of your', 'give' ) }<br />{ __( 'donation activity', 'give' ) }</h2> |
49 | | - <p> |
50 | | - { __( 'It looks like there hasn\'t been any donations yet on your website. ', 'give' ) } <br /> |
51 | | - { __( 'Set up a donation form to begin collection donations or load some sample data to preview what the reports look like.', 'give' ) } <br /> |
52 | | - </p> |
53 | | - <button |
54 | | - onClick={ () => loadSampleData() } |
55 | | - className="givewp-not-found-notice-button"> |
56 | | - { __( 'Explore Sample Reports', 'give' ) } |
57 | | - </button> |
58 | | - </Fragment> |
59 | | - ) } |
60 | | - </div> |
61 | | - </div> |
62 | | - ) } |
63 | | - </Fragment> |
64 | | - ); |
| 28 | + return ( |
| 29 | + <Fragment> |
| 30 | + {showNotice && ( |
| 31 | + <div className="givewp-not-found-notice"> |
| 32 | + <div className="givewp-not-found-card"> |
| 33 | + {version === 'dashboard' ? ( |
| 34 | + <Fragment> |
| 35 | + <h2> |
| 36 | + {__('Get a quick view of your', 'give')} |
| 37 | + <br /> |
| 38 | + {__('donation activity', 'give')} |
| 39 | + </h2> |
| 40 | + <p> |
| 41 | + {__("It looks like there hasn't been any donations yet on your website.", 'give')}{' '} |
| 42 | + <br /> |
| 43 | + {__('Set up a campaign form to begin collecting donations now.', 'give')} |
| 44 | + <br /> |
| 45 | + </p> |
| 46 | + <button onClick={() => goToNewFormUrl()} className="givewp-not-found-notice-button"> |
| 47 | + {__('Create a Campaign Form', 'give')} |
| 48 | + </button> |
| 49 | + </Fragment> |
| 50 | + ) : ( |
| 51 | + <Fragment> |
| 52 | + <h2> |
| 53 | + {__('Get a detailed view of your', 'give')} |
| 54 | + <br /> |
| 55 | + {__('donation activity', 'give')} |
| 56 | + </h2> |
| 57 | + <p> |
| 58 | + {__("It looks like there hasn't been any donations yet on your website. ", 'give')}{' '} |
| 59 | + <br /> |
| 60 | + {__( |
| 61 | + 'Set up a campaign form to begin collection donations or load some sample data to preview what the reports look like.', |
| 62 | + 'give' |
| 63 | + )}{' '} |
| 64 | + <br /> |
| 65 | + </p> |
| 66 | + <button onClick={() => loadSampleData()} className="givewp-not-found-notice-button"> |
| 67 | + {__('Explore Sample Reports', 'give')} |
| 68 | + </button> |
| 69 | + </Fragment> |
| 70 | + )} |
| 71 | + </div> |
| 72 | + </div> |
| 73 | + )} |
| 74 | + </Fragment> |
| 75 | + ); |
65 | 76 | }; |
66 | 77 |
|
67 | 78 | NoDataNotice.defaultProps = { |
68 | | - version: 'app', |
| 79 | + version: 'app', |
69 | 80 | }; |
70 | 81 |
|
71 | 82 | export default NoDataNotice; |
0 commit comments