import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { TPSLListView } from "../../block/tp_sl/tpsl_listview";
import { useContext, useState } from "react";
import { TabContext } from "../../tab";
import { Divider } from "../../divider";
import { Header } from "../../block/orders/full/header";
import { AlgoOrderRootType, OrderStatus } from "@orderly.network/types";
import { useOrderStream } from "@orderly.network/hooks";
import { useTabContext } from "../../tab/tabContext";
import { TradingPageContext } from "../../page/trading/context/tradingPageContext";
export const TPSLList = (props)=>{
    const context = useContext(TradingPageContext);
    const { height } = useContext(TabContext);
    const [side, setSide] = useState();
    const { data: tabExtraData } = useTabContext();
    const [orders, { total }] = useOrderStream({
        symbol: tabExtraData.showAllSymbol ? "" : context.symbol,
        status: OrderStatus.INCOMPLETE,
        side,
        includes: [
            AlgoOrderRootType.POSITIONAL_TP_SL,
            AlgoOrderRootType.TP_SL
        ]
    }, {
        keeplive: true
    });
    // console.log("orders", orders);
    return /*#__PURE__*/ _jsxs("div", {
        children: [
            /*#__PURE__*/ _jsx(Header, {
                count: orders?.length ?? 0,
                onSideChange: setSide,
                side: side,
                orderType: AlgoOrderRootType.TP_SL,
                status: OrderStatus.INCOMPLETE
            }),
            /*#__PURE__*/ _jsx(Divider, {}),
            /*#__PURE__*/ _jsx("div", {
                className: "orderly-relative",
                style: {
                    height: `${(height?.content ?? 100) - 55}px`
                },
                children: /*#__PURE__*/ _jsx(TPSLListView, {
                    dataSource: orders ?? []
                })
            })
        ]
    });
};

//# sourceMappingURL=tp_sl_list.js.map