Skip to content

Commit

Permalink
Add copies for incoming Staging Site Syncing for WooCommerce project. (
Browse files Browse the repository at this point in the history
  • Loading branch information
andregardi authored Aug 29, 2024
1 parent ffa0ca1 commit 8553b2a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import config from '@automattic/calypso-config';
import { Button } from '@automattic/components';
import { useHasEnTranslation } from '@automattic/i18n-utils';
import { useTranslate } from 'i18n-calypso';
Expand All @@ -19,6 +20,7 @@ export const NewStagingSiteCardContent = ( {
{
const translate = useTranslate();
const hasEnTranslation = useHasEnTranslation();
const stagingSiteSyncWoo = config.isEnabled( 'staging-site-sync-woo' );

return (
<>
Expand Down Expand Up @@ -47,6 +49,23 @@ export const NewStagingSiteCardContent = ( {
}
) }
</HostingCardDescription>
{ stagingSiteSyncWoo && (
<div>
<p>{ translate( 'WooCommerce Site' ) }</p>
<p>
{ translate(
'Syncing staging database to production overwrites posts, pages, products and orders. {{a}}Learn more{{/a}}.',
{
components: {
a: (
<InlineSupportLink supportContext="hosting-staging-site" showIcon={ false } />
),
},
}
) }
</p>
</div>
) }
<Button primary disabled={ isButtonDisabled } onClick={ onAddClick }>
<span>{ translate( 'Add staging site' ) }</span>
</Button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import config from '@automattic/calypso-config';
import { FormLabel } from '@automattic/components';
import styled from '@emotion/styled';
import { translate, useTranslate } from 'i18n-calypso';
Expand Down Expand Up @@ -206,6 +207,9 @@ const StagingToProductionSync = ( {
],
[ translate ]
);

const stagingSiteSyncWoo = config.isEnabled( 'staging-site-sync-woo' );

return (
<>
{ showSyncPanel && (
Expand Down Expand Up @@ -239,6 +243,16 @@ const StagingToProductionSync = ( {
return <li key={ item.name }>{ item.label }</li>;
} ) }
</ConfirmationModalList>
{ stagingSiteSyncWoo && (
<div>
<p>{ translate( 'Warning' ) }</p>
<p>
{ translate(
'We do not recommend syncing or pushing data from a staging site to live production news sites or sites that use eCommerce plugins, such as WooCommerce, without proper planning and testing. Keep in mind that data on the destination site could have newer transactions, such as customers and orders, and would be lost when overwritten by the staging site’s data.'
) }
</p>
</div>
) }
<ConfirmationModalInputTitle>
{ translate( "Enter your site's name {{span}}%(siteSlug)s{{/span}} to confirm.", {
args: {
Expand Down
21 changes: 21 additions & 0 deletions client/my-sites/hosting/staging-site-card/sync-options-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import config from '@automattic/calypso-config';
import styled from '@emotion/styled';
import { ToggleControl } from '@wordpress/components';
import { translate } from 'i18n-calypso';
import { useState, useEffect, useMemo } from 'react';
import InlineSupportLink from 'calypso/components/inline-support-link';

const DangerousItemsContainer = styled.div( {
marginTop: '16px',
Expand Down Expand Up @@ -138,6 +140,8 @@ export default function SyncOptionsPanel( {
onChange( selectedItems );
}, [ optionItemsMap, onChange ] );

const stagingSiteSyncWoo = config.isEnabled( 'staging-site-sync-woo' );

return (
<>
{ nonDangerousItems.map( ( item ) => {
Expand Down Expand Up @@ -185,6 +189,23 @@ export default function SyncOptionsPanel( {
</div>
);
} ) }
{ stagingSiteSyncWoo && (
<div>
<p>
{ translate(
'This site has WooCommerce installed. All orders in the production database will be overwritten. {{a}}Learn more{{/a}}.',
{
components: {
a: (
<InlineSupportLink supportContext="hosting-staging-site" showIcon={ false } />
),
},
}
) }
</p>
<p>{ translate( 'Confirm I want to proceed with database synchronization ' ) }</p>
</div>
) }
</DangerousItemsContainer>
</>
);
Expand Down

0 comments on commit 8553b2a

Please sign in to comment.