9dfce9e723
* fix: make asset dialog use asset id rather than symbol * fix: tests that relied on asset symbol rather than id * chore: add missing asset id to mocks * chore: add asset id to mocks for e2e tests * chore: add missing asset id for orders mock * chore: fix console-lite build * chore: add missing asset ids to mocks
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import { useCallback } from 'react';
|
|
import { Button } from '@vegaprotocol/ui-toolkit';
|
|
import { t } from '@vegaprotocol/react-helpers';
|
|
import { useWithdrawalDialog } from '@vegaprotocol/withdraws';
|
|
import { useAssetDetailsDialogStore } from '@vegaprotocol/assets';
|
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
|
import { AccountManager } from '@vegaprotocol/accounts';
|
|
import { useDepositDialog } from '@vegaprotocol/deposits';
|
|
|
|
export const AccountsContainer = () => {
|
|
const { pubKey } = useVegaWallet();
|
|
const { open: openAssetDetailsDialog } = useAssetDetailsDialogStore();
|
|
const openWithdrawalDialog = useWithdrawalDialog((store) => store.open);
|
|
const openDepositDialog = useDepositDialog((store) => store.open);
|
|
|
|
const onClickAsset = useCallback(
|
|
(assetId?: string) => {
|
|
assetId && openAssetDetailsDialog(assetId);
|
|
},
|
|
[openAssetDetailsDialog]
|
|
);
|
|
|
|
if (!pubKey) {
|
|
return (
|
|
<Splash>
|
|
<p>{t('Please connect Vega wallet')}</p>
|
|
</Splash>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="h-full relative grid grid-rows-[1fr,min-content]">
|
|
<div>
|
|
<AccountManager
|
|
partyId={pubKey}
|
|
onClickAsset={onClickAsset}
|
|
onClickWithdraw={openWithdrawalDialog}
|
|
onClickDeposit={openDepositDialog}
|
|
/>
|
|
</div>
|
|
<div className="flex justify-end p-2 px-[11px]">
|
|
<Button size="sm" onClick={() => openDepositDialog()}>
|
|
{t('Deposit')}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|