-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'epic/campaigns' into fix/campaign-page-back-button-GIVE…
…-2142
- Loading branch information
Showing
150 changed files
with
10,403 additions
and
6,743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 65 additions & 54 deletions
119
assets/src/js/admin/reports/components/no-data-notice/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,82 @@ | ||
// Dependencies | ||
import { useState, Fragment } from 'react'; | ||
import { __ } from '@wordpress/i18n' | ||
import { getWindowData } from '../../utils'; | ||
import {Fragment, useState} from 'react'; | ||
import {__} from '@wordpress/i18n'; | ||
import {getWindowData} from '../../utils'; | ||
|
||
// Store-related dependencies | ||
import { useStoreValue } from '../../store'; | ||
import { disablePeriodSelector } from '../../store/actions'; | ||
import {useStoreValue} from '../../store'; | ||
import {disablePeriodSelector} from '../../store/actions'; | ||
|
||
// Styles | ||
import './style.scss'; | ||
|
||
const NoDataNotice = ( { version } ) => { | ||
const [ {}, dispatch ] = useStoreValue(); | ||
const NoDataNotice = ({version}) => { | ||
const [{}, dispatch] = useStoreValue(); | ||
|
||
const [ showNotice, setShowNotice ] = useState( true ); | ||
const [showNotice, setShowNotice] = useState(true); | ||
|
||
const loadSampleData = () => { | ||
setShowNotice( false ); | ||
dispatch( disablePeriodSelector() ); | ||
}; | ||
const loadSampleData = () => { | ||
setShowNotice(false); | ||
dispatch(disablePeriodSelector()); | ||
}; | ||
|
||
const goToNewFormUrl = () => { | ||
const url = getWindowData( 'newFormUrl' ); | ||
window.location = url; | ||
}; | ||
const goToNewFormUrl = () => { | ||
const url = getWindowData('newFormUrl'); | ||
window.location = url; | ||
}; | ||
|
||
return ( | ||
<Fragment> | ||
{ showNotice && ( | ||
<div className="givewp-not-found-notice"> | ||
<div className="givewp-not-found-card"> | ||
{ version === 'dashboard' ? ( | ||
<Fragment> | ||
<h2>{ __( 'Get a quick view of your', 'give' ) }<br />{ __( 'donation activity', 'give' ) }</h2> | ||
<p> | ||
{ __( 'It looks like there hasn\'t been any donations yet on your website.', 'give' ) } <br /> | ||
{ __( 'Set up a donation form to begin collecting donations now.', 'give' ) } <br /> | ||
</p> | ||
<button | ||
onClick={ () => goToNewFormUrl() } | ||
className="givewp-not-found-notice-button"> | ||
{ __( 'Create a Donation Form', 'give' ) } | ||
</button> | ||
</Fragment> | ||
) : ( | ||
<Fragment> | ||
<h2>{ __( 'Get a detailed view of your', 'give' ) }<br />{ __( 'donation activity', 'give' ) }</h2> | ||
<p> | ||
{ __( 'It looks like there hasn\'t been any donations yet on your website. ', 'give' ) } <br /> | ||
{ __( 'Set up a donation form to begin collection donations or load some sample data to preview what the reports look like.', 'give' ) } <br /> | ||
</p> | ||
<button | ||
onClick={ () => loadSampleData() } | ||
className="givewp-not-found-notice-button"> | ||
{ __( 'Explore Sample Reports', 'give' ) } | ||
</button> | ||
</Fragment> | ||
) } | ||
</div> | ||
</div> | ||
) } | ||
</Fragment> | ||
); | ||
return ( | ||
<Fragment> | ||
{showNotice && ( | ||
<div className="givewp-not-found-notice"> | ||
<div className="givewp-not-found-card"> | ||
{version === 'dashboard' ? ( | ||
<Fragment> | ||
<h2> | ||
{__('Get a quick view of your', 'give')} | ||
<br /> | ||
{__('donation activity', 'give')} | ||
</h2> | ||
<p> | ||
{__("It looks like there hasn't been any donations yet on your website.", 'give')}{' '} | ||
<br /> | ||
{__('Set up a campaign form to begin collecting donations now.', 'give')} | ||
<br /> | ||
</p> | ||
<button onClick={() => goToNewFormUrl()} className="givewp-not-found-notice-button"> | ||
{__('Create a Campaign Form', 'give')} | ||
</button> | ||
</Fragment> | ||
) : ( | ||
<Fragment> | ||
<h2> | ||
{__('Get a detailed view of your', 'give')} | ||
<br /> | ||
{__('donation activity', 'give')} | ||
</h2> | ||
<p> | ||
{__("It looks like there hasn't been any donations yet on your website. ", 'give')}{' '} | ||
<br /> | ||
{__( | ||
'Set up a campaign form to begin collection donations or load some sample data to preview what the reports look like.', | ||
'give' | ||
)}{' '} | ||
<br /> | ||
</p> | ||
<button onClick={() => loadSampleData()} className="givewp-not-found-notice-button"> | ||
{__('Explore Sample Reports', 'give')} | ||
</button> | ||
</Fragment> | ||
)} | ||
</div> | ||
</div> | ||
)} | ||
</Fragment> | ||
); | ||
}; | ||
|
||
NoDataNotice.defaultProps = { | ||
version: 'app', | ||
version: 'app', | ||
}; | ||
|
||
export default NoDataNotice; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,38 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n' | ||
import { Button } from '@wordpress/components'; | ||
import {__} from '@wordpress/i18n'; | ||
import {Button} from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { getSiteUrl } from '../../utils'; | ||
import {getSiteUrl} from '../../utils'; | ||
import GiveBlankSlate from '../blank-slate'; | ||
|
||
/** | ||
* Render No forms Found UI | ||
*/ | ||
* | ||
* @unreleased Replace "new form" with "new campaign form" link | ||
*/ | ||
|
||
const NoForms = () => { | ||
return ( | ||
<GiveBlankSlate title={ __( 'No donation forms found.', 'give' ) } | ||
description={ __( 'The first step towards accepting online donations is to create a form.', 'give' ) } | ||
helpLink> | ||
<Button | ||
isPrimary | ||
isLarge | ||
className="give-blank-slate__cta" | ||
href={ `${ getSiteUrl() }/wp-admin/post-new.php?post_type=give_forms` }> | ||
{ __( 'Create Donation Form', 'give' ) } | ||
</Button> | ||
</GiveBlankSlate> | ||
); | ||
return ( | ||
<GiveBlankSlate | ||
title={__('No campaign forms found.', 'give')} | ||
description={__('The first step towards accepting online donations is to create a campaign.', 'give')} | ||
helpLink | ||
> | ||
<Button | ||
isPrimary | ||
isLarge | ||
className="give-blank-slate__cta" | ||
href={`${getSiteUrl()}/wp-admin/edit.php?post_type=give_forms&page=give-campaigns&new=campaign`} | ||
> | ||
{__('Create Campaign Form', 'give')} | ||
</Button> | ||
</GiveBlankSlate> | ||
); | ||
}; | ||
|
||
export default NoForms; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.