"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AdaptableObjectsSummary = 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 AdaptableObjectList_1 = require("../../Components/AdaptableObjectList");
const AdaptableObjectsSummary = () => {
    const state = (0, react_redux_1.useSelector)((state) => state);
    const adaptable = (0, AdaptableContext_1.useAdaptable)();
    const modules = adaptable.ModuleService.getModuleCollection();
    const baseClassName = 'ab-AdaptableObjectsSummary';
    return (React.createElement(rebass_1.Box, { className: baseClassName }, [...modules].map(([moduleName, module]) => {
        var _a;
        if (!module.isModuleAvailable()) {
            return null;
        }
        const items = (_a = module === null || module === void 0 ? void 0 : module.toViewAll) === null || _a === void 0 ? void 0 : _a.call(module);
        if (!(items === null || items === void 0 ? void 0 : items.length)) {
            return null;
        }
        return (React.createElement(rebass_1.Box, { "data-name": module.moduleInfo.ModuleName, className: `${baseClassName}__module-list`, key: module.moduleInfo.ModuleName },
            React.createElement("b", { className: `${baseClassName}__header` }, module.moduleInfo.FriendlyName),
            (items === null || items === void 0 ? void 0 : items.length) && React.createElement(AdaptableObjectList_1.AdaptableObjectList, { items: items, module: module })));
    })));
};
exports.AdaptableObjectsSummary = AdaptableObjectsSummary;
