"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "MaintenanceStatusTips", {
    enumerable: true,
    get: function() {
        return MaintenanceStatusTips;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _utils = require("../../../utils");
const _icon = require("../../../icon");
const _closeSmall = require("../../../icon/icons/closeSmall");
const _utc = require("@date-fns/utc");
const _datefns = require("date-fns");
const _react = require("react");
function getTimeString(timestamp) {
    const date = (0, _datefns.format)(new _utc.UTCDateMini(timestamp), "MMM dd");
    const time = (0, _datefns.format)(new _utc.UTCDateMini(timestamp), "h:mm aa");
    return `${time} (UTC) on ${date}`;
}
function MaintenanceStatusTips({ brokerName, startTime, endTime, onClose }) {
    const startDate = (0, _react.useMemo)(()=>{
        return getTimeString(startTime);
    }, [
        startTime
    ]);
    const endDate = (0, _react.useMemo)(()=>{
        return getTimeString(endTime);
    }, [
        endTime
    ]);
    const onCloseTips = ()=>{
        window.localStorage.setItem(`Maintenance_${startTime}`, "1");
        onClose();
    };
    return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
        className: (0, _utils.cn)("orderly-bg-warning-darken orderly-text-warning orderly-text-2xs orderly-font-semibold orderly-leading-[18px]", "orderly-fixed orderly-left-0 orderly-right-0 orderly-z-[30]", "orderly-flex orderly-gap-2 orderly-items-start orderly-bottom-[64px] orderly-p-[10px] orderly-pr-[44px]", "orderly-font-semibold", "desktop:!orderly-flex desktop:!orderly-gap-1 desktop:!orderly-items-center desktop:!orderly-justify-center desktop:!orderly-static desktop:!orderly-h-[40px] desktop:!orderly-text-xs desktop:!orderly-bottom-0 desktop:!orderly-pr-0"),
        children: [
            /*#__PURE__*/ (0, _jsxruntime.jsx)(_icon.InfoIcon, {
                size: 20,
                className: "orderly-flex-shrink-0 orderly-w-4 orderly-h-4 desktop:!orderly-w-5 desktop:!orderly-h-5"
            }),
            /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                children: [
                    brokerName,
                    " will be temporarily unavailable for a scheduled upgrade from ",
                    startDate,
                    " to ",
                    endDate,
                    "."
                ]
            }),
            /*#__PURE__*/ (0, _jsxruntime.jsx)(_closeSmall.CloseSmallIcon, {
                size: 24,
                className: "orderly-absolute orderly-right-4 orderly-text-[# orderly-opacity-[.36] hover:orderly-opacity-[.98] orderly-cursor-pointer absolut-item-center",
                onClick: onCloseTips
            })
        ]
    });
}

//# sourceMappingURL=maintenanceStatusTips.js.map