"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireWildcard(require("react"));

var _rcQueueAnim = _interopRequireDefault(require("rc-queue-anim"));

var _bsGlobal = require("../../../../utils/bs-global");

var _getLocale = require("../../../../utils/getLocale");

var _stepItem = _interopRequireDefault(require("./stepItem"));

require("./index.css");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); }

var storageKey = "okr_home_page_guide_auto_show_uid:";
var prefixCls = "home-page-guide-cover";

function HomePageGuide(_ref) {
  _objectDestructuringEmpty(_ref);

  var _useState = (0, _react.useState)(false),
      _useState2 = _slicedToArray(_useState, 2),
      visible = _useState2[0],
      setVisible = _useState2[1];

  (0, _react.useEffect)(function () {
    var autoShow = localStorage.getItem(storageKey + (0, _bsGlobal.getUserInfo)().Id);

    if (autoShow !== "false") {
      setVisible(true);
      localStorage.setItem(storageKey + (0, _bsGlobal.getUserInfo)().Id, "false");
    }
  }, []);
  return /*#__PURE__*/_react["default"].createElement(_rcQueueAnim["default"], {
    type: ["scaleX"]
  }, !visible && /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "__btn"),
    key: "btn",
    onClick: function onClick() {
      return setVisible(true);
    }
  }, /*#__PURE__*/_react["default"].createElement("i", {
    className: "tu-icon-T-zhinan"
  }), (0, _getLocale.getLocale)("HP_HowTita")), visible && /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "__wrapper"),
    key: "guide"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: prefixCls
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: require("../../image/okrguide.png"),
    className: "".concat(prefixCls, "__guide-img")
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "__guide-steps")
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "__guide-title")
  }, (0, _getLocale.getLocale)("HP_FourstepsTita")), /*#__PURE__*/_react["default"].createElement(_stepItem["default"], {
    title: (0, _getLocale.getLocale)("HP_DevelopOKR"),
    step: 1,
    linkName: (0, _getLocale.getLocale)("HP_Tut_developOKRs"),
    href: "https://club.tita.com/18150.html"
  }), /*#__PURE__*/_react["default"].createElement(_stepItem["default"], {
    title: (0, _getLocale.getLocale)("HP_AlignmentOKR"),
    step: 2,
    linkName: (0, _getLocale.getLocale)("HP_TutalignmentOKR"),
    href: "https://club.tita.com/18150.html"
  }), /*#__PURE__*/_react["default"].createElement(_stepItem["default"], {
    title: (0, _getLocale.getLocale)("HP_Taskachievement"),
    step: 3,
    linkName: (0, _getLocale.getLocale)("HP_TuttasksonTita"),
    href: "https://club.tita.com/18165.html"
  }), /*#__PURE__*/_react["default"].createElement(_stepItem["default"], {
    title: (0, _getLocale.getLocale)("HP_UpdateProgress"),
    step: 4,
    linkName: (0, _getLocale.getLocale)("HP_TutOKRonTita"),
    href: "https://club.tita.com/18179.html",
    isFinalStep: true
  }), /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      flex: 1
    }
  }), /*#__PURE__*/_react["default"].createElement("a", {
    href: "https://club.tita.com/18664.html",
    className: "".concat(prefixCls, "__more-link"),
    target: "_blank",
    rel: "noreferrer"
  }, /*#__PURE__*/_react["default"].createElement("i", {
    className: "tu-icon-shoushi"
  }), (0, _getLocale.getLocale)("HP_Morecourses")))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "tu-icon-canceled",
    onClick: function onClick() {
      // api.start({coverScale:0,config:{velocity:100}})
      setVisible(false);
    }
  })));
}

var _default = HomePageGuide;
exports["default"] = _default;