/**
 * Registers a new block provided a unique name and an object defining its behavior.
 *
 * @see https://developer.wordpress.org/block-editor/developers/block-api/#registering-a-block
 */
import { registerBlockType } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';

/**
 * Internal dependencies
 */
import Edit from './edit';

/**
 * Every block starts by registering a new block type definition.
 *
 * @see https://developer.wordpress.org/block-editor/developers/block-api/#registering-a-block
 */
registerBlockType('memberpress/pro-profile-menu', {
  title: __("MP ReadyLaunch™ Profile Menu", "memberpress"),
  icon: "admin-users", // https://developer.wordpress.org/resource/dashicons/
  category: "memberpress",
  description: __("Display the MemberPress ReadyLaunch™ profile menu with user avatar, name, and dropdown links.", "memberpress"),
  keywords: [__("profile", "memberpress"), __("user", "memberpress"), __("menu", "memberpress"), __("avatar", "memberpress")],
  supports: {
    customClassName: false, // Removes "Custom CSS Class" from "Advanced" tab of block
    html: false, // User cannot edit block as HTML
    color: {
      text: true,
      background: true,
      link: false,
    },
    align: ['left', 'right'],
  },
  // dropdownBackgroundColor / dropdownTextColor are registered server-side in
  // MeprBlocksCtrl::register_blocks() (this is a dynamic, PHP-rendered block) and
  // bootstrapped into the editor, so they don't need to be redeclared here.

  /**
   * @see ./edit.js
   */
  edit: Edit,

  /**
   * @see ./save.js
   */
  save: function () {
    return null; // Null because we're rendering the output serverside
  }
});

