"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EditChartButton = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const PopupRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/PopupRedux"));
const ButtonEdit_1 = require("../Components/Buttons/ButtonEdit");
const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
const react_redux_1 = require("react-redux");
const EditChartButton = (props) => {
    const dispatch = (0, react_redux_1.useDispatch)();
    return (React.createElement(ButtonEdit_1.ButtonEdit, { iconSize: props.iconSize, tooltip: "Edit Chart", 
        // It gets complicated when a chart is both open and opened in edit wizard
        // There an be conflicts between the two open charts (preview and main) and the changes to the active chart may not be syncronized correctly.
        disabled: !props.chart || props.isOpen, accessLevel: props.accessLevel, onClick: () => dispatch(PopupRedux.PopupShowScreen(ModuleConstants.ChartingModuleId, 'Chart', {
            action: 'Edit',
            value: props.chart,
            source: 'Toolbar',
        })) }));
};
exports.EditChartButton = EditChartButton;
