aea2a85519
* chore: assets to assetsconnection Changed queries in explorer app * chore: assets to assetsConnection (961) * chore: assets to assetsConnection (961) * chore: assets to assetsConnection (961) * fix: after merge issues fixed
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { gql } from '@apollo/client';
|
|
import { PageQueryContainer } from '../../../components/page-query-container';
|
|
import type { DepositPage } from './__generated__/DepositPage';
|
|
import { DepositManager } from '@vegaprotocol/deposits';
|
|
import { assetsConnectionToAssets, t } from '@vegaprotocol/react-helpers';
|
|
import { useEnvironment } from '@vegaprotocol/environment';
|
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
|
import { ASSET_FRAGMENT } from '../../../lib/query-fragments';
|
|
|
|
const DEPOSIT_PAGE_QUERY = gql`
|
|
${ASSET_FRAGMENT}
|
|
query DepositPage {
|
|
assetsConnection {
|
|
edges {
|
|
node {
|
|
...AssetFields
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
/**
|
|
* Fetches data required for the Deposit page
|
|
*/
|
|
export const DepositContainer = () => {
|
|
const { VEGA_ENV } = useEnvironment();
|
|
|
|
return (
|
|
<PageQueryContainer<DepositPage>
|
|
query={DEPOSIT_PAGE_QUERY}
|
|
render={(data) => {
|
|
const assets = assetsConnectionToAssets(data.assetsConnection);
|
|
if (!assets.length) {
|
|
return (
|
|
<Splash>
|
|
<p>{t('No assets on this network')}</p>
|
|
</Splash>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<DepositManager
|
|
assets={assets}
|
|
isFaucetable={VEGA_ENV !== 'MAINNET'}
|
|
/>
|
|
);
|
|
}}
|
|
/>
|
|
);
|
|
};
|