import { jsx as _jsx } from "react/jsx-runtime";
import { HistoryListView } from "../../../../../../block/orderHistory";
import { TradingPageContext } from "../../../../../../page/trading/context/tradingPageContext";
import { useOrderStream, useAccount } from "@orderly.network/hooks";
import { AccountStatusEnum } from "@orderly.network/types";
import { useContext, useState } from "react";
import { useFormatOrderHistory } from "../../../../../../page/trading/shared/hooks/useFormatOrderHistory";
export const HistoryPane = ()=>{
    const [side, setSide] = useState("");
    const [status, setStauts] = useState("");
    const { state } = useAccount();
    const { onSymbolChange } = useContext(TradingPageContext);
    const [data, { isLoading, loadMore }] = useOrderStream({
        // @ts-ignore
        side,
        // @ts-ignore
        status
    });
    const formattedData = useFormatOrderHistory(state.status < AccountStatusEnum.EnableTrading || !data ? [] : data);
    return /*#__PURE__*/ _jsx(HistoryListView, {
        isLoading: isLoading,
        dataSource: formattedData,
        onSideChange: setSide,
        onStatusChange: setStauts,
        onSymbolChange: onSymbolChange,
        side: side,
        status: status,
        loadMore: loadMore,
        onCancelAlgoOrder: ()=>{
            throw new Error("Not implemented");
        },
        onCancelOrder: ()=>{
            throw new Error("Not implemented");
        }
    });
};

//# sourceMappingURL=index.js.map