2024-06-15 00:01:22 +00:00
|
|
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
|
import { useEffect } from '@wordpress/element';
|
2024-06-14 18:36:37 +00:00
|
|
|
import { ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
|
|
|
|
import { Panel } from '@wordpress/components';
|
|
|
|
import { BlockInspector } from '@wordpress/block-editor';
|
2024-06-15 01:34:15 +00:00
|
|
|
import { drawerRight } from '@wordpress/icons';
|
2024-06-14 18:36:37 +00:00
|
|
|
|
2024-06-15 00:01:22 +00:00
|
|
|
import { scope } from './constants';
|
|
|
|
const SIDEBARS_BLOCK = 'tipus/block';
|
|
|
|
|
2024-06-14 18:36:37 +00:00
|
|
|
export default function Sidebar () {
|
2024-06-15 00:01:22 +00:00
|
|
|
const { enableComplementaryArea } = useDispatch( interfaceStore );
|
|
|
|
useEffect(() => {
|
|
|
|
enableComplementaryArea( scope, SIDEBARS_BLOCK );
|
|
|
|
}, []);
|
|
|
|
|
2024-06-14 18:36:37 +00:00
|
|
|
return (
|
|
|
|
<ComplementaryArea
|
2024-06-15 00:01:22 +00:00
|
|
|
scope={ scope }
|
|
|
|
identifier={ SIDEBARS_BLOCK }
|
|
|
|
isActiveByDefault={ true }
|
2024-06-15 01:34:15 +00:00
|
|
|
icon={ drawerRight }
|
2024-06-14 18:36:37 +00:00
|
|
|
>
|
|
|
|
<Panel>
|
|
|
|
<BlockInspector />
|
|
|
|
</Panel>
|
|
|
|
</ComplementaryArea>
|
|
|
|
);
|
|
|
|
}
|