import React, { Component } from "react";

import Table from 'antd/lib/table';
import notification from 'antd/lib/notification';
import Tabs from 'antd/lib/tabs';

import MyButton from "../../components/MyButton/index.jsx";

import "./index.less";

import TabelaPessoas from "../../components/TabelaPessoas/index.jsx";

import GraficoPublicacoesDiariasPorComunidade from "../../components/GraficoPublicacoesDiariasPorComunidade/index.jsx";
import GraficoPublicacoesTotaisPorComunidade from "../../components/GraficoPublicacoesTotaisPorComunidade/index.jsx";

const { TabPane } = Tabs;

export default class DashboardContainer extends Component {
    constructor(props) {
        super(props);
        this.state = {
            loading: false,
            data: [],
            counter: 0
        };
        this.button = React.createRef();
        this.click = this.click.bind(this);
    }

    componentDidMount() {
        /*
        // Basic sample of the service call:
        fetch('/services/my-test.netuno', {
            credentials: 'include'
        }).then((response) => {
            return response.json();
        }).then((json) => {
            // json...;
        });
        */
        
        
        // Better sample of the recommended way to call services:
        
        
    }

    componentDidUpdate(prevProps, prevState, snapshot) {
        $(this.button.current).fadeOut(250).fadeIn(250);
    }

    click() {
        this.setState({ counter: this.state.counter + 1 });
    }

    render() {
        const { counter, data } = this.state;
        return (
            <div className="my-dashboard">
                <Tabs defaultActiveKey="1">
                    <TabPane tab="Pessoas" key="1">
                        <TabelaPessoas />
                    </TabPane>
                    <TabPane tab="Gráficos" key="2">
                        <GraficoPublicacoesDiariasPorComunidade />
                        <GraficoPublicacoesTotaisPorComunidade />
                    </TabPane>
                </Tabs>
            </div>
        );
    }
}
