client/components/pages/error.js

"use strict";

require("core-js/modules/es.array.iterator.js");
require("core-js/modules/es.object.to-string.js");
require("core-js/modules/es.string.iterator.js");
require("core-js/modules/es.weak-map.js");
require("core-js/modules/web.dom-collections.iterator.js");
require("core-js/modules/es.object.get-own-property-descriptor.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
require("core-js/modules/es.array.map.js");
var bootstrap = _interopRequireWildcard(require("react-bootstrap"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = _interopRequireDefault(require("react"));
var _reactHotLoader = require("react-hot-loader");
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; }
/*
 * Copyright (C) 2016  Daniel Hsing
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

var Button = bootstrap.Button,
  Container = bootstrap.Container,
  Row = bootstrap.Row;

/**
 * Links to different pages
 */

function ErrorPage(props) {
  var error = props.error;
  var detailedMessage = error.detailedMessage;
  if (typeof detailedMessage === 'string') {
    detailedMessage = [detailedMessage];
  }

  /*
   * to-do: Adjust margins for error status title and message once image
   * is added in
   */
  return /*#__PURE__*/_react.default.createElement(Container, {
    className: "text-center"
  }, /*#__PURE__*/_react.default.createElement(Row, {
    className: "margin-bottom-6"
  }, /*#__PURE__*/_react.default.createElement("h1", null, error.status)), /*#__PURE__*/_react.default.createElement(Row, {
    className: "margin-top-6 margin-bottom-1"
  }, /*#__PURE__*/_react.default.createElement("p", {
    className: "lead"
  }, /*#__PURE__*/_react.default.createElement("b", null, error.message))), /*#__PURE__*/_react.default.createElement("div", null, detailedMessage && detailedMessage.map(function (message, idx) {
    return (
      /*#__PURE__*/
      // eslint-disable-next-line react/no-array-index-key
      _react.default.createElement(Row, {
        key: "detailedMsg".concat(idx)
      }, /*#__PURE__*/_react.default.createElement("span", null, message))
    );
  })), /*#__PURE__*/_react.default.createElement(Row, {
    className: "margin-top-1"
  }, /*#__PURE__*/_react.default.createElement(Button, {
    href: "/",
    size: "sm",
    variant: "link"
  }, "Return to Main Page")));
}
ErrorPage.displayName = 'ErrorPage';
ErrorPage.propTypes = {
  error: _propTypes.default.shape({
    detailedMessage: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.array]),
    message: _propTypes.default.string,
    status: _propTypes.default.number
  }).isRequired
};

// Export as hot module (see https://github.com/gaearon/react-hot-loader)
var _default = (0, _reactHotLoader.hot)(module)(ErrorPage);
exports.default = _default;
//# sourceMappingURL=error.js.map