Skip to content

Commit

Permalink
Save WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
asvinb committed Oct 31, 2024
1 parent 9f335dd commit 3c19aa9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ const ClaimAdsAccount = () => {
setUpdating( true );
};

if ( ! shouldClaimGoogleAdsAccount ) {
return null;
}

return (
<Section.Card.Body className="gla-claim-ads-account-section">
<div className="gla-claim-ads-account-box">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const ConnectAds = () => {
await upsertAdsAccount();
};

console.log( accounts, googleAdsAccount, isConnected );

Check failure on line 60 in js/src/components/google-combo-account-card/connect-ads/connect-ads.js

View workflow job for this annotation

GitHub Actions / Lint JavaScript

[no-console] Unexpected console statement.
useEffect( () => {
if ( isConnected ) {
setValue( googleAdsAccount.id );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import useGoogleAdsAccountReady from '.~/hooks/useGoogleAdsAccountReady';

/**
* Renders the actionable components for connected accounts.
* @param {Object} props Component props.
* @param {boolean} props.claimGoogleAdsAccount Whether the user should claim the Google Ads account.
* @return {JSX.Element} Connected accounts actions.
*/
const ConnectedAccountsActions = () => {
const ConnectedAccountsActions = ( { claimGoogleAdsAccount } ) => {
const isReady = useGoogleAdsAccountReady();

return (
<div className="gla-connected-accounts-actions">
<ClaimAdsAccount />
{ claimGoogleAdsAccount && <ClaimAdsAccount /> }

{ isReady && (
<AppNotice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const ConnectedGoogleComboAccountCard = () => {
);
const hasExistingGoogleAdsAccounts = existingGoogleAdsAccounts?.length > 0;
const showConnectAds =
( editMode && hasExistingGoogleAdsAccounts ) ||
( ! isConnected && hasExistingGoogleAdsAccounts ) ||
( ( editMode && hasExistingGoogleAdsAccounts ) ||
( ! isConnected && hasExistingGoogleAdsAccounts ) ) &&
! shouldClaimGoogleAdsAccount;

return (
Expand All @@ -55,7 +55,9 @@ const ConnectedGoogleComboAccountCard = () => {
<Indicator showSpinner={ Boolean( creatingWhich ) } />
}
>
<ConnectedAccountsActions />
<ConnectedAccountsActions
claimGoogleAdsAccount={ shouldClaimGoogleAdsAccount }
/>
</AccountCard>

{ showConnectAds && <ConnectAds /> }
Expand Down
1 change: 1 addition & 0 deletions js/src/hooks/useAutoCreateAdsMCAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const useShouldCreateAdsAccount = () => {
hasFinishedResolution: hasResolvedExistingAccounts,
existingAccounts: accounts,
} = useExistingGoogleAdsAccounts();
console.log( accounts, hasConnection );

Check failure on line 31 in js/src/hooks/useAutoCreateAdsMCAccounts.js

View workflow job for this annotation

GitHub Actions / Lint JavaScript

[no-console] Unexpected console statement.

// Return null if the account hasn't been resolved or the existing accounts haven't been resolved
if ( ! hasResolvedAccount || ! hasResolvedExistingAccounts ) {
Expand Down

0 comments on commit 3c19aa9

Please sign in to comment.