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 StructureSearch = LoadableComponent(()=>import('../../routes/Home/StructureSearch/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 AutoimmuneDiseases = LoadableComponent(()=>import('../../routes/Home/AutoimmuneDiseases/index'))
const AntigenDetails = LoadableComponent(()=>import('../../routes/Home/AntigenDetails/index'))
const MolstarView = LoadableComponent(()=>import('../../routes/Home/MolstarView/index'))
const SequenceDetails = LoadableComponent(()=>import('../../routes/Home/SequenceDetails/index'))
const Docking = LoadableComponent(()=>import('../../routes/Home/Docking/index'))


// 计算工具
const ProteinTools = LoadableComponent(()=>import('../../routes/computationalTools/ProteinTools/index'))
const MultipleSequenceAlignment = LoadableComponent(()=>import('../../routes/computationalTools/MultipleSequenceAlignment/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/StructureSearch' component={StructureSearch}/>
          <PrivateRoute exact path='/home/Docking' component={Docking}/>
          <PrivateRoute exact path='/home/SearchDetails' component={SearchDetails}/>
          <PrivateRoute exact path='/home/TargetDetails' component={TargetDetails}/>
          <PrivateRoute exact path='/home/AutoimmuneDiseases' component={AutoimmuneDiseases}/>
          <PrivateRoute exact path='/home/AntigenDetails' component={AntigenDetails}/>
          <PrivateRoute exact path='/home/MolstarView' component={MolstarView}/>
          <PrivateRoute exact path='/home/SequenceDetails' component={SequenceDetails}/>
          <PrivateRoute exact path='/computationalTools/ProteinTools' component={ProteinTools}/>
          <PrivateRoute exact path='/computationalTools/MultipleSequenceAlignment' component={MultipleSequenceAlignment}/>
          <Redirect exact from='/' to='/login'/>
        </Switch>
      </div>
    )
  }
}

export default ContentMain