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

import Patent from './patent.jsx';
import Activity from './activity.jsx';
import Standard from './standard.jsx';

const Content = React.createClass({
    getInitialState() {
        return {
            loading: false,
            leftKey: 'patent',
            userType: '0'
        };
    },
    handlekey(key) {
        this.setState({
            leftKey: key,
        });
        window.location.hash = key;
    },
    componentWillMount() {
        if (window.location.hash) {
            this.handlekey(window.location.hash.substr(1));
        };
    },
    render() {
        return (
            <div className="acc-content">
                <LeftTab handlekey={this.handlekey} />
                <div className="content-right">
                    {(() => {
                        switch (this.state.leftKey) {
                            case 'patent':
                                return <Patent />;
                            case 'activity':
                                return <Activity />;
                            case 'standard':
                                return <Standard />;
                        };
                    })()}
                </div>
            </div>
        )
    }
});

export default Content;