import * as React from 'react';
import { useSelector } from 'react-redux';
import { useAdaptable } from '../AdaptableContext';
import { DashboardToolbarFactory } from './DashboardToolbarFactory';
import { Box, Flex } from '../../components/Flex';
export const PinnedDashboard = (props) => {
    const adaptable = useAdaptable();
    const dashboardState = 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(Flex, { className: "ab-Dashboard__pinned twa:p-1" }, pinnedToolbars.map((toolbar, index) => {
        return (React.createElement(Box, { key: index, className: `twa:mr-1 twa:mb-1 ab-Dashboard__pinned-container ab-Dashboard__pinned-container--${toolbar}` },
            React.createElement(Box, { className: "ab-Dashboard__toolbar-content" },
                React.createElement(DashboardToolbarFactory, { toolbarName: toolbar }))));
    })));
};
