import React from "react";
import { Button } from "@netdata/netdata-ui";
import { getIframeSrc } from "../../utils/utils";
import { useSelector } from "../../store/redux-separate-context";
import { selectIsCloudEnabled } from "../../domains/global/selectors";
import { ListContainer, SpacesList, SeparatedSection, SpacePlaceholder, } from "./styled";
export const SpacesBar = ({ cloudBaseURL, isOffline, isSignedIn, enoughWaitingForIframe, signInUrl, }) => {
    const isCloudEnabled = useSelector(selectIsCloudEnabled);
    if (!isCloudEnabled) {
        return (React.createElement(ListContainer, null));
    }
    return (React.createElement(ListContainer, null, isSignedIn ? (React.createElement("iframe", { src: getIframeSrc(cloudBaseURL, "space-bar"), title: "Space Bar", height: "100%", width: "100%", style: { border: "none" } })) : (enoughWaitingForIframe && (React.createElement(React.Fragment, null,
        React.createElement(SpacesList, null,
            React.createElement(SpacePlaceholder, null)),
        React.createElement(SeparatedSection, null,
            React.createElement(Button, { disabled: isOffline, icon: "plus", onClick: () => {
                    window.location.href = signInUrl;
                } })))))));
};
//# sourceMappingURL=spaces-bar.js.map