/** * Wishlist section — the configuration behind the Wishlist module. * * Which surfaces show the heart (shop cards, single product), how each one * looks, and the resting/saved colours. Writes into `woocommerce.wishlist`, the * tree the Wishlist PHP module reads; the master `enabled` flag it lives under * is owned by the Modules-page card, which is also what makes this section * appear in the nav. * * Lived inside the WooCommerce workspace as a fifth "view" until the Modules * platform gave it a home of its own. The controls are unchanged, so no stored * setting moved. * * Everything renders as one page — Shop Cards, Single Product and Appearance * are stacked groups under their own headings, not tabs: each is only a * handful of fields. Each surface's switch leads a card, with the choice it * reveals drawn as picture cards (see fields.tsx). */ import { __ } from '@wordpress/i18n'; import { useEffect } from '@wordpress/element'; import { Heart, Lightbulb } from 'lucide-react'; import ColorOverrideField from '../../controls/color-override-field'; import InfoNote from '../../controls/info-note'; import { PictureChoice, PositionPreview, StylePreview, SwitchCard, WishlistGroup, type WishlistSchema, } from './fields'; import type { WorkingSettings, SetPath } from '../../types'; import SectionIntro from '../../controls/section-intro'; interface WishlistSectionProps { schema?: WishlistSchema; working: WorkingSettings; setPath: SetPath; /** Notify the shell which view is active, so the preview can follow. */ onViewChange?: ( context: string ) => void; } export default function WishlistSection( { schema, working, setPath, onViewChange, }: WishlistSectionProps ) { // The wishlist has no page of its own — its controls affect the shop loop // and the single product — so preview against the shop, where the loop // heart is visible. useEffect( () => { onViewChange?.( 'shop' ); }, [ onViewChange ] ); if ( ! schema ) { return null; } const woo = ( working?.woocommerce ?? {} ) as Record< string, any >; const wishlist = ( woo.wishlist ?? {} ) as Record< string, any >; // The heart's inherited colors — the wishlist CSS vars fall back to the Text // and Primary palette colors (see woocommerce.scss), so an unset override // shows the global value rather than a blank swatch. const palette = ( working?.design?.colors ?? {} ) as Record< string, string >; return (

{ __( 'Wishlist', 'aureon' ) }

{ __( 'The add-to-wishlist heart on product cards and the single product page.', 'aureon' ) }

{ ! schema.wishlist_enabled && ( { __( 'The wishlist needs WooCommerce’s built-in “Wishlist” feature turned on. Enable it under WooCommerce → Settings → Advanced → Features, then these options take effect.', 'aureon' ) } ) } setPath( 'woocommerce.wishlist.loop', checked ) } > setPath( 'woocommerce.wishlist.loop_position', value ) } renderPreview={ ( value ) => ( ) } /> setPath( 'woocommerce.wishlist.single', checked ) } > setPath( 'woocommerce.wishlist.single_style', value ) } renderPreview={ ( value ) => ( ) } />
setPath( 'woocommerce.wishlist.icon_color', value ) } /> setPath( 'woocommerce.wishlist.active_color', value ) } />

{ __( 'Tip', 'aureon' ) }

{ __( 'The wishlist uses theme colours by default. You can override them here or leave them on the global colour.', 'aureon' ) }

); }