/** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; import { useBlockProps, InspectorControls } from '@wordpress/block-editor'; import { SelectControl, ToggleControl, PanelBody } from '@wordpress/components'; /** * Styles */ import './editor.scss'; /** * Edit function for Directory List Block */ export default function Edit({ attributes, setAttributes }) { const blockProps = useBlockProps(); // Access the localized list types from the global window object const listTypeOptions = window.jvbListTypes ? window.jvbListTypes.map(type => { return { label: type.title, value: type.slug }; }) : []; // Find the selected list type details const selectedType = window.jvbListTypes ? window.jvbListTypes.find(type => type.slug === attributes.listType) || {} : {}; return (
{__('Selected List Type:', 'jvb')} {selectedType.title}
{__('Type:', 'jvb')} {selectedType.type}
{selectedType.links && ({__('Links:', 'jvb')} {selectedType.links.join(', ')}
)}{__('Cache Status:', 'jvb')} {attributes.refreshCache ? __('Will refresh on load', 'jvb') : __('Using cached data', 'jvb')}
{__('This alphabetical list will be rendered on the frontend.', 'jvb')}