import React, { Component } from "react";

import { Route, Switch } from "react-router-dom";
import { withRouter } from "react-router";
import { SnackbarHOC } from "educoder";
import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC";
import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC";
import Loadable from "react-loadable";
import Loading from "../Loading";
import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC";
import './index.scss';

const NoticeList = Loadable({
  loader: () => import("./notice/noticeList"),
  loading: Loading,
});

const NoticeDetail = Loadable({
  loader: () => import("./notice/noticeDetail"),
  loading: Loading,
});


class Index extends Component {
  render() {
    return (
      <div className="newMain clearfix">
        <Switch {...this.props}>

          <Route
            path="/notice/noticeDetail/:noticeId"
            render={(props) => (
              <NoticeDetail {...this.props} {...props} />
            )}
          ></Route>
          
          <Route
            path="/notice"
            render={(props) => (
              <NoticeList {...this.props} {...props} />
            )}
          ></Route>
        </Switch>
      </div>
    );
  }
}
export default withRouter(
  ImageLayerOfCommentHOC({
    imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
    parentSelector: ".newMain",
  })(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))))
);
