Skip to content

Commit

Permalink
Refactor: Campaign status changes (#7639)
Browse files Browse the repository at this point in the history
  • Loading branch information
alaca authored Dec 4, 2024
1 parent 1804935 commit 25ac81c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/Campaigns/Routes/RegisterCampaignRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ public function getSchema(): array
],
'goalProgress' => [
'type' => 'number',
'readonly' => true,
'description' => esc_html__('Campaign goal progress', 'give'),
],
'goalType' => [
Expand Down Expand Up @@ -298,6 +297,7 @@ public function getSchema(): array
'properties' => [
'goal' => [
'minimum' => 1,
'type' => 'number'
],
],
'errorMessage' => [
Expand All @@ -319,6 +319,7 @@ public function getSchema(): array
'properties' => [
'goal' => [
'minimum' => 1,
'type' => 'number'
],
],
'errorMessage' => [
Expand All @@ -340,6 +341,7 @@ public function getSchema(): array
'properties' => [
'goal' => [
'minimum' => 1,
'type' => 'number'
],
],
'errorMessage' => [
Expand All @@ -361,6 +363,7 @@ public function getSchema(): array
'properties' => [
'goal' => [
'minimum' => 1,
'type' => 'number'
],
],
'errorMessage' => [
Expand All @@ -382,6 +385,7 @@ public function getSchema(): array
'properties' => [
'goal' => [
'minimum' => 1,
'type' => 'number'
],
],
'errorMessage' => [
Expand All @@ -403,6 +407,7 @@ public function getSchema(): array
'properties' => [
'goal' => [
'minimum' => 1,
'type' => 'number'
],
],
'errorMessage' => [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {__} from '@wordpress/i18n';
import {useEffect, useState} from '@wordpress/element';
import {useEntityRecord} from '@wordpress/core-data';
import {useDispatch} from '@wordpress/data';
import apiFetch from '@wordpress/api-fetch';
import {JSONSchemaType} from 'ajv';
Expand All @@ -12,7 +11,7 @@ import {Spinner as GiveSpinner} from '@givewp/components';
import {Spinner} from '@wordpress/components';
import Tabs from './Tabs';
import ArchiveCampaignDialog from './Components/ArchiveCampaignDialog';
import {ArrowReverse, BreadcrumbSeparatorIcon, DotsIcons, TrashIcon, TriangleIcon, ViewIcon} from '../Icons';
import {ArrowReverse, BreadcrumbSeparatorIcon, DotsIcons, TrashIcon, ViewIcon} from '../Icons';
import ArchivedCampaignNotice from './Components/Notices/ArchivedCampaignNotice';
import NotificationPlaceholder from '../Notifications';
import cx from 'classnames';
Expand Down Expand Up @@ -83,7 +82,7 @@ export default function CampaignsDetailsPage({campaignId}) {
} = useCampaignEntityRecord();

const methods = useForm<Campaign>({
mode: 'onChange',
mode: 'onBlur',
...resolver,
});

Expand Down Expand Up @@ -257,7 +256,10 @@ export default function CampaignsDetailsPage({campaignId}) {
<a
href="#"
className={cx(styles.contextMenuItem, styles.draft)}
onClick={() => updateStatus('draft')}
onClick={() => {
updateStatus('draft');
dispatch.dismissNotification('update-archive-notice');
}}
>
<ArrowReverse /> {__('Move to draft', 'give')}
</a>
Expand Down

0 comments on commit 25ac81c

Please sign in to comment.