2023-07-24 08:37:18 +00:00
|
|
|
import { OrderbookManager } from '@vegaprotocol/market-depth';
|
|
|
|
import { ViewType, useSidebar } from '../sidebar';
|
2023-08-09 09:54:16 +00:00
|
|
|
import { useDealTicketFormValues } from '@vegaprotocol/deal-ticket';
|
2023-09-15 12:36:08 +00:00
|
|
|
import { useGetCurrentRouteId } from '../../lib/hooks/use-get-current-route-id';
|
2023-07-24 08:37:18 +00:00
|
|
|
|
|
|
|
export const OrderbookContainer = ({ marketId }: { marketId: string }) => {
|
2023-09-15 12:36:08 +00:00
|
|
|
const currentRouteId = useGetCurrentRouteId();
|
2023-08-09 09:54:16 +00:00
|
|
|
const update = useDealTicketFormValues((state) => state.updateAll);
|
2023-09-15 12:36:08 +00:00
|
|
|
const setViews = useSidebar((store) => store.setViews);
|
2023-07-24 08:37:18 +00:00
|
|
|
return (
|
|
|
|
<OrderbookManager
|
|
|
|
marketId={marketId}
|
2023-08-09 09:54:16 +00:00
|
|
|
onClick={(values) => {
|
|
|
|
update(marketId, values);
|
2023-09-15 12:36:08 +00:00
|
|
|
setViews({ type: ViewType.Order }, currentRouteId);
|
2023-07-24 08:37:18 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|