mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
✨ New utility method to determine visible tabs
This commit is contained in:
parent
80d58851af
commit
3c31297e10
2 changed files with 44 additions and 0 deletions
|
@ -1,9 +1,11 @@
|
||||||
import Onboarding from './Onboarding/Onboarding';
|
import Onboarding from './Onboarding/Onboarding';
|
||||||
import { useState } from '@wordpress/element';
|
import { useState } from '@wordpress/element';
|
||||||
import Dashboard from './Dashboard/Dashboard';
|
import Dashboard from './Dashboard/Dashboard';
|
||||||
|
import { getSettingsTabs } from './tabs';
|
||||||
|
|
||||||
const Settings = () => {
|
const Settings = () => {
|
||||||
const [ onboarded, setOnboarded ] = useState( true );
|
const [ onboarded, setOnboarded ] = useState( true );
|
||||||
|
const tabs = getSettingsTabs();
|
||||||
|
|
||||||
return <>{ onboarded ? <Onboarding /> : <Dashboard /> }</>;
|
return <>{ onboarded ? <Onboarding /> : <Dashboard /> }</>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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: <Onboarding />,
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 1 ) {
|
||||||
|
tabs.push( {
|
||||||
|
name: 'dashboard',
|
||||||
|
title: __( 'Dashboard', 'woocommerce-paypal-payments' ),
|
||||||
|
component: <Dashboard />,
|
||||||
|
} );
|
||||||
|
|
||||||
|
tabs.push( {
|
||||||
|
name: 'payment-methods',
|
||||||
|
title: __( 'Payment Methods', 'woocommerce-paypal-payments' ),
|
||||||
|
component: <Dashboard />,
|
||||||
|
} );
|
||||||
|
|
||||||
|
tabs.push( {
|
||||||
|
name: 'settings',
|
||||||
|
title: __( 'Settings', 'woocommerce-paypal-payments' ),
|
||||||
|
} );
|
||||||
|
|
||||||
|
tabs.push( {
|
||||||
|
name: 'styling',
|
||||||
|
title: __( 'Styling', 'woocommerce-paypal-payments' ),
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
return tabs;
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue