"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "WalletConnectButton", {
    enumerable: true,
    get: function() {
        return WalletConnectButton;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _button = /*#__PURE__*/ _interop_require_default(require("../../../button"));
const _text = require("../../../text");
const _types = require("@orderly.network/types");
const _provider = require("../../../provider");
const _css = require("../../../utils/css");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
const WalletConnectButton = (props)=>{
    const { status = _types.AccountStatusEnum.NotConnected, address } = props;
    const { errors } = (0, _react.useContext)(_provider.OrderlyAppContext);
    const buttonLabel = (0, _react.useMemo)(()=>{
        switch(status){
            case _types.AccountStatusEnum.NotConnected:
                return "Connect wallet";
            case _types.AccountStatusEnum.Connected:
            case _types.AccountStatusEnum.NotSignedIn:
            case _types.AccountStatusEnum.SignedIn:
            case _types.AccountStatusEnum.DisabledTrading:
            case _types.AccountStatusEnum.EnableTrading:
                return /*#__PURE__*/ (0, _jsxruntime.jsx)(_text.Text, {
                    rule: "address",
                    range: [
                        4,
                        4
                    ],
                    children: props.address
                });
        }
    }, [
        status,
        address
    ]);
    if (status === _types.AccountStatusEnum.NotConnected) {
        return /*#__PURE__*/ (0, _jsxruntime.jsx)(_button.default, {
            id: "orderly-top-nav-bar-not-connect",
            size: "small",
            loading: props.loading,
            // variant={"gradient"}
            className: (0, _css.cn)("orderly-bg-primary orderly-text-base-contrast orderly-text-4xs hover:orderly-text-base-80 orderly-h-[30px]", props.className),
            onClick: ()=>props.onConnect?.(),
            children: buttonLabel
        });
    }
    return /*#__PURE__*/ (0, _jsxruntime.jsx)(_button.default, {
        id: "orderly-bottom-nav-bar-connect-button",
        size: "small",
        // variant={"gradient"}
        className: (0, _css.cn)("orderly-bg-primary orderly-text-base-contrast orderly-text-4xs hover:orderly-text-base-80 orderly-h-[30px]", props.className),
        loading: props.loading,
        disabled: props.loading || errors?.ChainNetworkNotSupport,
        children: buttonLabel
    });
};

//# sourceMappingURL=walletConnectButton.js.map