"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SystemStatusViewPanel = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_redux_1 = require("react-redux");
const getStatusItemStyle_1 = require("./Utilities/getStatusItemStyle");
const Flex_1 = require("../../components/Flex");
class SystemStatusViewPanelComponent extends React.Component {
    constructor(props) {
        super(props);
    }
    render() {
        const currentSystemStatusMessageInfo = this.props.api.systemStatusApi.getCurrentSystemStatusMessageInfo();
        const { color, background } = (0, getStatusItemStyle_1.getStatusItemStyle)(currentSystemStatusMessageInfo);
        const message = currentSystemStatusMessageInfo?.statusMessage;
        const elementType = this.props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
        return (React.createElement(Flex_1.Flex, { alignItems: "stretch", className: `ab-${elementType}__SystemStatus__wrap` },
            React.createElement(Flex_1.Flex, { style: { color, backgroundColor: message ? background : '' }, className: `ab-${elementType}__SystemStatus__text twa:mr-2 twa:p-2 twa:text-2 twa:rounded-standard twa:min-h-input`, alignItems: "center", "data-name": "system-status-message" }, message || '0 Messages')));
    }
}
function mapStateToProps(state) {
    return {
        SystemStatusMessageInfos: state.Internal.SystemStatusMessages,
    };
}
function mapDispatchToProps(dispatch) {
    return {};
}
exports.SystemStatusViewPanel = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(SystemStatusViewPanelComponent);
