import React from 'react';
import '../content.less';
import LeftTab from './leftTab.jsx';
import GroupLeftTab from './leftTabgroup.jsx';

import Base from './base.jsx';
import Group from './group.jsx';
import Person from './person.jsx';
import Company from './company.jsx';
import Edu from './edu.jsx';
import Tech from './tech.jsx';
import Pfs from './pfs.jsx';
import Ablt from './ablt.jsx';

const Content = React.createClass({
    getInitialState() {
        return {
            loading: false,
            leftKey: 'base',
            userType: '0'
        };
    },
    handlekey(key) {
        this.setState({
            leftKey: key,
        });
    },
    componentWillMount() {
        if (userData) {
            if (userData.type == '0') {
                this.state.leftKey = 'base';
            } else if (userData.type == '1') {
                this.state.leftKey = 'group';
            };
        }
    },
    render() {
        return (
            <div className="acc-content">
                {(() => {
                    switch (userData.type || this.state.userType) {
                        case '0':
                            return <LeftTab handlekey={this.handlekey} />;
                        case '1':
                            return <GroupLeftTab handlekey={this.handlekey} />;
                    };
                })()}
                <div className="content-right">
                    {(() => {
                        switch (this.state.leftKey) {
                            case 'base':
                                return <Base />;
                            case 'person':
                                return <Person />;
                            case 'edu':
                                return <Edu />;
                            case 'pfs':
                                return <Pfs />;
                            case 'ablt':
                                return <Ablt />;
                            case 'group':
                                return <Group />;
                            case 'company':
                                return <Company />;
                            case 'tech':
                                return <Tech />;
                        };
                    })()}
                </div>
            </div>
        )
    }
});

export default Content;
