import React from 'react';
import { WindowType } from '../windows/Windows';
import { Menu, MenuItem } from '@material-ui/core';

export interface NewTabProps {
    windowType: WindowType,
}

export interface IProps {
    anchorEl: null | HTMLElement,
    onClose: () => void,
    onCreateTab: (q: NewTabProps) => void,
}

export default function AddTabMenu(props: IProps) {
    return <Menu
        anchorEl={props.anchorEl}
        keepMounted
        open={Boolean(props.anchorEl)}
        onClose={props.onClose}
    >
        <MenuItem disabled={true}>New Tab</MenuItem>
        <MenuItem
            onClick={() => {
                props.onClose();
                props.onCreateTab({
                    windowType: WindowType.Query,
                })
            }}
        >{WindowType.Query}</MenuItem>
    </Menu>
}