"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "OrdersPane", {
    enumerable: true,
    get: function() {
        return OrdersPane;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _orders = require("../../../../../../block/orders");
const _react = require("react");
const _hooks = require("@orderly.network/hooks");
const _tradingPageContext = require("../../../../../../page/trading/context/tradingPageContext");
const _types = require("@orderly.network/types");
const _tab = require("../../../../../../tab");
const OrdersPane = (props)=>{
    const context = (0, _react.useContext)(_tradingPageContext.TradingPageContext);
    const tabContext = (0, _react.useContext)(_tab.TabContext);
    const [showAllSymbol, setShowAllSymbol] = (0, _hooks.useSessionStorage)("showAllSymbol_orders", true);
    const [symbol, setSymbol] = (0, _react.useState)(()=>showAllSymbol ? "" : context.symbol);
    const [data, { isLoading, loadMore, cancelOrder, updateOrder, cancelAlgoOrder, updateAlgoOrder }] = (0, _hooks.useOrderStream)({
        status: _types.OrderStatus.INCOMPLETE,
        symbol: symbol
    });
    const onShowAllSymbolChange = (isAll)=>{
        setSymbol(isAll ? "" : context.symbol);
        setShowAllSymbol(isAll);
    };
    const { state } = (0, _hooks.useAccount)();
    // const onCancelOrder = useCallback(
    //   (orderId: number | OrderEntity, symbol: string): Promise<any> => {
    //     // @ts-ignore
    //     return cancelOrder(orderId, symbol);
    //   },
    //   []
    // );
    return /*#__PURE__*/ (0, _jsxruntime.jsx)(_orders.OrdersView, {
        // @ts-ignore
        dataSource: state.status < _types.AccountStatusEnum.EnableTrading ? [] : data,
        isLoading: isLoading,
        symbol: context.symbol,
        showAllSymbol: showAllSymbol,
        cancelOrder: cancelOrder,
        cancelAlgoOrder: cancelAlgoOrder,
        onShowAllSymbolChange: onShowAllSymbolChange,
        editOrder: updateOrder,
        editAlgoOrder: updateAlgoOrder,
        onSymbolChange: context.onSymbolChange,
        loadMore: loadMore
    });
};

//# sourceMappingURL=index.js.map