"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "MyOrders", {
    enumerable: true,
    get: function() {
        return MyOrders;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _hooks = require("@orderly.network/hooks");
const _tradingPageContext = require("../../../../../../page/trading/context/tradingPageContext");
const _types = require("@orderly.network/types");
const _full = require("../../../../../../block/orders/full");
const _tabContext = require("../../../../../../tab/tabContext");
const MyOrders = (props)=>{
    const context = (0, _react.useContext)(_tradingPageContext.TradingPageContext);
    const { data: tabExtraData } = (0, _tabContext.useTabContext)();
    // const [symbol, setSymbol] = useState(() =>
    //   tabExtraData.showAllSymbol ? "" : context.symbol
    // );
    const [side, setSide] = (0, _react.useState)("");
    const [data, { isLoading, loadMore, cancelOrder, updateOrder, cancelAlgoOrder, updateAlgoOrder }] = (0, _hooks.useOrderStream)({
        status: props.status,
        symbol: tabExtraData.showAllSymbol ? "" : context.symbol,
        // @ts-ignore
        side
    });
    // const onShowAllSymbolChange = (isAll: boolean) => {
    //   setSymbol(isAll ? "" : context.symbol);
    //   setShowAllSymbol(isAll);
    // };
    const { state } = (0, _hooks.useAccount)();
    const onCancelOrder = (0, _react.useCallback)((orderId, symbol)=>{
        // @ts-ignore
        return cancelOrder(orderId, symbol);
    }, []);
    return /*#__PURE__*/ (0, _jsxruntime.jsx)(_full.OrdersViewFull, {
        // @ts-ignore
        dataSource: state.status < _types.AccountStatusEnum.EnableTrading ? [] : data,
        isLoading: isLoading,
        symbol: context.symbol,
        onSideChange: setSide,
        // @ts-ignore
        side: side,
        showAllSymbol: tabExtraData.showAllSymbol,
        cancelOrder: onCancelOrder,
        editOrder: updateOrder,
        cancelAlgoOrder: cancelAlgoOrder,
        editAlgoOrder: updateAlgoOrder,
        onSymbolChange: context.onSymbolChange,
        loadMore: loadMore,
        status: props.status
    });
};

//# sourceMappingURL=index.js.map