"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var react_router_dom_1 = require("react-router-dom");
var UserAvatar_1 = require("../UserAvatar");
var HeaderMobile = function (props) {
    var isSubRoute = function (location, subMenu) {
        return !subMenu.every(function (item) { return item.route !== location.pathname; });
    };
    var logo = props.logo, menu = props.menu;
    var user = props.user;
    return (React.createElement("div", { className: "ds-menu-mobile" },
        React.createElement("div", { className: "ds-table username-info" },
            React.createElement("div", { className: "ds-cell ds-cell-min" },
                React.createElement(UserAvatar_1.UserAvatar, { user: user, size: "m" })),
            React.createElement("div", { className: "ds-cell pl-2" },
                React.createElement("div", { className: "name" }, user.name),
                React.createElement("div", { className: "role" }, user.sub ? user.sub : 'Usuário'))),
        menu.map(function (item) { return (React.createElement(React.Fragment, null,
            !item.subMenu && (React.createElement(react_router_dom_1.NavLink, { className: "ds-menu-item", activeClassName: "ds-menu-item-active", to: { pathname: item.route }, exact: true }, item.title)),
            !!item.subMenu && (React.createElement("div", { className: "ds-menu-category" },
                React.createElement(react_router_dom_1.NavLink, { className: "ds-menu-item", activeClassName: "ds-menu-item-active", to: { pathname: item.route }, onClick: function (e) { return e.preventDefault(); }, isActive: function (match, location) { return isSubRoute(location, item.subMenu); } }, item.title),
                React.createElement("div", { className: "ds-menu-subcategory" }, item.subMenu.map(function (subItem, i) { return (React.createElement(react_router_dom_1.NavLink, { key: subItem.route, className: "ds-item", activeClassName: "active", to: {
                        pathname: subItem.route,
                    }, exact: true },
                    React.createElement("span", { className: "menu-bullet menu-bullet-dot" },
                        React.createElement("span", null)),
                    subItem.title)); })))))); })));
};
exports.default = HeaderMobile;
//# sourceMappingURL=header-mobile.js.map