"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mapStateToProps = exports.PageTitle = void 0;
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _router = require("@reach/router");
var _store = require("../../redux/store");
var _recompose = require("recompose");
var _bundleCommon = require("@kineticdata/bundle-common");
var _excluded = ["parts"];
var mapStateToProps = exports.mapStateToProps = function mapStateToProps(state) {
  return {
    kapp: (0, _bundleCommon.selectCurrentKapp)(state)
  };
};
var PageTitle = exports.PageTitle = (0, _recompose.compose)((0, _store.connect)(mapStateToProps), (0, _recompose.withProps)(function (_ref) {
  var _ref$parts = _ref.parts,
    parts = _ref$parts === void 0 ? [] : _ref$parts,
    props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
  return {
    parts: parts.concat([[props.kapp && props.kapp.name, props.settings && 'Settings'].filter(Boolean).join(' ')])
  };
}))(function (props) {
  return /*#__PURE__*/_react["default"].createElement(_bundleCommon.PageTitle, Object.assign({}, props, {
    components: {
      Link: _router.Link
    }
  }));
});