2022-11-16 14:36:03 +00:00
|
|
|
import React, { useEffect } from 'react';
|
2023-02-28 18:56:29 +00:00
|
|
|
import { titlefy } from '@vegaprotocol/utils';
|
|
|
|
import { t } from '@vegaprotocol/i18n';
|
2023-09-05 00:21:46 +00:00
|
|
|
import {
|
|
|
|
LocalStoragePersistTabs as Tabs,
|
|
|
|
Tab,
|
|
|
|
TradingAnchorButton,
|
|
|
|
} from '@vegaprotocol/ui-toolkit';
|
2022-11-16 14:36:03 +00:00
|
|
|
import { Markets } from './markets';
|
|
|
|
import { Proposed } from './proposed';
|
|
|
|
import { usePageTitleStore } from '../../stores';
|
2023-05-02 17:41:21 +00:00
|
|
|
import { Closed } from './closed';
|
2023-09-05 00:21:46 +00:00
|
|
|
import {
|
|
|
|
DApp,
|
|
|
|
TOKEN_NEW_MARKET_PROPOSAL,
|
|
|
|
useLinks,
|
|
|
|
} from '@vegaprotocol/environment';
|
2022-11-16 14:36:03 +00:00
|
|
|
|
|
|
|
export const MarketsPage = () => {
|
|
|
|
const { updateTitle } = usePageTitleStore((store) => ({
|
|
|
|
updateTitle: store.updateTitle,
|
|
|
|
}));
|
2023-09-05 00:21:46 +00:00
|
|
|
|
|
|
|
const tokenLink = useLinks(DApp.Token);
|
|
|
|
const externalLink = tokenLink(TOKEN_NEW_MARKET_PROPOSAL);
|
|
|
|
|
2022-11-16 14:36:03 +00:00
|
|
|
useEffect(() => {
|
|
|
|
updateTitle(titlefy(['Markets']));
|
|
|
|
}, [updateTitle]);
|
2023-09-05 00:21:46 +00:00
|
|
|
|
2022-11-16 14:36:03 +00:00
|
|
|
return (
|
2023-07-24 08:37:18 +00:00
|
|
|
<div className="h-full pt-0.5 pb-3 px-1.5">
|
2023-09-05 00:21:46 +00:00
|
|
|
<div className="h-full my-1 border rounded-sm border-default">
|
2023-07-24 08:37:18 +00:00
|
|
|
<Tabs storageKey="console-markets">
|
2023-08-02 12:58:26 +00:00
|
|
|
<Tab id="open-markets" name={t('Open markets')}>
|
2023-07-24 08:37:18 +00:00
|
|
|
<Markets />
|
|
|
|
</Tab>
|
2023-09-05 00:21:46 +00:00
|
|
|
<Tab
|
|
|
|
id="proposed-markets"
|
|
|
|
name={t('Proposed markets')}
|
|
|
|
menu={
|
|
|
|
<TradingAnchorButton size="extra-small" href={externalLink}>
|
|
|
|
{t('Propose a new market')}
|
|
|
|
</TradingAnchorButton>
|
|
|
|
}
|
|
|
|
>
|
2023-07-24 08:37:18 +00:00
|
|
|
<Proposed />
|
|
|
|
</Tab>
|
|
|
|
<Tab id="closed-markets" name={t('Closed markets')}>
|
|
|
|
<Closed />
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-11-16 14:36:03 +00:00
|
|
|
);
|
|
|
|
};
|