/**
* WordPress dependencies.
*/
const {
blockEditor: {
InspectorControls,
BlockControls,
},
components: {
Placeholder,
Disabled,
PanelBody,
SelectControl,
ToggleControl,
Toolbar,
ToolbarButton,
},
element: {
Fragment,
createElement,
},
i18n: {
__,
},
serverSideRender: ServerSideRender,
} = wp;
/**
* BuddyPress dependencies.
*/
const {
blockComponents: {
AutoCompleter,
},
blockData: {
isActive,
}
} = bp;
/**
* Internal dependencies.
*/
import { AVATAR_SIZES, GROUP_STATI } from './constants';
const getSlugValue = ( item ) => {
if ( item && item.status && GROUP_STATI[ item.status ] ) {
return GROUP_STATI[ item.status ];
}
return null;
}
const editGroupBlock = ( { attributes, setAttributes } ) => {
const isAvatarEnabled = isActive( 'groups', 'avatar' );
const isCoverImageEnabled = isActive( 'groups', 'cover' );
const { avatarSize, displayDescription, displayActionButton, displayCoverImage } = attributes;
if ( ! attributes.itemID ) {
return (
);
}
return (
{
setAttributes( { itemID: 0 } );
} }
/>
{
setAttributes( { displayActionButton: ! displayActionButton } );
} }
help={
displayActionButton
? __( 'Include a link to the group\'s home page under their name.', 'buddypress' )
: __( 'Toggle to display a link to the group\'s home page under their name.', 'buddypress' )
}
/>
{
setAttributes( { displayDescription: ! displayDescription } );
} }
help={
displayDescription
? __( 'Include the group\'s description under their name.', 'buddypress' )
: __( 'Toggle to display the group\'s description under their name.', 'buddypress' )
}
/>
{ isAvatarEnabled && (
{
setAttributes( { avatarSize: option } );
} }
/>
) }
{ isCoverImageEnabled && (
{
setAttributes( { displayCoverImage: ! displayCoverImage } );
} }
help={
displayCoverImage
? __( 'Include the group\'s cover image over their name.', 'buddypress' )
: __( 'Toggle to display the group\'s cover image over their name.', 'buddypress' )
}
/>
) }
);
};
export default editGroupBlock;