"use strict";

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

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

var _context = require("../../context");

require("./style.sass");

var _constants = require("../../constants");

var _footerLogo = _interopRequireDefault(require("../../assets/images/footer-logo.svg"));

var _userAvatar = _interopRequireDefault(require("../../assets/images/user-avatar.png"));

var _svgs = require("../../svgs");

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

var Footer = function Footer(props) {
  var pathname = props.pathname,
      user = props.user,
      handleSubscribe = props.handleSubscribe;
  return /*#__PURE__*/_react["default"].createElement(_context.MainContext.Consumer, null, function (data) {
    var _user$userName;

    var socialMediaLinks = (data === null || data === void 0 ? void 0 : data.socialMediaLinks) || {};
    var arr = Object.keys(socialMediaLinks) || [];
    return /*#__PURE__*/_react["default"].createElement("footer", {
      className: "wizrd-site-footer"
    }, !_constants.WEBSIT_TYPE.includes(data.templateType) && /*#__PURE__*/_react["default"].createElement("div", {
      className: "wizrd-top-footer"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "wizrd-footer-box"
    }, props.children, /*#__PURE__*/_react["default"].createElement("div", {
      className: "footer-box"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "wizrd-author-box"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "wizrd-author-avtar"
    }, /*#__PURE__*/_react["default"].createElement("img", {
      src: (user === null || user === void 0 ? void 0 : user.profileImageUrl) || _userAvatar["default"],
      alt: "Jason Miller"
    })), /*#__PURE__*/_react["default"].createElement("div", {
      className: "wizrd-blog-author-details"
    }, /*#__PURE__*/_react["default"].createElement("span", {
      className: "author-label"
    }, "Author"), /*#__PURE__*/_react["default"].createElement("span", {
      className: "wizrd-author-name"
    }, user === null || user === void 0 ? void 0 : (_user$userName = user.userName) === null || _user$userName === void 0 ? void 0 : _user$userName.toUsername()), /*#__PURE__*/_react["default"].createElement("span", {
      className: "wizrd-author-bio"
    }, user === null || user === void 0 ? void 0 : user.authorDescription), /*#__PURE__*/_react["default"].createElement("ul", {
      className: "social-media"
    }, arr.map(function (item) {
      var link = socialMediaLinks[item];
      return /*#__PURE__*/_react["default"].createElement("li", {
        className: "wizrd-header-social-links"
      }, /*#__PURE__*/_react["default"].createElement("a", {
        rel: "noopener",
        target: "_blank",
        href: link !== null && link !== void 0 && link.match('http') ? link : "https://".concat(link)
      }, (0, _svgs.svgData)()[item]));
    }))), /*#__PURE__*/_react["default"].createElement("button", {
      type: "button",
      onClick: handleSubscribe,
      className: "btn btn-primary wizrd-author-subscription-action"
    }, "Subscribe")))), /*#__PURE__*/_react["default"].createElement("div", {
      className: "wizrd-footer-dots"
    }, /*#__PURE__*/_react["default"].createElement("svg", {
      width: "1264",
      height: "293",
      viewBox: "0 0 1264 293",
      fill: "none",
      xmlns: "http://www.w3.org/2000/svg"
    }, /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "149",
      cy: "17",
      r: "3",
      fill: "white"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      className: "wizrd-footer-theme-dots",
      cx: "3.5",
      cy: "91.5",
      r: "3.5",
      fill: "#7EB8EE"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "738",
      cy: "8",
      r: "4",
      fill: "white"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "624",
      cy: "268",
      r: "4",
      fill: "white"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      className: "wizrd-footer-theme-dots",
      cx: "368",
      cy: "173",
      r: "3",
      fill: "#7EB8EE"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "266",
      cy: "267",
      r: "3",
      fill: "white"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "217.5",
      cy: "129.5",
      r: "2.5",
      fill: "white"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      className: "wizrd-footer-theme-dots",
      cx: "54",
      cy: "289",
      r: "4",
      fill: "#7EB8EE"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "128",
      cy: "174",
      r: "4",
      fill: "white"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      className: "wizrd-footer-theme-dots",
      cx: "1260",
      cy: "264",
      r: "4",
      fill: "#7EB8EE"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      className: "wizrd-footer-theme-dots",
      cx: "1089",
      cy: "4",
      r: "4",
      fill: "#7EB8EE"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "453",
      cy: "25",
      r: "2",
      fill: "white"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      className: "wizrd-footer-theme-dots",
      cx: "916",
      cy: "212",
      r: "4",
      fill: "#7EB8EE"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "924.5",
      cy: "84.5",
      r: "1.5",
      fill: "white"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "1168",
      cy: "174",
      r: "2",
      fill: "white"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "1042.5",
      cy: "138.5",
      r: "2.5",
      fill: "white"
    }), /*#__PURE__*/_react["default"].createElement("circle", {
      cx: "1036",
      cy: "272",
      r: "4",
      fill: "white"
    })))), /*#__PURE__*/_react["default"].createElement("div", {
      className: "wizrd-copyright"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "container"
    }, /*#__PURE__*/_react["default"].createElement("a", {
      href: data.footerLogoUrl || '#',
      target: "_blank",
      rel: "noopener"
    }, /*#__PURE__*/_react["default"].createElement("img", {
      className: "footer-logo",
      src: _footerLogo["default"],
      alt: "Wizard"
    })))));
  });
};

String.prototype.toUsername = function () {
  return this.replace(/\@.*/, '');
};

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