smash nav bugs
This commit is contained in:
parent
63e751a3a2
commit
f81321be4c
|
@ -8,6 +8,10 @@ export const Content = ( { data } ) => {
|
||||||
|
|
||||||
console.log( settings );
|
console.log( settings );
|
||||||
|
|
||||||
|
if ( ! settings ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{ settings.map( ( setting, idx ) => {
|
{ settings.map( ( setting, idx ) => {
|
||||||
|
|
|
@ -18,12 +18,13 @@ import './style.scss';
|
||||||
|
|
||||||
const Settings = ( { params } ) => {
|
const Settings = ( { params } ) => {
|
||||||
const settingsData = window.wcSettings?.admin?.settingsPages;
|
const settingsData = window.wcSettings?.admin?.settingsPages;
|
||||||
const { section } = getQuery();
|
|
||||||
|
|
||||||
|
// Be sure to render Settings slots when the params change.
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
possiblyRenderSettingsSlots();
|
possiblyRenderSettingsSlots();
|
||||||
}, [ params ] );
|
}, [ params ] );
|
||||||
|
|
||||||
|
// Register the slot fills for the settings page just once.
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
registerTaxSettingsConflictErrorFill();
|
registerTaxSettingsConflictErrorFill();
|
||||||
registerPaymentsSettingsBannerFill();
|
registerPaymentsSettingsBannerFill();
|
||||||
|
@ -34,6 +35,13 @@ const Settings = ( { params } ) => {
|
||||||
return <div>Error getting data</div>;
|
return <div>Error getting data</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { section } = getQuery();
|
||||||
|
const sections = settingsData[ params.page ]?.sections;
|
||||||
|
const contentData =
|
||||||
|
Array.isArray( sections ) && sections.length === 0
|
||||||
|
? {}
|
||||||
|
: sections[ section || '' ];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tabs data={ settingsData } page={ params.page }>
|
<Tabs data={ settingsData } page={ params.page }>
|
||||||
|
@ -45,13 +53,7 @@ const Settings = ( { params } ) => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="woocommerce-settings-content">
|
<div className="woocommerce-settings-content">
|
||||||
<Content
|
<Content data={ contentData } />
|
||||||
data={
|
|
||||||
settingsData[ params.page ].sections[
|
|
||||||
section || ''
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { getNewPath, navigateTo } from '@woocommerce/navigation';
|
||||||
|
|
||||||
export const Tabs = ( { data, page, children } ) => {
|
export const Tabs = ( { data, page, children } ) => {
|
||||||
const onSelect = ( tabName ) => {
|
const onSelect = ( tabName ) => {
|
||||||
const url = getNewPath( {}, `/settings/${ tabName }` );
|
const url = getNewPath( {}, `/settings/${ tabName }`, {} );
|
||||||
navigateTo( { url } );
|
navigateTo( { url } );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue