vega-frontend-monorepo/apps/trading/pages/markets/index.page.tsx
Art d271f28b82
feat: page title (660) (#1437)
* feat: page title (660)

* fix: trading-e2e home tests
2022-09-23 16:29:35 +02:00

29 lines
705 B
TypeScript

import { useRouter } from 'next/router';
import { MarketsContainer } from '@vegaprotocol/market-list';
import { useGlobalStore } from '../../stores';
import { useEffect } from 'react';
import { titlefy } from '@vegaprotocol/react-helpers';
const Markets = () => {
const { update } = useGlobalStore((store) => ({ update: store.update }));
useEffect(() => {
update({ pageTitle: titlefy(['Markets']) });
}, [update]);
const router = useRouter();
return (
<MarketsContainer
onSelect={(marketId) => {
update({ marketId });
router.push(`/markets/${marketId}`);
}}
/>
);
};
Markets.getInitialProps = () => ({
page: 'markets',
});
export default Markets;