import {
createElement,
useState,
useContext,
Fragment,
} from '@wordpress/element'
import cls from 'classnames'
import {
Panel,
PanelMetaWrapper,
PlacementsDragDropContext,
getValueFromInput,
} from 'blocksy-options'
import { applyFilters } from '@wordpress/hooks'
import { Slot } from '@wordpress/components'
import { __ } from 'ct-i18n'
import EditConditions from './EditConditions'
import { Overlay } from 'blocksy-options'
const PanelsManager = () => {
const [isRemovingSection, setIsRemovingSection] = useState(false)
const secondaryItems =
ct_customizer_localizations.header_builder_data.secondary_items.header
const allItems = ct_customizer_localizations.header_builder_data.header
const {
builderValueDispatch,
builderValue,
option,
builderValueCollection,
panelsActions,
} = useContext(PlacementsDragDropContext)
const allSections =
applyFilters(
'blocksy.header.available-sections',
null,
builderValueCollection.sections
) ||
builderValueCollection.sections.filter(
({ id }) =>
id !== 'type-2' &&
id !== 'type-3' &&
id.indexOf('ct-custom') === -1
)
return (
{__(
'You are about to remove a custom header, are you sure you want to continue?',
'blocksy-companion'
)}
{allSections.map(({ name, id }) => {
let panelLabel =
name ||
{
'type-1': __('Global Header', 'blocksy-companion'),
}[id] ||
id
const panelId = `builder_header_panel_${id}`
const headerOptions =
ct_customizer_localizations.header_builder_data
.header_data.header_options
const option = {
label: panelLabel,
'inner-options': {
...(id.indexOf('ct-custom') > -1
? {
conditions_button: {
label: __(
'Edit Conditions',
'blocksy-companion'
),
type: 'jsx',
design: 'block',
render: () => (
{__('Remove Header', 'blocksy-companion')}