import "choerodon-ui/pro/lib/spin/style";
import _Spin from "choerodon-ui/pro/lib/spin";
import React, { useCallback, Fragment, useEffect } from 'react';
import { Page, Content, Header, Breadcrumb, Permission } from '@choerodon/boot';
import { FormattedMessage } from 'react-intl';
import { withRouter } from 'react-router-dom';
import { observer } from 'mobx-react-lite';
import { Prompt } from 'react-router-dom';
import { useRepositoryStore } from "./stores";
import RepositoryForm from "../repository/repository-form";
import "./index.less";
var ProRepository = withRouter(observer(function (props) {
  var _useRepositoryStore = useRepositoryStore(),
      formatMessage = _useRepositoryStore.intl.formatMessage,
      id = _useRepositoryStore.AppState.currentMenuType.id,
      intlPrefix = _useRepositoryStore.intlPrefix,
      prefixCls = _useRepositoryStore.prefixCls,
      permissions = _useRepositoryStore.permissions,
      detailDs = _useRepositoryStore.detailDs,
      repositoryStore = _useRepositoryStore.repositoryStore,
      promptMsg = _useRepositoryStore.promptMsg;

  function refresh() {
    detailDs.query();
  }

  return /*#__PURE__*/React.createElement(Page, {
    service: permissions
  }, /*#__PURE__*/React.createElement(Breadcrumb, null), /*#__PURE__*/React.createElement(Prompt, {
    message: promptMsg,
    when: detailDs.current ? detailDs.current.dirty : false
  }), /*#__PURE__*/React.createElement(Content, {
    className: "".concat(prefixCls, "-home")
  }, detailDs.current ? /*#__PURE__*/React.createElement(RepositoryForm, {
    record: detailDs.current,
    dataSet: detailDs,
    store: repositoryStore,
    id: id,
    isProject: true,
    intlPrefix: intlPrefix,
    prefixCls: prefixCls,
    refresh: refresh
  }) : /*#__PURE__*/React.createElement(_Spin, null)));
}));
export default ProRepository;