import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useContext } from "react";
import { useTickerStream } from "@orderly.network/hooks";
import { Numeral, Text } from "../../../../../text";
import { SymbolContext } from "../../../../../provider";
import { OrderlyIcon } from "../../../../../icon";
export const TradeData = (props)=>{
    const { symbol } = props;
    const ticker = useTickerStream(symbol);
    const { quote_dp, base_dp } = useContext(SymbolContext);
    //
    return /*#__PURE__*/ _jsx("div", {
        className: "orderly-h-[240px] orderly-p-4 orderly-relative",
        children: /*#__PURE__*/ _jsxs("table", {
            className: "orderly-w-full orderly-text-3xs",
            children: [
                /*#__PURE__*/ _jsxs("tr", {
                    className: "orderly-h-[28px]",
                    children: [
                        /*#__PURE__*/ _jsx("td", {
                            className: "orderly-text-base-contrast-54",
                            children: "Mark price"
                        }),
                        /*#__PURE__*/ _jsx("td", {
                            className: "orderly-text-right orderly-text-base-contrast",
                            children: /*#__PURE__*/ _jsx(Numeral, {
                                precision: quote_dp,
                                children: ticker?.mark_price
                            })
                        })
                    ]
                }),
                /*#__PURE__*/ _jsxs("tr", {
                    className: "orderly-h-[28px]",
                    children: [
                        /*#__PURE__*/ _jsx("td", {
                            className: "orderly-text-base-contrast-54",
                            children: "Index price"
                        }),
                        /*#__PURE__*/ _jsx("td", {
                            className: "orderly-text-right orderly-text-base-contrast",
                            children: /*#__PURE__*/ _jsx(Numeral, {
                                precision: quote_dp,
                                children: ticker?.index_price
                            })
                        })
                    ]
                }),
                /*#__PURE__*/ _jsxs("tr", {
                    className: "orderly-h-[28px]",
                    children: [
                        /*#__PURE__*/ _jsx("td", {
                            className: "orderly-text-base-contrast-54 ",
                            children: /*#__PURE__*/ _jsxs("div", {
                                className: "orderly-flex orderly-items-center",
                                children: [
                                    /*#__PURE__*/ _jsx("div", {
                                        children: "24h volume"
                                    }),
                                    /*#__PURE__*/ _jsx(OrderlyIcon, {
                                        size: 14,
                                        className: "orderly-ml-[6px]"
                                    })
                                ]
                            })
                        }),
                        /*#__PURE__*/ _jsxs("td", {
                            className: "orderly-text-right orderly-text-base-contrast",
                            children: [
                                /*#__PURE__*/ _jsx(Numeral.total, {
                                    rule: "human",
                                    precision: 2,
                                    price: ticker?.["24h_close"],
                                    quantity: ticker?.["24h_volumn"]
                                }),
                                /*#__PURE__*/ _jsx(Text, {
                                    rule: "symbol",
                                    symbolElement: "quote",
                                    className: "orderly-text-base-contrast-36 orderly-ml-2",
                                    children: symbol
                                })
                            ]
                        })
                    ]
                }),
                /*#__PURE__*/ _jsxs("tr", {
                    className: "orderly-h-[28px]",
                    children: [
                        /*#__PURE__*/ _jsx("td", {
                            className: "orderly-text-base-contrast-54",
                            children: "24h high"
                        }),
                        /*#__PURE__*/ _jsx("td", {
                            className: "orderly-text-right orderly-text-base-contrast",
                            children: /*#__PURE__*/ _jsx(Numeral, {
                                precision: quote_dp,
                                children: ticker?.["24h_high"]
                            })
                        })
                    ]
                }),
                /*#__PURE__*/ _jsxs("tr", {
                    className: "orderly-h-[28px]",
                    children: [
                        /*#__PURE__*/ _jsx("td", {
                            className: "orderly-text-base-contrast-54",
                            children: "24h low"
                        }),
                        /*#__PURE__*/ _jsx("td", {
                            className: "orderly-text-right orderly-text-base-contrast",
                            children: /*#__PURE__*/ _jsx(Numeral, {
                                precision: quote_dp,
                                children: ticker?.["24h_low"]
                            })
                        })
                    ]
                }),
                /*#__PURE__*/ _jsxs("tr", {
                    className: "orderly-h-[28px]",
                    children: [
                        /*#__PURE__*/ _jsx("td", {
                            className: "orderly-text-base-contrast-54",
                            children: "Open interest"
                        }),
                        /*#__PURE__*/ _jsxs("td", {
                            className: "orderly-text-right orderly-text-base-contrast",
                            children: [
                                ticker?.["open_interest"] ? /*#__PURE__*/ _jsx(Numeral.total, {
                                    rule: "human",
                                    precision: 2,
                                    price: ticker?.["mark_price"],
                                    quantity: ticker?.["open_interest"]
                                }) : "--",
                                /*#__PURE__*/ _jsx(Text, {
                                    className: "orderly-text-base-contrast-36 orderly-ml-2",
                                    children: "USDC"
                                })
                            ]
                        })
                    ]
                })
            ]
        })
    });
};

//# sourceMappingURL=tradeData.js.map