2022-03-02 01:40:31 +00:00
|
|
|
import { gql } from '@apollo/client';
|
2022-03-02 01:08:32 +00:00
|
|
|
import { PageQueryContainer } from '../../components/page-query-container';
|
2022-02-17 05:03:46 +00:00
|
|
|
import Link from 'next/link';
|
|
|
|
import { useRouter } from 'next/router';
|
2022-02-28 23:43:36 +00:00
|
|
|
import { Markets } from './__generated__/Markets';
|
|
|
|
|
|
|
|
const MARKETS_QUERY = gql`
|
|
|
|
query Markets {
|
|
|
|
markets {
|
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
2022-02-17 05:03:46 +00:00
|
|
|
|
|
|
|
const Markets = () => {
|
2022-03-01 00:59:18 +00:00
|
|
|
const { pathname } = useRouter();
|
2022-02-28 23:43:36 +00:00
|
|
|
|
2022-02-17 05:03:46 +00:00
|
|
|
return (
|
2022-03-02 01:08:32 +00:00
|
|
|
<PageQueryContainer<Markets> query={MARKETS_QUERY}>
|
|
|
|
{(data) => (
|
|
|
|
<>
|
|
|
|
<h1>Markets</h1>
|
|
|
|
<ul>
|
|
|
|
{data.markets.map((m) => (
|
|
|
|
<li key={m.id}>
|
|
|
|
<Link
|
|
|
|
href={`${pathname}/${m.id}?portfolio=orders&trade=orderbook`}
|
|
|
|
passHref={true}
|
|
|
|
>
|
|
|
|
<a>View market: {m.id}</a>
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</>
|
2022-02-28 23:43:36 +00:00
|
|
|
)}
|
2022-03-02 01:08:32 +00:00
|
|
|
</PageQueryContainer>
|
2022-02-17 05:03:46 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Markets;
|