import React, { Component } from 'react';
import { Route, Switch } from 'react-router-dom';
import { SnackbarHOC } from 'educoder';
import { TPMIndexHOC } from '../../tpm/TPMIndexHOC';
import { CNotificationHOC } from '../../courses/common/CNotificationHOC'
import Loadable from 'react-loadable';
import Loading from '../../../Loading';


const UsersInfo = Loadable({
  loader: () => import('./Infos'),
  loading: Loading,
})

const VideoUploadList = Loadable({
  loader: () => import('./video/VideoUploadList'),
  loading: Loading,
})
const VideoPublishSuccess = Loadable({
  loader: () => import('./video/VideoPublishSuccess'),
  loading: Loading,
})
const VideoProtocol = Loadable({
  loader: () => import('./video/VideoProtocol'),
  loading: Loading,
})
class InfosIndex extends Component {
  render() {
    return (
      <Switch {...this.props}>
        {/* 视频发布 */}
        <Route exact path="/:username/videos/upload"
          render={
            (props) => (<VideoUploadList {...this.props} {...props} {...this.state} />)
          }
        ></Route>
        <Route exact path="/:username/videos/success"
          render={
            (props) => (<VideoPublishSuccess {...this.props} {...props} {...this.state} />)
          }
        ></Route>
        <Route exact path="/:username/videos/protocol"
          render={
            (props) => (<VideoProtocol {...this.props} {...props} {...this.state} />)
          }
        ></Route>
        <Route path="/:username"
          render={
            (props) => (<UsersInfo {...this.props} {...props} {...this.state} />)
          }
        ></Route>
      </Switch>
    )
  }
}
export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(InfosIndex)));