"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _novaIcons = require("@coorpacademy/nova-icons");
var _link = _interopRequireDefault(require("../../atom/link"));
var _icon = _interopRequireDefault(require("../../atom/icon"));
var _colors = require("../../variables/colors");
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const {
  cm_primary_blue
} = _colors.COLORS;
const getIcon = feature => {
  switch (feature) {
    case 'manage_users':
      return _novaIcons.NovaSolidUsersActionsUser;
    case 'upload_users':
      return _novaIcons.NovaSolidFilesBasicFileUpload2;
    case 'manage_email':
      return _novaIcons.NovaSolidEmailAtSign;
    case 'massive_battle':
      return _novaIcons.NovaSolidContentEditionFlash;
    case 'cms':
      return _novaIcons.NovaSolidApplicationsWindowApplication5;
    case 'look_and_feel':
      return _novaIcons.NovaSolidDesignPaintBrush2;
    case 'dashboard':
      return _novaIcons.NovaSolidContentContentViewList;
    case 'cockpit':
      return _novaIcons.NovaSolidContentContentBookAdd;
    case 'analytics':
      return _novaIcons.NovaSolidBusinessBusinessGraphLine2;
    case 'binoculaire':
      return _novaIcons.NovaLineObjectsBinoculars;
    case 'book':
      return _novaIcons.NovaLineContentEditionContentBook;
    case 'network':
      return _novaIcons.NovaLineNetworkNetworkAlert;
    case 'chat-bubble-question':
      return _novaIcons.NovaLineMessagesChatChatBubbleCircleQuestionMark;
    case 'mobile-phone':
      return _novaIcons.NovaLinePhoneMobilePhone;
    default:
      return _novaIcons.NovaSolidContentContentBookAdd;
  }
};
const getBackgroudRadialColors = feature => {
  switch (feature) {
    case 'manage_users':
    case 'upload_users':
      return {
        iconBackgroundColor: '#2EC1D6',
        degrees: '187',
        iconColor: null
      };
    case 'look_and_feel':
    case 'dashboard':
      return {
        iconBackgroundColor: '#18BB98',
        degrees: '167',
        iconColor: null
      };
    case 'cockpit':
      return {
        iconBackgroundColor: '#FF7043',
        degrees: '14',
        iconColor: null
      };
    case 'manage_email':
    case 'massive_battle':
    case 'learning_priorities':
    case 'cms':
      return {
        iconBackgroundColor: '#7340FF',
        degrees: '256',
        iconColor: null
      };
    case 'analytics':
      return {
        iconBackgroundColor: '#FF4040',
        degrees: '0',
        iconColor: null
      };
    case 'binoculaire':
      return {
        iconBackgroundColor: '#FFEFEB',
        iconColor: '#FF541F',
        degrees: '0'
      };
    case 'book':
      return {
        iconBackgroundColor: '#F1F6FE',
        degrees: '0',
        iconColor: cm_primary_blue
      };
    case 'network':
      return {
        iconBackgroundColor: '#FFE5E6',
        iconColor: '#FF0A0A',
        degrees: '0'
      };
    case 'chat-bubble-question':
      return {
        iconBackgroundColor: '#E8FCF8',
        iconColor: '#16AC8C',
        degrees: '0'
      };
    case 'mobile-phone':
      return {
        iconBackgroundColor: '#F4F0FF',
        degrees: '0',
        iconColor: '#5C21FF'
      };
    default:
      return null;
  }
};
const QuickAccessCard = (props, context) => {
  const {
    title,
    description,
    feature,
    href,
    openInNewTab = false,
    isMoocCard = false
  } = props;
  const {
    iconBackgroundColor,
    degrees,
    iconColor
  } = getBackgroudRadialColors(feature);
  const Icon = getIcon(feature);
  const newTabOnClick = openInNewTab ? /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyOpenInNewTab, {
    className: _style.default.newTabIcon
  }) : null;
  return /*#__PURE__*/_react.default.createElement("div", {
    "data-name": "quick-access-card",
    "data-type": feature,
    className: _style.default.quickAccess
  }, /*#__PURE__*/_react.default.createElement(_link.default, {
    href: href,
    target: openInNewTab ? '_blank' : '_self',
    className: _style.default.link
  }, /*#__PURE__*/_react.default.createElement("div", {
    style: !isMoocCard ? {
      background: `radial-gradient(62.12% 56.45% at 0% 77.29%, 
            hsl(${degrees}deg 68% 40% / 20%) 0%, 
            hsl(${degrees}deg 68% 40% / 0%) 100%), 
          radial-gradient(113.85% 103.46% at 93.27% 7.88%,
            hsl(${degrees}deg 67% 51% / 15%) 0%, 
            hsl(${degrees}deg 67% 51% / 0%) 100%),
          radial-gradient(49.66% 49.63% at 78.65% 86.26%, 
            hsl(${degrees}deg 87% 91%) 0%, 
            hsl(${degrees}deg 87% 91% / 0%) 100%), 
          #FAFAFA`
    } : null,
    className: _style.default.content
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.iconFeatureWrapper,
    style: {
      backgroundColor: iconBackgroundColor
    }
  }, feature !== 'learning_priorities' ? /*#__PURE__*/_react.default.createElement(Icon, {
    className: _style.default.iconFeature,
    style: {
      color: iconColor
    }
  }) : /*#__PURE__*/_react.default.createElement(_icon.default, {
    className: _style.default.iconFeature,
    iconName: "sign-post",
    iconColor: "white"
  })), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.title
  }, title, newTabOnClick), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.description
  }, description), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.cta
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: !isMoocCard ? _style.default.iconGotoWrapper : null,
    style: !isMoocCard ? {
      backgroundColor: iconBackgroundColor
    } : null
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: isMoocCard ? _style.default.hoverMooc : _style.default.hover,
    style: {
      color: isMoocCard ? '#FFFFFF' : iconBackgroundColor
    }
  }, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowRight, {
    className: _style.default.iconGoto
  })))))));
};
QuickAccessCard.propTypes = process.env.NODE_ENV !== "production" ? {
  title: _propTypes.default.string,
  description: _propTypes.default.string,
  href: _propTypes.default.string,
  openInNewTab: _propTypes.default.bool,
  isMoocCard: _propTypes.default.bool,
  feature: _propTypes.default.oneOf(['analytics', 'cms', 'cockpit', 'massive_battle', 'manage_email', 'dashboard', 'look_and_feel', 'learning_priorities', 'manage_users', 'upload_users', 'binoculaire', 'book', 'network', 'chat-bubble-question', 'mobile-phone'])
} : {};
var _default = exports.default = QuickAccessCard;
//# sourceMappingURL=index.js.map