import * as React from 'react';
import join from '../../components/utils/join';
import * as GeneralConstants from '../../Utilities/Constants/GeneralConstants';
import { LoadButton } from './components/LoadButton';
import { ClearButton } from './components/ClearButton';
import { Flex } from 'rebass';
import { ExportDropdown } from './components/ExportDropdown';
export const StateManagementViewPanel = (props) => {
    const isToolbar = props.viewType === 'Toolbar';
    const elementType = isToolbar ? 'DashboardToolbar' : 'ToolPanel';
    return (React.createElement(Flex, { flexDirection: isToolbar ? 'row' : 'column', className: join(props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__StateManagement__wrap`) },
        React.createElement(Flex, { flexDirection: "row" },
            React.createElement(LoadButton, { tooltip: "Load Initial Adaptable State", variant: "text", icon: "upload", onLoad: (json) => props.api.stateApi.reloadInitialState(json), accessLevel: props.accessLevel }, !isToolbar && 'Load'),
            React.createElement(ClearButton, { icon: "delete", tooltip: "Clear User State", variant: "text", onClick: () => props.api.stateApi.reloadInitialState(), accessLevel: props.accessLevel }, !isToolbar && 'Clear')),
        React.createElement(ExportDropdown, { api: props.api, type: "adaptableState" }, "All State"),
        React.createElement(ExportDropdown, { api: props.api, type: "initialState" }, "Initial Adaptable State")));
};
