"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PinnedDashboard = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_redux_1 = require("react-redux");
const rebass_1 = require("rebass");
const AdaptableContext_1 = require("../AdaptableContext");
const DashboardToolbarFactory_1 = require("./DashboardToolbarFactory");
const PinnedDashboard = (props) => {
    const adaptable = (0, AdaptableContext_1.useAdaptable)();
    const dashboardState = (0, react_redux_1.useSelector)((state) => state.Dashboard);
    const pinnedToolbars = (dashboardState.PinnedToolbars ?? []).filter((tb) => adaptable.api.dashboardApi.internalApi.isToolbarCustom(tb) ||
        adaptable.api.internalApi.getModuleService().isAdapTableModulePresent(tb));
    if (!pinnedToolbars || pinnedToolbars.length == 0) {
        return React.createElement(React.Fragment, null);
    }
    return (React.createElement(rebass_1.Flex, { p: 1, className: "ab-Dashboard__pinned" }, pinnedToolbars.map((toolbar, index) => {
        return (React.createElement(rebass_1.Box, { key: index, mr: 1, mb: 1, className: `ab-Dashboard__pinned-container ab-Dashboard__pinned-container--${toolbar}` },
            React.createElement(rebass_1.Box, { className: "ab-Dashboard__toolbar-content" },
                React.createElement(DashboardToolbarFactory_1.DashboardToolbarFactory, { toolbarName: toolbar }))));
    })));
};
exports.PinnedDashboard = PinnedDashboard;
