import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from "react";
import { Text } from "../../../../../text";
import { NetworkImage } from "../../../../../icon";
import { ChevronDown } from "lucide-react";
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "../../../../../dropdown/dropdown";
import { MemoizedMarkets } from "./myMarkets";
export const Markets = ({ symbol })=>{
    const [open, setOpen] = useState(false);
    // const [allMarkets] = useMarkets(MarketsType.ALL);
    // const curSymbol = useMemo(() => {
    //   const index = allMarkets.findIndex((item) => item.symbol === symbol);
    //   if (index === -1) {
    //     return {
    //       symbol: symbol,
    //       favorite: false,
    //     };
    //   }
    //   return {
    //     symbol: symbol,
    //     // @ ts-ignore
    //     favorite: allMarkets[index].isFavorite || false,
    //   }
    // }, [allMarkets, symbol]);
    return /*#__PURE__*/ _jsxs(DropdownMenu, {
        open: open,
        onOpenChange: setOpen,
        children: [
            /*#__PURE__*/ _jsx(DropdownMenuTrigger, {
                asChild: true,
                children: /*#__PURE__*/ _jsxs("button", {
                    className: "orderly-px-2 orderly-flex orderly-items-center orderly-gap-1 orderly-h-full",
                    children: [
                        /*#__PURE__*/ _jsx(NetworkImage, {
                            type: "symbol",
                            symbol: symbol,
                            size: "small"
                        }),
                        /*#__PURE__*/ _jsx(Text, {
                            rule: "symbol",
                            className: "orderly-text-xs orderly-break-normal orderly-whitespace-nowrap orderly-font-semibold",
                            children: symbol
                        }),
                        /*#__PURE__*/ _jsx(ChevronDown, {
                            size: 14
                        })
                    ]
                })
            }),
            /*#__PURE__*/ _jsx(DropdownMenuContent, {
                onCloseAutoFocus: (e)=>e.preventDefault(),
                align: "start",
                className: "orderly-ui-markets-dropdown-menu-content orderly-w-[580px] orderly-p-0 orderly-bg-base-900 orderly-rounded-borderRadius orderly-shadow-[0px_12px_20px_0px_rgba(0,0,0,0.25)]",
                children: /*#__PURE__*/ _jsx(MemoizedMarkets, {
                    onClose: ()=>setOpen(false)
                })
            })
        ]
    });
};

//# sourceMappingURL=markets.js.map