Changed `Tabs` to use `useQuery` instead of `getQuery`, so the browser back button will work.
Changed submenu item name back to `Extensions`, and keeping it in the current order within the WooCommerce menu. Changed `path` value to `extensions`.
This commit is contained in:
parent
a2b878e8e7
commit
30e23d22d5
|
@ -182,10 +182,10 @@ export const getPages = () => {
|
|||
layout: {
|
||||
header: false,
|
||||
},
|
||||
path: '/marketplace',
|
||||
path: '/extensions',
|
||||
breadcrumbs: [
|
||||
[ '/marketplace', __( 'Marketplace', 'woocommerce' ) ],
|
||||
__( 'Marketplace', 'woocommerce' ),
|
||||
[ '/extensions', __( 'Extensions', 'woocommerce' ) ],
|
||||
__( 'Extensions', 'woocommerce' ),
|
||||
],
|
||||
wpOpenMenu: 'toplevel_page_woocommerce',
|
||||
capability: 'manage_woocommerce',
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export const DEFAULT_TAB_KEY = 'discover';
|
||||
export const MARKETPLACE_PATH = '/marketplace';
|
||||
export const MARKETPLACE_PATH = '/extensions';
|
||||
|
|
|
@ -5,7 +5,7 @@ import { __ } from '@wordpress/i18n';
|
|||
import { useEffect } from '@wordpress/element';
|
||||
import { Button } from '@wordpress/components';
|
||||
import classNames from 'classnames';
|
||||
import { getQuery, getNewPath, navigateTo } from '@woocommerce/navigation';
|
||||
import { getNewPath, navigateTo, useQuery } from '@woocommerce/navigation';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -80,16 +80,15 @@ const Tabs = ( props: TabsProps ): JSX.Element => {
|
|||
tab?: string;
|
||||
}
|
||||
|
||||
useEffect( () => {
|
||||
const query: Query = getQuery();
|
||||
const query: Query = useQuery();
|
||||
|
||||
useEffect( () => {
|
||||
if ( query?.tab && tabs[ query.tab ] ) {
|
||||
setSelectedTab( query.tab );
|
||||
return;
|
||||
} else {
|
||||
setSelectedTab( DEFAULT_TAB_KEY );
|
||||
}
|
||||
|
||||
setSelectedTab( DEFAULT_TAB_KEY );
|
||||
}, [ setSelectedTab ] );
|
||||
}, [ query, setSelectedTab ] );
|
||||
|
||||
return (
|
||||
<nav className="woocommerce-marketplace__tabs">
|
||||
|
|
|
@ -16,7 +16,7 @@ class Marketplace {
|
|||
* Class initialization, to be executed when the class is resolved by the container.
|
||||
*/
|
||||
final public function init() {
|
||||
add_action( 'admin_menu', array( $this, 'register_pages' ), 45 );
|
||||
add_action( 'admin_menu', array( $this, 'register_pages' ), 70 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,8 +39,8 @@ class Marketplace {
|
|||
array(
|
||||
'id' => 'woocommerce-marketplace',
|
||||
'parent' => 'woocommerce',
|
||||
'title' => __( 'Marketplace', 'woocommerce' ),
|
||||
'path' => '/marketplace',
|
||||
'title' => __( 'Extensions', 'woocommerce' ),
|
||||
'path' => '/extensions',
|
||||
),
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue