import React from 'react'
import { withRouter, Switch, Redirect } from 'react-router-dom'
import LoadableComponent from '../../utils/LoadableComponent'
import PrivateRoute from '../PrivateRoute'

const Home = LoadableComponent(()=>import('../../routes/Home/index'))  //参数一定要是函数，否则不会懒加载，只会代码拆分
// 搜索结果
// const SearchList = LoadableComponent(()=>import('../../routes/Home/SearchList/index'))
// const SearchDetails = LoadableComponent(()=>import('../../routes/Home/SearchDetails/index'))
// const TargetDetails = LoadableComponent(()=>import('../../routes/Home/TargetDetails/index'))
// const LigandDetails = LoadableComponent(()=>import('../../routes/Home/LigandDetails/index'))
// const IndicationDetails = LoadableComponent(()=>import('../../routes/Home/IndicationDetails/index'))
// const MutationDetails = LoadableComponent(()=>import('../../routes/Home/MutationDetails/index'))
const dockingUploadDetails = LoadableComponent(()=>import('../../routes/Home/dockingUploadDetails/index'))

//登录
const Login = LoadableComponent(()=>import('../../routes/Login/index'))
// 分子搜索
const MolecularSearch = LoadableComponent(()=>import('../../routes/MolecularSearch/index'))
// Kinase
const Kinase = LoadableComponent(()=>import('../../routes/Kinase/index'))  
const KinaseSearchList = LoadableComponent(()=>import('../../routes/Kinase/SearchList/index'))
const KinaseSearchDetails = LoadableComponent(()=>import('../../routes/Kinase/SearchDetails/index'))
const KinaseTargetDetails = LoadableComponent(()=>import('../../routes/Kinase/TargetDetails/index'))
const KinaseLigandDetails = LoadableComponent(()=>import('../../routes/Kinase/LigandDetails/index'))
const IndicationDetails = LoadableComponent(()=>import('../../routes/Kinase/IndicationDetails/index'))


// drugbank
const drugbank = LoadableComponent(()=>import('../../routes/drugbank/index'))  
const drugbankSearchList = LoadableComponent(()=>import('../../routes/drugbank/SearchList/index'))
const drugbankSearchDetails = LoadableComponent(()=>import('../../routes/drugbank/SearchDetails/index'))
const drugbankTargetDetails = LoadableComponent(()=>import('../../routes/drugbank/TargetDetails/index'))
const drugbankIndicationDetails = LoadableComponent(()=>import('../../routes/drugbank/IndicationDetails/index'))

@withRouter
class ContentMain extends React.Component {
  render () {
    return (
      <div style={{padding: 16, position: 'relative'}}>
        <Switch>
          <PrivateRoute exact path='/login' component={Login}/>
          <PrivateRoute exact path='/Kinase' component={Kinase}/>
          <PrivateRoute exact path='/Kinase/SearchList' component={KinaseSearchList}/>
          <PrivateRoute exact path='/Kinase/SearchDetails' component={KinaseSearchDetails}/>
          <PrivateRoute exact path='/Kinase/TargetDetails' component={KinaseTargetDetails}/>
          <PrivateRoute exact path='/Kinase/LigandDetails' component={KinaseLigandDetails}/>
          <PrivateRoute exact path='/Kinase/IndicationDetails' component={IndicationDetails} />
          <PrivateRoute exact path='/drugbank' component={drugbank}/>
          <PrivateRoute exact path='/drugbank/SearchList' component={drugbankSearchList}/>
          <PrivateRoute exact path='/drugbank/SearchDetails' component={drugbankSearchDetails}/>
          <PrivateRoute exact path='/drugbank/TargetDetails' component={drugbankTargetDetails}/>
          <PrivateRoute exact path='/drugbank/Indication' component={drugbankIndicationDetails}/>
          <PrivateRoute exact path='/dockingUploadDetails' component={dockingUploadDetails}/>
          <PrivateRoute exact path='/MolecularSearch' component={MolecularSearch}/>
          {/* <Redirect exact from='/' to='/Kinase'/> */}
          <Redirect exact from='/' to='/Login'/>
        </Switch>
      </div>
    )
  }
}

export default ContentMain