Skip to content

Commit 0e65308

Browse files
committed
Use constants for the action values in the SetupPaidAds component.
Address #1649 (comment)
1 parent 3e0debd commit 0e65308

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

js/src/setup-mc/setup-stepper/setup-paid-ads/setup-paid-ads.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ function PaidAdsSectionsGroup( { onCampaignChange } ) {
7575
);
7676
}
7777

78+
const ACTION_COMPLETE = 'complete-ads';
79+
const ACTION_SKIP = 'skip-ads';
80+
81+
/**
82+
* Renders the onboarding step for setting up the paid ads (Google Ads account and paid campaign)
83+
* or skipping it, and then completing the onboarding flow.
84+
*/
7885
export default function SetupPaidAds() {
7986
const adminUrl = useAdminUrl();
8087
const { createNotice } = useDispatchCoreNotices();
@@ -115,16 +122,16 @@ export default function SetupPaidAds() {
115122
// The status check of Google Ads account connection is included in `campaign.isValid`,
116123
// because when there is no connected account, it will disable the budget section and set the `amount` to `undefined`.
117124
// TODO: Add a condition to check Billing setup
118-
const disabledComplete = completing === 'skip-ads' || ! campaign.isValid;
125+
const disabledComplete = completing === ACTION_SKIP || ! campaign.isValid;
119126

120127
function createSkipButton( text ) {
121128
return (
122129
<AppButton
123130
isTertiary
124131
data-action="skip-ads"
125132
text={ text }
126-
loading={ completing === 'skip-ads' }
127-
disabled={ completing === 'complete-ads' }
133+
loading={ completing === ACTION_SKIP }
134+
disabled={ completing === ACTION_COMPLETE }
128135
onClick={ finishFreeListingsSetup }
129136
/>
130137
);
@@ -155,7 +162,7 @@ export default function SetupPaidAds() {
155162
'Create a paid ad campaign',
156163
'google-listings-and-ads'
157164
) }
158-
disabled={ completing === 'skip-ads' }
165+
disabled={ completing === ACTION_SKIP }
159166
onClick={ () => setShowPaidAdsSetup( true ) }
160167
/>
161168
}
@@ -179,7 +186,7 @@ export default function SetupPaidAds() {
179186
'Complete setup',
180187
'google-listings-and-ads'
181188
) }
182-
loading={ completing === 'complete-ads' }
189+
loading={ completing === ACTION_COMPLETE }
183190
disabled={ disabledComplete }
184191
onClick={ handleCompleteClick }
185192
/>

0 commit comments

Comments
 (0)