/*!
 * Copyright 2017 by ChartIQ, Inc.
 * All rights reserved.
 * This is the list of actions the user can take; it's placed above the list of workspaces..
 */
import React from "react";
import { Actions as WorkspaceManagementMenuActions } from "../stores/workspaceManagementMenuStore";
import { MenuItem } from "../../../menu/MenuItem";
const WorkspaceActions = () => {
    /**
     * Pops up a dialog asking for a name for the new workspace.
     */
    const createWorkspace = () => {
        WorkspaceManagementMenuActions.newWorkspace();
    };
    /**
     * Persists activeWorkspace to the storage.
     */
    const saveWorkspace = () => {
        WorkspaceManagementMenuActions.saveWorkspace();
    };
    /**
     * Pops up a dialog asking for a name for the new workspace.
     */
    const saveWorkspaceAs = () => {
        WorkspaceManagementMenuActions.saveWorkspaceAs();
    };
    const userActions = [
        {
            method: createWorkspace,
            label: "New workspace",
            id: "NewWorkspace",
        },
        {
            method: saveWorkspace,
            label: "Save",
            id: "SaveWorkspace",
        },
        {
            method: saveWorkspaceAs,
            label: "Save as",
            id: "SaveWorkspaceAs",
        },
    ];
    /**
     * Iterates through the list of actions defined in the constructor, creating an `li` for each.
     */
    return (React.createElement("div", { className: "menu-secondary workspace-actions" }, userActions.map((action, index) => (React.createElement(MenuItem, { key: index, onClick: action.method }, action.label)))));
};
export default WorkspaceActions;
//# sourceMappingURL=WorkspaceActions.js.map