/** * External dependencies */ import { getQuery, getNewPath } from '@woocommerce/navigation'; import { Button } from '@wordpress/components'; import { Icon, chevronLeft } from '@wordpress/icons'; import { useEffect, createContext, useState } from '@wordpress/element'; /** * Internal dependencies */ import { Tabs } from './tabs'; import { SectionNav } from './section-nav'; import { Content } from './content'; import { possiblyRenderSettingsSlots } from './settings-slots'; import { registerTaxSettingsConflictErrorFill } from './conflict-error-slotfill'; import { registerPaymentsSettingsBannerFill } from '../payments/payments-settings-banner-slotfill'; import { registerSiteVisibilitySlotFill } from '../launch-your-store'; import { registerExampleSettingsView } from './settings-view-example'; import { useFullScreen } from '~/utils'; import { SidebarContext } from './components/side-bar'; import './style.scss'; const Settings = ( { params } ) => { useFullScreen( [ 'woocommerce-settings' ] ); const settingsData = window.wcSettings?.admin?.settingsPages; const sections = settingsData[ params.page ]?.sections; const { section } = getQuery(); const contentData = Array.isArray( sections ) && sections.length === 0 ? {} : sections[ section || '' ]; const [ hasSideBar, setHasSideBar ] = useState( false ); // Be sure to render Settings slots when the params change. useEffect( () => { possiblyRenderSettingsSlots(); }, [ params.page, section ] ); // Register the slot fills for the settings page just once. useEffect( () => { registerTaxSettingsConflictErrorFill(); registerPaymentsSettingsBannerFill(); registerSiteVisibilitySlotFill(); registerExampleSettingsView(); }, [] ); if ( ! settingsData ) { return
Error getting data
; } const title = settingsData[ params.page ]?.label; return ( <>

{ title }

); }; export default Settings;