import React from 'react';
import { Button } from 'antd';
// import { addWiki } from '../api';
import './index.scss';
import UploadWiki from '../components/uploadWiki';

export default (props) => {
  const { project, isManager, history, showNotification, match, reloadList } = props;

  let projectsId = match.params.projectsId;
  let owner = match.params.owner;

  function addFile() {
    history.push(`/${owner}/${projectsId}/wiki/add`);
  }

  return (
    <div className="welcome-main">
      <i className="iconfont icon-huanying_icon" ></i>
      <p className="welcome-title">欢迎使用&nbsp;
        <span className="wiki-title">
          {project && project.name}
        </span>
        &nbsp;Wiki</p>
      <p className="welcome-content">Wiki主要是您项目的产品设计、文档描述、注释等等</p>
      <div className="wiki-line"></div>

      {
        isManager ? <div>
          <Button type="primary" onClick={addFile}>创建Wiki文档</Button>
          <UploadWiki {...props} butClass="welcomeUploadBtn"/>
        </div> : <p className="welcome-des">该项目暂时没有创建Wiki</p>
      }
    </div>
  )
}