💄 For send-only country: Hide Save, add CTA

This commit is contained in:
Philipp Stracker 2025-01-28 10:22:42 +01:00
parent 609fe0fd59
commit b9282b510c
No known key found for this signature in database
2 changed files with 21 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import { __, sprintf } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
import Container from '../ReusableComponents/Container';
import SettingsCard from '../ReusableComponents/SettingsCard';
@ -9,7 +10,7 @@ const SendOnlyMessage = () => {
return (
<>
<SettingsNavigation />
<SettingsNavigation canSave={ false } />
<Container page="settings">
<SettingsCard
title={ __(
@ -45,6 +46,19 @@ const SendOnlyMessage = () => {
),
} }
/>
<div>
<Button
href={ settingsPageUrl }
variant="primary"
className="small-button"
>
{ __(
'Go to WooCommerce settings',
'woocommerce-paypal-payments'
) }
</Button>
</div>
</SettingsCard>
</Container>
</>

View file

@ -4,16 +4,18 @@ import { __ } from '@wordpress/i18n';
import TopNavigation from '../../../ReusableComponents/TopNavigation';
import { useSaveSettings } from '../../../../hooks/useSaveSettings';
const SettingsNavigation = () => {
const SettingsNavigation = ( { canSave = true } ) => {
const { persistAll } = useSaveSettings();
const title = __( 'PayPal Payments', 'woocommerce-paypal-payments' );
return (
<TopNavigation title={ title } exitOnTitleClick={ true }>
<Button variant="primary" onClick={ persistAll }>
{ __( 'Save', 'woocommerce-paypal-payments' ) }
</Button>
{ canSave && (
<Button variant="primary" onClick={ persistAll }>
{ __( 'Save', 'woocommerce-paypal-payments' ) }
</Button>
) }
</TopNavigation>
);
};