2022-11-16 14:36:03 +00:00
|
|
|
import { useCallback } from 'react';
|
2022-03-29 22:52:51 +00:00
|
|
|
import { MarketsContainer } from '@vegaprotocol/market-list';
|
2022-11-16 14:36:03 +00:00
|
|
|
import { useGlobalStore } from '../../stores';
|
2022-11-08 07:23:38 +00:00
|
|
|
import { useNavigate } from 'react-router-dom';
|
2022-11-18 17:08:48 +00:00
|
|
|
import { useWelcomeNoticeDialog } from '../../components/welcome-notice';
|
2022-02-28 23:43:36 +00:00
|
|
|
|
2022-11-08 07:23:38 +00:00
|
|
|
export const Markets = () => {
|
|
|
|
const navigate = useNavigate();
|
2022-09-05 14:25:33 +00:00
|
|
|
const { update } = useGlobalStore((store) => ({ update: store.update }));
|
2022-11-18 17:08:48 +00:00
|
|
|
useWelcomeNoticeDialog();
|
2022-11-16 14:36:03 +00:00
|
|
|
const handleOnSelect = useCallback(
|
|
|
|
(marketId: string) => {
|
2022-11-18 17:08:48 +00:00
|
|
|
update({ marketId, welcomeNoticeDialog: false });
|
2022-11-16 14:36:03 +00:00
|
|
|
navigate(`/markets/${marketId}`);
|
|
|
|
},
|
|
|
|
[update, navigate]
|
2022-08-31 04:35:46 +00:00
|
|
|
);
|
2022-11-16 14:36:03 +00:00
|
|
|
|
|
|
|
return <MarketsContainer onSelect={handleOnSelect} />;
|
2022-08-31 04:35:46 +00:00
|
|
|
};
|