"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _propTypes = _interopRequireDefault(require("prop-types"));

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

var _formatMessage = _interopRequireDefault(require("../../format-message"));

var _UploadForm = _interopRequireDefault(require("./UploadForm"));

var _ImageUploadsList = _interopRequireDefault(require("./ImageUploadsList"));

var _FlickrSearch = _interopRequireDefault(require("./FlickrSearch"));

/*
 * Copyright (C) 2018 - present Instructure, Inc.
 *
 * This file is part of Canvas.
 *
 * Canvas is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, version 3 of the License.
 *
 * Canvas 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 Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */
var ImagesPanel =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(ImagesPanel, _Component);

  function ImagesPanel() {
    (0, _classCallCheck2.default)(this, ImagesPanel);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ImagesPanel).apply(this, arguments));
  }

  (0, _createClass2.default)(ImagesPanel, [{
    key: "instructions",
    value: function instructions() {
      return _react.default.createElement("p", null, "Smelli\xF0 \xE1 hva\xF0a mynd sem er til a\xF0 \xEDvefja myndina \xE1 s\xED\xF0una.");
    }
  }, {
    key: "renderUploadForm",
    value: function renderUploadForm() {
      if (this.props.withUploadForm) {
        return _react.default.createElement(_UploadForm.default, {
          fetchFolders: this.props.fetchFolders,
          upload: this.props.upload,
          toggleUploadForm: this.props.toggleUploadForm,
          startUpload: this.props.startUpload,
          onImageEmbed: this.props.onImageEmbed,
          usageRightsRequired: this.props.usageRightsRequired,
          messages: {
            expand: "Hla\xF0a upp n\xFDrri mynd",
            expandScreenreader: "Form myndar \xED upphle\xF0slu",
            collapse: "H\xE6tta vi\xF0 a\xF0 hla\xF0a upp mynd",
            collapseScreenreader: "Form myndar \xED upphle\xF0slu"
          },
          showAltTextForm: true
        });
      }

      return null;
    }
  }, {
    key: "renderFlickrSearchForm",
    value: function renderFlickrSearchForm() {
      return _react.default.createElement(_FlickrSearch.default, {
        flickrSearch: this.props.flickrSearch,
        toggleFlickrForm: this.props.toggleFlickrForm,
        flickr: this.props.flickr,
        onImageEmbed: this.props.onImageEmbed
      });
    }
  }, {
    key: "renderImageUploadsList",
    value: function renderImageUploadsList() {
      return _react.default.createElement(_ImageUploadsList.default, {
        images: this.props.images,
        fetchImages: this.props.fetchImages,
        onImageEmbed: this.props.onImageEmbed
      });
    }
  }, {
    key: "render",
    value: function render() {
      return _react.default.createElement("div", null, this.instructions(), this.renderFlickrSearchForm(), this.renderUploadForm(), this.renderImageUploadsList());
    }
  }]);
  ImagesPanel.displayName = "ImagesPanel";
  return ImagesPanel;
}(_react.Component);

ImagesPanel.propTypes = {
  withUploadForm: _propTypes.default.bool,
  upload: _UploadForm.default.propTypes.upload,
  images: _ImageUploadsList.default.propTypes.images,
  fetchImages: _ImageUploadsList.default.propTypes.fetchImages,
  fetchFolders: _UploadForm.default.propTypes.fetchFolders,
  startUpload: _UploadForm.default.propTypes.startUpload,
  flickr: _FlickrSearch.default.propTypes.flickr,
  flickrSearch: _FlickrSearch.default.propTypes.flickrSearch,
  toggleFlickrForm: _FlickrSearch.default.propTypes.toggleFlickrForm,
  toggleUploadForm: _UploadForm.default.propTypes.toggleUploadForm,
  onImageEmbed: _ImageUploadsList.default.propTypes.onImageEmbed,
  usageRightsRequired: _propTypes.default.bool
};
ImagesPanel.defaultProps = {
  withUploadForm: false
};
var _default = ImagesPanel;
exports.default = _default;