/**
* 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 (
{ __(
'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'
) }
{ __( 'No modules are registered.', 'aureon' ) }
{ __( 'Modules', 'aureon' ) }
{ module.description }