/**
 * @description 请添加Index组件的描述和注释!!!
 *
 * @date 创建时间 2022-10-29 11:54
 * @author 开发人员
 */

import React, { useEffect } from "react";
import NavBar from "@components/NavBar";
import ProductMenu from "./ProductMenu";
import { PairsService } from "../services";
import { useObservable } from "rxjs-hooks";
import { map } from "rxjs/operators";

interface Props {}

const Tickers: React.FC<Props> = props => {
  const hadConfig = useObservable(() => PairsService.instance.hadConfig$.pipe(map(val => val)));
  useEffect(() => {
    if (hadConfig) {
      PairsService.instance.initCurrentPair("perp/btcusdt");
    }
  }, [hadConfig]);

  return (
    <div className="h-full">
      <NavBar classes={{ lastPrice: "up" }}>
        <ProductMenu></ProductMenu>
      </NavBar>
    </div>
  );
};

export default Tickers;
