/** * Modules area β€” the feature registry. * * One card per registered feature module (built from window.aureonAdmin.modules, * so a newly registered module appears with no React edit). Each card wraps a * master on/off toggle bound to the module's `enabledPath`; once on, a * "Configure β†’" link in the card's footer jumps to the module's settings. */ import { __ } from '@wordpress/i18n'; import { FormToggle } from '@wordpress/components'; import { LayoutGrid, ArrowRight } from 'lucide-react'; import moduleIcon from '../module-icons'; import Badge from '../badge'; import type { FeatureModule, SetPath, WorkingSettings } from '../types'; import SectionIntro from '../controls/section-intro'; interface ModulesAreaProps { modules: FeatureModule[]; working: WorkingSettings; setPath: SetPath; onConfigure: ( sectionKey: string ) => void; } const readBool = ( source: unknown, path: string ): boolean => { const value = path .split( '.' ) .reduce< unknown >( ( ref, key ) => ref && 'object' === typeof ref ? ( ref as Record< string, unknown > )[ key ] : undefined, source ); return !! value; }; export default function ModulesArea( { modules, working, setPath, onConfigure, }: ModulesAreaProps ) { return (

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

{ __( 'Turn theme features on or off. Each module is just a switch β€” its settings live in their own section once it’s enabled, and only enabled modules load any code.', 'aureon' ) }

{ 0 === modules.length ? (

{ __( 'No modules are registered.', 'aureon' ) }

) : (
{ modules.map( ( module ) => ( ) ) }
) }
); } function ModuleIcon( { name }: { name: string } ) { const Icon = moduleIcon( name ); return ; } function ModuleCard( { module, enabled, setPath, onConfigure, }: { module: FeatureModule; enabled: boolean; setPath: SetPath; onConfigure: ( sectionKey: string ) => void; } ) { const toggleId = `aureon-module-toggle-${ module.id }`; const descId = `${ toggleId }-desc`; return (
setPath( module.enabledPath, e.target.checked ) } />

{ module.description }

{ enabled ? __( 'Active', 'aureon' ) : __( 'Inactive', 'aureon' ) } { enabled && module.sectionKey && ( ) }
); }