"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "TopNavbar", {
    enumerable: true,
    get: function() {
        return TopNavbar;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _hooks = require("@orderly.network/hooks");
const _accountStatusdesktop = require("../../block/accountStatus/desktop/accountStatus.desktop");
const _types = require("@orderly.network/types");
const _appProvider = require("../../provider/appProvider");
const _walletModal = require("../../block/walletConnect/walletModal");
const _logo = require("../../logo");
const _topTips = /*#__PURE__*/ _interop_require_default(require("../../block/accountStatus/sections/topTips"));
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
const TopNavbar = (props)=>{
    const { state } = (0, _hooks.useAccount)();
    const { errors, accountMenuItems, onClickAccountMenuItem, topBar, topBarProps } = (0, _react.useContext)(_appProvider.OrderlyAppContext);
    const { left, nav, right } = topBarProps || {};
    const { ws: wsStatus } = (0, _react.useContext)(_hooks.StatusContext);
    const { onWalletConnect, onSetChain, onWalletDisconnect } = (0, _react.useContext)(_appProvider.OrderlyAppContext);
    const onConnect = (0, _react.useCallback)(()=>{
        onWalletConnect().then((result)=>{
            if (result && result.status < _types.AccountStatusEnum.EnableTrading) {
                (0, _walletModal.showAccountConnectorModal)({
                    status: result.status
                }).catch((err)=>{
                    ;
                });
            }
        });
    }, []);
    return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
        children: [
            topBar || /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                className: "orderly-h-[48px] orderly-flex",
                children: [
                    /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                        className: "orderly-flex orderly-flex-1",
                        children: [
                            /*#__PURE__*/ (0, _jsxruntime.jsx)(_logo.Logo, {}),
                            left,
                            /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                                className: "orderly-flex-1",
                                children: nav
                            })
                        ]
                    }),
                    right || /*#__PURE__*/ (0, _jsxruntime.jsx)(_accountStatusdesktop.AccountStatus, {
                        status: state.status,
                        address: state.address,
                        accountInfo: undefined,
                        className: "orderly-mr-3",
                        onConnect: onConnect,
                        dropMenuItem: accountMenuItems,
                        onClickDropMenuItem: onClickAccountMenuItem
                    })
                ]
            }),
            /*#__PURE__*/ (0, _jsxruntime.jsx)(_topTips.default, {})
        ]
    });
};

//# sourceMappingURL=topNavbar.js.map