import React from 'react'
import { Layout } from 'antd'
import { Route, Switch, Redirect } from 'dva/router'
import Navigator from '../components/common/navigator'
import HomePage from '../components/homePage/index'
import Workshop from '../components/workshop/index'
import Setting from '../components/setting/index'
import './mainLayout.less'
import UserInfo from '../components/user/userInfo'
const { Header, Content } = Layout

const MainLayout = () => {
    return(
        <Layout className='main-layout'>
            <Header className='main-header'>
                <Navigator />
            </Header>
            <Content className='main-content'>
                <Switch>
                    <Route sensitive exact={false} path='/home' component={HomePage}/>
                    <Route sensitive exact={false} path='/workshop' component={Workshop}/>
                    <Route sensitive exact={false} path='/setting' component={Setting} />
                    <Route sensitive path='/userinfo' component={UserInfo} />
                    <Route path='/' component={() => (<Redirect to={{ pathname: '/home' }} ></Redirect>)}/>
                </Switch>
            </Content>
        </Layout>
    )
}
export default MainLayout;