"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 _LinkSet = _interopRequireDefault(require("./LinkSet"));

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

/*
 * 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 NavigationPanel =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(NavigationPanel, _Component);

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

  (0, _createClass2.default)(NavigationPanel, [{
    key: "collection",
    value: function collection() {
      var contextId = this.props.contextId;

      switch (this.props.contextType) {
        case "course":
          return {
            links: [{
              href: "/courses/".concat(contextId, "/assignments"),
              title: "\u8AB2\u984C"
            }, {
              href: "/courses/".concat(contextId, "/pages"),
              title: "\u30DA\u30FC\u30B8"
            }, {
              href: "/courses/".concat(contextId, "/discussion_topics"),
              title: "\u30C7\u30A3\u30B9\u30AB\u30C3\u30B7\u30E7\u30F3"
            }, {
              href: "/courses/".concat(contextId, "/assignments/syllabus"),
              title: "\u30B7\u30E9\u30D0\u30B9"
            }, {
              href: "/courses/".concat(contextId, "/announcements"),
              title: "\u30A2\u30CA\u30A6\u30F3\u30B9"
            }, {
              href: "/courses/".concat(contextId, "/quizzes"),
              title: "\u30AF\u30A4\u30BA"
            }, {
              href: "/courses/".concat(contextId, "/files"),
              title: "\u30D5\u30A1\u30A4\u30EB"
            }, {
              href: "/courses/".concat(contextId, "/collaborations"),
              title: "\u5171\u540C\u4F5C\u696D"
            }, {
              href: "/courses/".concat(contextId, "/grades"),
              title: "\u6210\u7E3E"
            }, {
              href: "/courses/".concat(contextId, "/users"),
              title: "\u30E1\u30F3\u30D0\u30FC"
            }, {
              href: "/courses/".concat(contextId, "/modules"),
              title: "\u30E2\u30B8\u30E5\u30FC\u30EB"
            }]
          };

        case "group":
          return {
            links: [{
              href: "/groups/".concat(contextId, "/pages"),
              title: "Wiki \u30DB\u30FC\u30E0"
            }, {
              href: "/groups/".concat(contextId, "/discussion_topics"),
              title: "\u30C7\u30A3\u30B9\u30AB\u30C3\u30B7\u30E7\u30F3\u306E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9"
            }, {
              href: "/groups/".concat(contextId, "/announcements"),
              title: "\u30A2\u30CA\u30A6\u30F3\u30B9 \u30EA\u30B9\u30C8"
            }, {
              href: "/groups/".concat(contextId, "/files"),
              title: "\u30D5\u30A1\u30A4\u30EB\u306E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9"
            }, {
              href: "/groups/".concat(contextId, "/collaborations"),
              title: "\u5171\u540C\u4F5C\u696D"
            }, {
              href: "/groups/".concat(contextId, "/users"),
              title: "\u30E1\u30F3\u30D0\u30FC"
            }]
          };

        default:
          // user, TODO
          return {
            links: [{
              href: "/users/".concat(contextId, "/files"),
              title: "\u30D5\u30A1\u30A4\u30EB\u306E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9"
            }]
          };
      }
    }
  }, {
    key: "render",
    value: function render() {
      return _react.default.createElement(_LinkSet.default, {
        collection: this.collection(),
        onLinkClick: this.props.onLinkClick
      });
    }
  }]);
  NavigationPanel.displayName = "NavigationPanel";
  return NavigationPanel;
}(_react.Component);

NavigationPanel.propTypes = {
  contextType: _propTypes.default.string.isRequired,
  contextId: _propTypes.default.string.isRequired,
  onLinkClick: _propTypes.default.func
};
var _default = NavigationPanel;
exports.default = _default;