import React, {Component} from 'react';

import {Layout, Menu} from 'antd';
import CaseNotification from "../common/caseNotification/CaseNotification";
import Notification from "./notification/Notification";
import GraphqlTrigger from "./graphqlTrigger/GraphqlTrigger";
import StockSignal from "./stockSignal/StockSignal";

const { Content } = Layout;

class MonitorNotify extends Component {
    constructor() {
        super();
        this.state = {
            menuLevel2: "notification",
        }
    }

    switchMenu = (menuName, e) => {
        console.log('menuName', menuName, 'e', e);
        this.setState({
            [menuName]: e.key,
        });
    };

    render() {
        return (
            <div>
                <Menu
                    mode="horizontal"
                    defaultSelectedKeys={['notification']}
                    style={{padding: '0 24px', position: 'fixed', width: '100%', zIndex: '1'}}
                    onClick={(e) => this.switchMenu('menuLevel2', e)}
                    selectedKeys={[this.state.menuLevel2]}
                >
                    <Menu.Item key="notification">notification</Menu.Item>
                    <Menu.Item key="graphql-trigger">graphql trigger</Menu.Item>
                    <Menu.Item key="stock-signal">stock signal</Menu.Item>
                </Menu>

                <Layout style={{ padding: '24px', zIndex: '0'}}>
                    <Content style={{ padding: '24px', minHeight: 280, background: '#fff',marginTop: '48px'  }}>
                        {(() => {
                            switch (this.state.menuLevel2) {
                                case 'notification':
                                    return <Notification />;
                                case 'graphql-trigger':
                                    return <GraphqlTrigger />;
                                case 'stock-signal':
                                    return <StockSignal />;
                                default:
                                    return <Notification />
                            }
                        })()}
                    </Content>
                </Layout>
            </div>
        )
    }
}

export default MonitorNotify;