import React , { useEffect , useState } from 'react';
import { Banner } from '../Component/layout';
import { Link } from 'react-router-dom';

import Dispost from './Dispose';

import styled from 'styled-components';

const Div = styled.div`{
  padding:24px 30px;
}`;
export default ((props)=>{
  const [ permission , setPermission ] = useState("");

  const owner = props.match.params.owner;

  const projectDetail = props.projectDetail;

  useEffect(()=>{
    if(projectDetail){
      setPermission(props.projectDetail.permission);
    }
  },[projectDetail])


  return(
    <div className="disposePanel">
      <Banner>
        { permission !=="Reporter" && <Link to={`/projects/${owner}/${props.match.params.projectsId}/devops/dispose`}>工作流配置</Link>}
      </Banner>
      <Div>
        <Dispost {...props}/>
      </Div>
    </div>
  )
})