Skip to content

Commit

Permalink
Merge branch 'epic/campaigns' into fix/campaign-page-back-button-GIVE…
Browse files Browse the repository at this point in the history
…-2142
  • Loading branch information
kjohnson authored Feb 21, 2025
2 parents ef36b0b + 2876666 commit ffcd43a
Show file tree
Hide file tree
Showing 150 changed files with 10,403 additions and 6,743 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/wordpress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
Expand Down
4 changes: 4 additions & 0 deletions assets/src/css/admin/_components.admin-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
.post-type-give_forms,
.give_forms_page_give-subscriptions {

.page-title-action:not(.switch-new-view) {
display: none;
}

.wp-header-end + .notice {
margin-top: 11px;
}
Expand Down
2 changes: 1 addition & 1 deletion assets/src/css/icons/fa/brands.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Font Awesome Free 5.12.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
@import 'assets/src/css/icons/fa/variables';
@import './variables';

@font-face {
font-family: 'Font Awesome 5 Brands';
Expand Down
24 changes: 12 additions & 12 deletions assets/src/css/icons/fa/fontawesome.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Font Awesome Free 5.12.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
@import 'assets/src/css/icons/fa/variables';
@import 'assets/src/css/icons/fa/mixins';
@import 'assets/src/css/icons/fa/core';
@import 'assets/src/css/icons/fa/larger';
@import 'assets/src/css/icons/fa/fixed-width';
@import 'assets/src/css/icons/fa/list';
@import 'assets/src/css/icons/fa/bordered-pulled';
@import 'assets/src/css/icons/fa/animated';
@import 'assets/src/css/icons/fa/rotated-flipped';
@import 'assets/src/css/icons/fa/stacked';
@import 'assets/src/css/icons/fa/icons';
@import 'assets/src/css/icons/fa/screen-reader';
@import './variables';
@import './mixins';
@import './core';
@import './larger';
@import './fixed-width';
@import './list';
@import './bordered-pulled';
@import './animated';
@import './rotated-flipped';
@import './stacked';
@import './icons';
@import './screen-reader';
2 changes: 1 addition & 1 deletion assets/src/css/icons/fa/regular.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Font Awesome Free 5.12.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
@import 'assets/src/css/icons/fa/variables';
@import './variables';

@font-face {
font-family: 'Font Awesome 5 Free';
Expand Down
2 changes: 1 addition & 1 deletion assets/src/css/icons/fa/solid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Font Awesome Free 5.12.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
@import 'assets/src/css/icons/fa/variables';
@import './variables';

@font-face {
font-family: 'Font Awesome 5 Free';
Expand Down
4 changes: 2 additions & 2 deletions assets/src/css/icons/fa/v4-shims.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
* Font Awesome Free 5.12.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
@import 'assets/src/css/icons/fa/variables';
@import 'assets/src/css/icons/fa/shims';
@import './variables';
@import './shims';
119 changes: 65 additions & 54 deletions assets/src/js/admin/reports/components/no-data-notice/index.js
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;
39 changes: 22 additions & 17 deletions blocks/components/no-form/index.js
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;
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ private function getAsArray($value) {
/**
* Return formatted notice when shortcode return empty string
*
* @unreleased Replace "new form" with "new campaign form" link
* @since 2.4.0
*
* @return string
Expand All @@ -284,10 +285,11 @@ private function blank_slate() {
$content = array(
'image_url' => GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg',
'image_alt' => __( 'Give Icon', 'give' ),
'heading' => __( 'No donation forms found.', 'give' ),
'message' => __( 'The first step towards accepting online donations is to create a form.', 'give' ),
'cta_text' => __( 'Create Donation Form', 'give' ),
'cta_link' => admin_url( 'post-new.php?post_type=give_forms' ),
'heading' => __('No campaign forms found.', 'give'),
'message' => __('The first step towards accepting online donations is to create a campaign.',
'give'),
'cta_text' => __('Create Campaign Form', 'give'),
'cta_link' => admin_url('edit.php?post_type=give_forms&page=give-campaigns&new=campaign'),
'help' => sprintf(
/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
__( 'Need help? Get started with %1$sGive 101%2$s.', 'give' ),
Expand Down
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
"symfony/polyfill-ctype": "^1.19",
"symfony/polyfill-mbstring": "^1.19",
"woocommerce/action-scheduler": "^3.6",
"psr/container": "1.1.1",
"ext-json": "*",
"stellarwp/arrays": "^1.2"
"stellarwp/admin-notices": "^2.0",
"stellarwp/arrays": "^1.3"
},
"require-dev": {
"fakerphp/faker": "^1.9",
Expand Down Expand Up @@ -96,6 +98,7 @@
"constant_prefix": "GIVE_VENDORS_",
"packages": [
"stellarwp/arrays",
"stellarwp/admin-notices",
"stellarwp/validation",
"stellarwp/field-conditions",
"symfony/polyfill-ctype",
Expand All @@ -104,7 +107,8 @@
],
"exclude_from_copy": {
"packages": [
"symfony/deprecation-contracts"
"symfony/deprecation-contracts",
"psr/container"
],
"file_patterns": [
"/Tests/"
Expand Down
Loading

0 comments on commit ffcd43a

Please sign in to comment.