"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MapMenuContainer = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var map_menu_1 = require("../components/map-menu");
var hooks_1 = require("./hooks");
var map_1 = require("../actions/map");
var context_1 = require("../components/map-providers/context");
var MapMenuContainer = function () {
    var dispatch = (0, context_1.useReduxDispatch)();
    var locale = (0, hooks_1.useViewerLocale)();
    var activeMapName = (0, hooks_1.useActiveMapName)();
    var availableMaps = (0, hooks_1.useAvailableMaps)();
    var setActiveMapAction = function (mapName) { return dispatch((0, map_1.setActiveMap)(mapName)); };
    var onActiveMapChanged = function (mapName) { return setActiveMapAction(mapName); };
    if (locale && activeMapName && availableMaps) {
        //TODO: Should use MapGroup id has label. For now, use map name for both
        var entries = availableMaps.map(function (m) {
            return { label: m.name, mapName: m.value };
        });
        return React.createElement(map_menu_1.MapMenu, { onActiveMapChanged: onActiveMapChanged, selectedMap: activeMapName, maps: entries, locale: locale });
    }
    else {
        return React.createElement("noscript", null);
    }
};
exports.MapMenuContainer = MapMenuContainer;
//# sourceMappingURL=map-menu.js.map