"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ViewsDropdownPrefix = void 0;
exports._ViewsDropdownPrefix = _ViewsDropdownPrefix;
var _designSystem = require("@wix/design-system");
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _ = require("../..");
var _ViewsDropdown = require("./ViewsDropdown");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CollectionViewsDropdown/ViewsDropdownPrefix.tsx";
function _ViewsDropdownPrefix(props) {
  var _container$internalEx;
  const {
    state
  } = props;
  const container = (0, _.useWixPatternsContainer)();
  const isRedesign = (_container$internalEx = container.internalExperiments) == null ? void 0 : _container$internalEx.enabled(_ViewsDropdown.VIEWS_REDESIGN_EXPERIMENT);
  const {
    views
  } = state;
  const {
    collection: {
      translate: t
    }
  } = views;
  if (!views.isCurrentViewSelected || views.isCurrentViewSelected && state.isViewChanged) {
    return /*#__PURE__*/_react.default.createElement(_designSystem.Input.Affix, {
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 37,
        columnNumber: 7
      }
    }, /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      dataHook: "view-pending-changes",
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 38,
        columnNumber: 9
      }
    }, /*#__PURE__*/_react.default.createElement(_designSystem.Tooltip, {
      appendTo: "window",
      content: views.isCurrentViewSelected ? t('cairo.manageView.tooltip') : t('cairo.manageView.unsaved.tooltip'),
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 39,
        columnNumber: 11
      }
    }, /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      verticalAlign: "middle",
      color: "D40",
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 47,
        columnNumber: 13
      }
    }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.StatusAlertSmall, {
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 48,
        columnNumber: 15
      }
    })))));
  }
  if (views.isDefaultView) {
    const DefaultIcon = isRedesign ? _wixUiIconsCommon.PinSmall : _wixUiIconsCommon.FlagSmall;
    return /*#__PURE__*/_react.default.createElement(_designSystem.Input.Affix, {
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 59,
        columnNumber: 7
      }
    }, /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      dataHook: "view-default",
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 60,
        columnNumber: 9
      }
    }, /*#__PURE__*/_react.default.createElement(DefaultIcon, {
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 61,
        columnNumber: 11
      }
    })));
  }
  return null;
}
const ViewsDropdownPrefix = exports.ViewsDropdownPrefix = (0, _mobxReactLite.observer)(_ViewsDropdownPrefix);
//# sourceMappingURL=ViewsDropdownPrefix.js.map