"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = MainContent;
const tslib_1 = require("tslib");
const outline_1 = require("@heroicons/react/24/outline");
const react_1 = tslib_1.__importStar(require("react"));
const constant_1 = require("../constant");
const helper_1 = require("../helper");
const types_1 = require("../../types");
const Card_1 = require("../../Card");
const __1 = require("../../..");
function MainContent({ children, currentCode, isLoadingPermission, perCode, showSubMenu, sideBarType, contentRef, }) {
    const [isShowFixedAction, setIsShowFixAction] = (0, react_1.useState)(false);
    const mainClass = {
        [constant_1.SIDEBAR_TYPE.ICON_AND_LABEL_VERTICAL]: {
            open: 'lg:left-[17.85rem]',
            close: 'lg:left-[4.5rem]',
        },
        [constant_1.SIDEBAR_TYPE.ONLY_ICON]: {
            open: 'lg:left-[17.65rem]',
            close: 'lg:left-[4.25rem]',
        },
        [constant_1.SIDEBAR_TYPE.ICON_AND_LABEL_HORIZONTAL]: {
            open: 'lg:left-[25.9rem]',
            close: 'lg:left-[12.3rem]',
        },
    };
    const contentClassname = (0, types_1.classNames)('scrollbar-thin overscroll-contain bg-[#dedede] p-4 lg:h-[calc(100vh-3.45rem)] lg:overflow-y-auto lg:rounded-xl', sideBarType === constant_1.SIDEBAR_TYPE.ICON_AND_LABEL_HORIZONTAL ? 'lg:bg-[#F3F3F3]' : 'lg:bg-[#F1F1F1]');
    (0, __1.useMainwrapV4EventBus)(constant_1.FIXED_ACTION_EVENT, (payload) => {
        if (isShowFixedAction !== payload.show) {
            setIsShowFixAction(payload.show || false);
        }
    });
    return (react_1.default.createElement("main", { className: (0, types_1.classNames)('transition-all lg:absolute lg:inset-0 lg:right-2', showSubMenu ? mainClass[sideBarType].open : mainClass[sideBarType].close, isShowFixedAction ? 'mt-8 lg:mt-0' : '') }, isLoadingPermission ? (react_1.default.createElement("div", { className: contentClassname })) : (0, helper_1.enablePer)(currentCode, perCode) ? (react_1.default.createElement("div", { ref: contentRef, className: contentClassname }, children)) : (react_1.default.createElement("div", { className: contentClassname },
        react_1.default.createElement(Card_1.PHXCard, null,
            react_1.default.createElement("div", { className: 'my-10 flex flex-col  items-center justify-center' },
                react_1.default.createElement(outline_1.LockClosedIcon, { className: 'text-gray-400', height: 70, width: 70 }),
                react_1.default.createElement("div", { className: 'mt-5 flex select-none items-center justify-center text-base font-bold text-gray-800' }, "B\u1EA1n kh\u00F4ng c\u00F3 quy\u1EC1n truy c\u1EADp")))))));
}
//# sourceMappingURL=main-content.js.map