"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "ChainListView", {
    enumerable: true,
    get: function() {
        return ChainListView;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _chainCell = require("./chainCell");
const ChainListView = (props)=>{
    const mainnet = (0, _react.useMemo)(()=>{
        if (!props.mainChains || props.mainChains.length === 0) {
            return null;
        }
        return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
            children: [
                props.testChains && props.testChains.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                    className: "orderly-uppercase orderly-text-base-contrast/50 orderly-text-4xs orderly-mb-2 desktop:orderly-ml-3",
                    children: "mainnet"
                }),
                /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                    className: "orderly-flex orderly-flex-col",
                    children: props.mainChains.map((chain, index)=>{
                        return /*#__PURE__*/ (0, _jsxruntime.jsx)(_chainCell.ChainCell, {
                            name: chain.name,
                            id: chain.chain_id,
                            onClick: props.onItemClick,
                            bridgeless: chain.bridgeless,
                            selected: props.currentChainId === chain.chain_id
                        }, chain.chain_id);
                    })
                })
            ]
        });
    }, [
        props.mainChains,
        props.testChains,
        props.currentChainId
    ]);
    const testnet = (0, _react.useMemo)(()=>{
        if (!props.testChains || props.testChains.length === 0) {
            return null;
        }
        return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
            children: [
                props.mainChains && props.mainChains.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                    className: "orderly-uppercase orderly-text-base-contrast/50 orderly-text-4xs orderly-mb-2 desktop:orderly-ml-3",
                    children: "testnet"
                }),
                /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                    className: "orderly-flex orderly-flex-col",
                    children: props.testChains.map((chain, index)=>{
                        return /*#__PURE__*/ (0, _jsxruntime.jsx)(_chainCell.ChainCell, {
                            name: chain.name,
                            id: chain.chain_id,
                            onClick: props.onItemClick,
                            bridgeless: chain.bridgeless,
                            selected: props.currentChainId === chain.chain_id
                        }, chain.chain_id);
                    })
                })
            ]
        });
    }, [
        props.testChains,
        props.mainChains,
        props.currentChainId
    ]);
    return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
        className: "orderly-chain-list orderly-pt-5 desktop:orderly-pt-2",
        children: [
            mainnet,
            testnet
        ]
    });
};

//# sourceMappingURL=chainListView.js.map