woocommerce/plugins/woocommerce-admin/client/settings-payments/index.tsx

52 lines
1.2 KiB
TypeScript
Raw Normal View History

/**
* External dependencies
*/
import { lazy, Suspense } from '@wordpress/element';
const SettingsPaymentsMainChunk = lazy(
() =>
import(
/* webpackChunkName: "settings-payments-main" */ './settings-payments-main'
)
);
add: render react placeholders for offline and woocommerce_payments settings sections (#50008) * Added a whitelist of sections to render an alternative output in the WC_Settings_Payment_Gateways_React class. * Renamed constant and updated its contents to only include 'offline' * Added a branch in the `output()` method to output an appropriate div with an id if the current section is in the whitelist. * Added "experimental" prefix to payment settings div ID. * Replicated the render for the offline section similar to the main payments settings. * Added a new settings-payments-offline screen to the WooCommerce admin plugin. * Implemented new offline settings page component. * Removed the ErrorBoundary components from the SettingsPaymentsMainWrapper and SettingsPaymentsOfflineWrapper. * Added a new SettingsPaymentsOfflineWrapper component and its corresponding SCSS styles. * Implemented the WooCommerce Payments section in the settings page. * Removed WooCommerce Payments settings logic and replaced with a placeholder. * Added a placeholder for the offline payments screen. * Added 'main' to the REACTIFY_RENDER_SECTIONS array and refactored the output method to improve readability and maintainability. * Renamed `render_gateway_section` method to `render_classic_gateway_settings_page` in the `class-wc-settings-payment-gateways-react.php` file. * Added a filter for the REACTIFY_RENDER_SECTIONS so that plugins can modify this list. * Added inline documentation for the filter in the `get_reactify_render_sections` method. * changelog * Matched the CSS styles for the WooCommerce Payments section to the offline section. * Removed unnecessary Card component and placeholder text from WooCommerce Payments settings. * Linted the `class-wc-settings-payment-gateways-react.php` file, addressing the reported linting issues. * Refactored the payment settings UI to use React components and lazy loading. * lint * Nit: Removed unnecessary comment and moved a small code * Update name to experimental * Fix save button missing from section pages * Fix saving sections --------- Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2024-07-26 12:55:19 +00:00
const SettingsPaymentsOfflineChunk = lazy(
() =>
import(
/* webpackChunkName: "settings-payments-offline" */ './settings-payments-offline'
)
);
const SettingsPaymentsWooCommercePaymentsChunk = lazy(
() =>
import(
/* webpackChunkName: "settings-payments-woocommerce-payments" */ './settings-payments-woocommerce-payments'
)
);
export const SettingsPaymentsMainWrapper: React.FC = () => {
return (
add: render react placeholders for offline and woocommerce_payments settings sections (#50008) * Added a whitelist of sections to render an alternative output in the WC_Settings_Payment_Gateways_React class. * Renamed constant and updated its contents to only include 'offline' * Added a branch in the `output()` method to output an appropriate div with an id if the current section is in the whitelist. * Added "experimental" prefix to payment settings div ID. * Replicated the render for the offline section similar to the main payments settings. * Added a new settings-payments-offline screen to the WooCommerce admin plugin. * Implemented new offline settings page component. * Removed the ErrorBoundary components from the SettingsPaymentsMainWrapper and SettingsPaymentsOfflineWrapper. * Added a new SettingsPaymentsOfflineWrapper component and its corresponding SCSS styles. * Implemented the WooCommerce Payments section in the settings page. * Removed WooCommerce Payments settings logic and replaced with a placeholder. * Added a placeholder for the offline payments screen. * Added 'main' to the REACTIFY_RENDER_SECTIONS array and refactored the output method to improve readability and maintainability. * Renamed `render_gateway_section` method to `render_classic_gateway_settings_page` in the `class-wc-settings-payment-gateways-react.php` file. * Added a filter for the REACTIFY_RENDER_SECTIONS so that plugins can modify this list. * Added inline documentation for the filter in the `get_reactify_render_sections` method. * changelog * Matched the CSS styles for the WooCommerce Payments section to the offline section. * Removed unnecessary Card component and placeholder text from WooCommerce Payments settings. * Linted the `class-wc-settings-payment-gateways-react.php` file, addressing the reported linting issues. * Refactored the payment settings UI to use React components and lazy loading. * lint * Nit: Removed unnecessary comment and moved a small code * Update name to experimental * Fix save button missing from section pages * Fix saving sections --------- Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2024-07-26 12:55:19 +00:00
<Suspense fallback={ <div>Loading main settings...</div> }>
<SettingsPaymentsMainChunk />
</Suspense>
);
};
add: render react placeholders for offline and woocommerce_payments settings sections (#50008) * Added a whitelist of sections to render an alternative output in the WC_Settings_Payment_Gateways_React class. * Renamed constant and updated its contents to only include 'offline' * Added a branch in the `output()` method to output an appropriate div with an id if the current section is in the whitelist. * Added "experimental" prefix to payment settings div ID. * Replicated the render for the offline section similar to the main payments settings. * Added a new settings-payments-offline screen to the WooCommerce admin plugin. * Implemented new offline settings page component. * Removed the ErrorBoundary components from the SettingsPaymentsMainWrapper and SettingsPaymentsOfflineWrapper. * Added a new SettingsPaymentsOfflineWrapper component and its corresponding SCSS styles. * Implemented the WooCommerce Payments section in the settings page. * Removed WooCommerce Payments settings logic and replaced with a placeholder. * Added a placeholder for the offline payments screen. * Added 'main' to the REACTIFY_RENDER_SECTIONS array and refactored the output method to improve readability and maintainability. * Renamed `render_gateway_section` method to `render_classic_gateway_settings_page` in the `class-wc-settings-payment-gateways-react.php` file. * Added a filter for the REACTIFY_RENDER_SECTIONS so that plugins can modify this list. * Added inline documentation for the filter in the `get_reactify_render_sections` method. * changelog * Matched the CSS styles for the WooCommerce Payments section to the offline section. * Removed unnecessary Card component and placeholder text from WooCommerce Payments settings. * Linted the `class-wc-settings-payment-gateways-react.php` file, addressing the reported linting issues. * Refactored the payment settings UI to use React components and lazy loading. * lint * Nit: Removed unnecessary comment and moved a small code * Update name to experimental * Fix save button missing from section pages * Fix saving sections --------- Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2024-07-26 12:55:19 +00:00
export const SettingsPaymentsOfflineWrapper: React.FC = () => {
return (
<Suspense fallback={ <div>Loading offline settings...</div> }>
<SettingsPaymentsOfflineChunk />
</Suspense>
);
};
export const SettingsPaymentsWooCommercePaymentsWrapper: React.FC = () => {
return (
<Suspense
fallback={ <div>Loading WooCommerce Payments settings...</div> }
>
<SettingsPaymentsWooCommercePaymentsChunk />
</Suspense>
);
};