import { jsx as _jsx } from "react/jsx-runtime";
import { useEffect } from "react";
import { ListViewFull } from "./listview";
import { MarketsType, useMarkets } from "@orderly.network/hooks";
import { useDataSource } from "../useDataSource";
import { FavoriteButton } from "./favoriteButton";
export const AllTabPane = (props)=>{
    const { activeIndex, setActiveIndex, onItemClick, fitlerKey } = props;
    const [data, { addToHistory, favoriteTabs, updateFavoriteTabs, updateSymbolFavoriteState }] = useMarkets(MarketsType.ALL);
    const [dataSource, { onSearch, onSort }] = useDataSource(// @ts-ignore
    data);
    useEffect(()=>{
        onSearch(fitlerKey);
    }, [
        fitlerKey
    ]);
    return /*#__PURE__*/ _jsx(ListViewFull, {
        // @ts-ignore
        // ref={listviewRef}
        activeIndex: activeIndex,
        dataSource: dataSource,
        onSort: onSort,
        readLastSortCondition: true,
        maxHeight: props.maxHeight,
        updateActiveIndex: (index)=>setActiveIndex(index),
        onItemClick: (item)=>{
            // @ts-ignore
            onItemClick?.(item);
            addToHistory(item);
        },
        favoriteTabs: favoriteTabs,
        prefixRender: (item, index)=>{
            return /*#__PURE__*/ _jsx(FavoriteButton, {
                symbol: item,
                tabs: favoriteTabs,
                updateFavoriteTabs: updateFavoriteTabs,
                updateSymbolFavoriteState: updateSymbolFavoriteState
            });
        }
    });
};

//# sourceMappingURL=allTabPane.js.map