From 3c31297e10d6c68d7182ed10a8977bfa1643ca0e Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Mon, 28 Oct 2024 15:44:27 +0100
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20New=20utility=20method=20to=20deter?=
=?UTF-8?q?mine=20visible=20tabs?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../js/Components/Screens/Settings.js | 2 +
.../resources/js/Components/Screens/tabs.js | 42 +++++++++++++++++++
2 files changed, 44 insertions(+)
create mode 100644 modules/ppcp-settings/resources/js/Components/Screens/tabs.js
diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Settings.js b/modules/ppcp-settings/resources/js/Components/Screens/Settings.js
index ee112096d..9bbf41bb7 100644
--- a/modules/ppcp-settings/resources/js/Components/Screens/Settings.js
+++ b/modules/ppcp-settings/resources/js/Components/Screens/Settings.js
@@ -1,9 +1,11 @@
import Onboarding from './Onboarding/Onboarding';
import { useState } from '@wordpress/element';
import Dashboard from './Dashboard/Dashboard';
+import { getSettingsTabs } from './tabs';
const Settings = () => {
const [ onboarded, setOnboarded ] = useState( true );
+ const tabs = getSettingsTabs();
return <>{ onboarded ? : }>;
};
diff --git a/modules/ppcp-settings/resources/js/Components/Screens/tabs.js b/modules/ppcp-settings/resources/js/Components/Screens/tabs.js
new file mode 100644
index 000000000..dea1869d1
--- /dev/null
+++ b/modules/ppcp-settings/resources/js/Components/Screens/tabs.js
@@ -0,0 +1,42 @@
+import { __ } from '@wordpress/i18n';
+import Dashboard from './Dashboard/Dashboard';
+import Onboarding from './Onboarding/Onboarding';
+
+export const getSettingsTabs = () => {
+ const tabs = [];
+
+ // TODO: Use the store to find out if onboarding is complete
+
+ if ( 0 ) {
+ tabs.push( {
+ name: 'onboarding',
+ component: ,
+ } );
+ }
+
+ if ( 1 ) {
+ tabs.push( {
+ name: 'dashboard',
+ title: __( 'Dashboard', 'woocommerce-paypal-payments' ),
+ component: ,
+ } );
+
+ tabs.push( {
+ name: 'payment-methods',
+ title: __( 'Payment Methods', 'woocommerce-paypal-payments' ),
+ component: ,
+ } );
+
+ tabs.push( {
+ name: 'settings',
+ title: __( 'Settings', 'woocommerce-paypal-payments' ),
+ } );
+
+ tabs.push( {
+ name: 'styling',
+ title: __( 'Styling', 'woocommerce-paypal-payments' ),
+ } );
+ }
+
+ return tabs;
+};