/** * Product Catalog — one of WooCommerce's four store views (see `../index.tsx` * for the top-level hub). Its own two tabs (General / Product Card) are two * views of the same settings, not separate topics — same call as Buttons' * own Settings/Style split — so both render inline behind one segmented * toggle (see Tabs' `segmented` variant) rather than each drilling into a * `WP_Customize_Section` of its own. That's true on both hosts: the * Customizer mounts this whole component into one section (WooCommerce's own * "Product Catalog", merged via `Customizer::WOOCOMMERCE_CORE_SECTION_MERGE`) * same as the standalone admin page mounts it inline. */ import { __ } from '@wordpress/i18n'; import { useEffect, useState } from '@wordpress/element'; import { ShoppingBag } from '../../../icons'; import Tabs, { TabPanel } from '../../../controls/tabs'; import type { WorkingSettings, SetPath, SectionExtra } from '../../../types'; import type { WooSchema, Option } from '../types'; import { SHOP_TABS } from '../constants'; import { GeneralFields, CardFields } from './fields'; import SectionIntro from '../../../controls/section-intro'; const ID_PREFIX = 'aureon-woocommerce-shop'; interface ShopSectionProps { schema: WooSchema; layoutSchema?: { sidebars?: Option[] }; working: WorkingSettings; setPath: SetPath; extras?: SectionExtra[]; onViewChange?: ( context: string ) => void; /** * The top WooCommerce hub already shows a "← Product Catalog" mini-header * (via its own `Tabs` back button) when it embeds this inline for the * standalone page — a second icon+title block here would duplicate it. * Only the section's own real Customizer mount (`aureon_woocommerce_ * shop`) needs this header, since it has no such outer wrapper. */ showHeader?: boolean; } export default function ShopSection( { schema, layoutSchema, working, setPath, extras, onViewChange, showHeader = true, }: ShopSectionProps ) { useEffect( () => { onViewChange?.( 'shop' ); }, [ onViewChange ] ); const [ activeTab, setActiveTab ] = useState( 'general' ); return (
{ showHeader && (

{ __( 'Product Catalog', 'aureon' ) }

{ __( 'The shop and product category/tag grids.', 'aureon' ) }

) }
); }