import React from 'react'
import { Menu, Icon } from 'antd'
import { Link } from 'react-router-dom'
import { connect } from 'dva'
import '../../models/main'
import './navigator.less'

class Navigator extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
        }
    };

    render() {

        const { main } = this.props;

        return <Menu
            className='navigator-menu'
            selectedKeys={[main.currentPage]}
            mode="horizontal"
        >     
            <Menu.Item className='nav-page' key="home">
                <Link to='/home'><Icon type="home" />我的</Link>
            </Menu.Item>
            <Menu.Item className='nav-page' key="dashboard">
                <Link to='/dashboard'><Icon type="desktop" />报告与看板</Link>
            </Menu.Item>
            <Menu.Item className='nav-page' key="chart">
                <Link to='/chart'><Icon type="area-chart" />图表</Link>
            </Menu.Item>
            <Menu.Item className='nav-page' key="datasource">
                <Link to='/datasource'><Icon type="database" />数据源</Link>
            </Menu.Item>
            <Menu.Item className='nav-page' key="modeling">
                <Link to='#'><Icon type="tool" />建模分析</Link>
            </Menu.Item>
        </Menu>
    }
}

function mapStateToProps({ present: { main } }) {
    return { main };
}

export default connect(mapStateToProps)(Navigator)


