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 MolecularSearch = LoadableComponent(() => import('../../routes/MolecularSearch/index'))
// 
// 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'))

// Kinase
const KinaseSearch = LoadableComponent(() => import('../../routes/KinaseSearch/index'))

// 知识图谱
const KnowledgeMap = LoadableComponent(() => import('../../routes/KnowledgeMap/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='/home' component={Home} />
          <PrivateRoute exact path='/home/SearchList' component={SearchList} />
          <PrivateRoute exact path='/home/SearchDetails' component={SearchDetails} />
          <PrivateRoute exact path='/home/TargetDetails' component={TargetDetails} />
          <PrivateRoute exact path='/home/LigandDetails' component={LigandDetails} />
          <PrivateRoute exact path='/home/IndicationDetails' component={IndicationDetails} />
          <PrivateRoute exact path='/home/MutationDetails' component={MutationDetails} />
          <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} />
          <PrivateRoute exact path='/MolecularSearch' component={MolecularSearch} />
          <PrivateRoute exact path='/KnowledgeMap' component={KnowledgeMap} />
          <PrivateRoute exact path='/KinaseSearch' component={KinaseSearch} />
          <Redirect exact from='/' to='/home' />
        </Switch>
      </div>
    )
  }
}

export default ContentMain