// @ts-nocheck
/**
 * WordPress dependencies
 */
import { MenuGroup } from '@wordpress/components';
import { __, _x } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';

/**
 * Internal dependencies
 */
import FeatureToggle from '../toggle-feature';
import OptionToggle from '../toggle-option';

/** @typedef {import('../../../index').BlockEditorSettings} BlockEditorSettings */
/** @typedef {import('./index').OnClose} OnClose */

/**
 * Writing menu
 *
 * @param {Object} props - Component props
 * @param {OnClose} props.onClose - Close the menu
 * @param {BlockEditorSettings} props.settings - Settings
 */
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
function WritingMenu({
  onClose,
  settings
}) {
  const {
    preview,
    fullscreen,
    topToolbar
  } = settings?.iso?.moreMenu || {};
  const {
    isFullscreen
  } = useSelect(select => ({
    isFullscreen: select('isolated/editor').isOptionActive('fullscreenMode')
  }), []);

  // Anything to show?
  if (!fullscreen && !preview && !topToolbar) {
    return null;
  }
  return /*#__PURE__*/_jsxs(MenuGroup, {
    label: _x('View', 'noun'),
    children: [topToolbar && /*#__PURE__*/_jsx(_Fragment, {
      children: /*#__PURE__*/_jsx(FeatureToggle, {
        feature: "fixedToolbar",
        label: __('Top toolbar'),
        info: __('Access all block and document tools in a single place.'),
        messageActivated: __('Top toolbar activated'),
        messageDeactivated: __('Top toolbar deactivated'),
        onClose: onClose
      })
    }), fullscreen && /*#__PURE__*/_jsx(OptionToggle, {
      option: "fullscreenMode",
      label: __('Fullscreen'),
      info: __('Show editor fullscreen.'),
      onClose: onClose
    }), preview && !isFullscreen && /*#__PURE__*/_jsx(OptionToggle, {
      option: "preview",
      label: __('Preview'),
      info: __('Preview the content before posting.'),
      onClose: onClose
    })]
  });
}
export default WritingMenu;
//# sourceMappingURL=writing-menu.js.map