import "choerodon-ui/lib/button/style";
import _Button from "choerodon-ui/lib/button";
import React, { Fragment } from 'react';
import { Header, Content, Breadcrumb, HeaderButtons } from '@choerodon/boot';
import { EmptyPage } from '@choerodon/components';
import Loading from "../../../components/loading";
import { useAppTopStore } from "../stores";
import emptyImage from "../images/empty.svg";
export function EmptyLoading(_ref) {
  var formatMessage = _ref.formatMessage;
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement(_Button, {
    icon: "refresh",
    type: "primary",
    funcType: "flat"
  }, formatMessage({
    id: 'refresh'
  }))), /*#__PURE__*/React.createElement(Breadcrumb, null), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(Loading, {
    display: true
  })));
}
export default function EmptyShown(_ref2) {
  var access = _ref2.access,
      onClick = _ref2.onClick,
      openImport = _ref2.openImport;

  var _useAppTopStore = useAppTopStore(),
      formatMessage = _useAppTopStore.intl.formatMessage,
      projectId = _useAppTopStore.AppState.currentMenuType.id,
      appServiceStore = _useAppTopStore.appServiceStore,
      intlPrefix = _useAppTopStore.intlPrefix;

  function refresh() {
    appServiceStore.checkHasApp(projectId);
  }

  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement(HeaderButtons, {
    items: [{
      name: formatMessage({
        id: "".concat(intlPrefix, ".create")
      }),
      icon: 'playlist_add',
      permissions: ['choerodon.code.project.develop.app-service.ps.create'],
      display: true,
      handler: onClick
    }, {
      name: formatMessage({
        id: "".concat(intlPrefix, ".import")
      }),
      icon: 'archive-o',
      permissions: ['choerodon.code.project.develop.app-service.ps.import'],
      display: true,
      handler: openImport
    }, {
      icon: 'refresh',
      display: true,
      handler: refresh
    }]
  })), /*#__PURE__*/React.createElement(Breadcrumb, null), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(EmptyPage, {
    image: emptyImage,
    description: access ? /*#__PURE__*/React.createElement(React.Fragment, null, formatMessage({
      id: 'empty.tips.app-list.des.owner'
    }), /*#__PURE__*/React.createElement(EmptyPage.Button, {
      onClick: onClick
    }, "\u8BF7\u521B\u5EFA")) : formatMessage({
      id: 'empty.tips.app.member'
    })
  })));
}