import React, { useContext } from "react";
import { actions } from "../../../platform/services/window/modules/actions";
import { WindowNameContext } from "./WindowTitleBarContext";
import { useDispatch, useSelector } from "react-redux";
export const CloseButton = () => {
    var _a;
    const dispatch = useDispatch();
    const state = useSelector((currentState) => currentState);
    const windowName = useContext(WindowNameContext);
    const showCloseButton = !!(windowName ? (_a = state.windows[windowName]) === null || _a === void 0 ? void 0 : _a.showCloseButton : true);
    if (!showCloseButton) {
        return React.createElement(React.Fragment, null);
    }
    const closeThisWindow = () => {
        dispatch(actions.close({
            windowName: window.name,
        }));
    };
    return (React.createElement("div", { onClick: closeThisWindow, className: "fsbl-icon fsbl-close", title: "Close", id: "fsbl-window-close" },
        React.createElement("i", { className: "ff-close" })));
};
//# sourceMappingURL=CloseButton.js.map