fix: asset dropdown list (#2622)
* fix(#2556): asset dropdown list fix * fix: add ID to market list and make cell copyable * fix: revert market list table
This commit is contained in:
parent
45a4dd7009
commit
e362d06b5a
@ -9,7 +9,6 @@ import compact from 'lodash/compact';
|
||||
import type { ChangeEvent } from 'react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import type { AccountHistoryQuery } from './__generated__/AccountHistory';
|
||||
import { useAccountsWithBalanceQuery } from './__generated__/AccountHistory';
|
||||
import { useAccountHistoryQuery } from './__generated__/AccountHistory';
|
||||
import * as Schema from '@vegaprotocol/types';
|
||||
import type { AssetFieldsFragment } from '@vegaprotocol/assets';
|
||||
@ -26,6 +25,8 @@ import {
|
||||
import { AccountTypeMapping } from '@vegaprotocol/types';
|
||||
import { PriceChart } from 'pennant';
|
||||
import 'pennant/dist/style.css';
|
||||
import { accountsOnlyDataProvider } from '@vegaprotocol/accounts';
|
||||
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
||||
|
||||
const DateRange = {
|
||||
RANGE_1D: '1D',
|
||||
@ -95,17 +96,15 @@ const AccountHistoryManager = ({
|
||||
[pubKey]
|
||||
);
|
||||
|
||||
const assetsWithBalanceHistory = useAccountsWithBalanceQuery({
|
||||
const { data: assetsWithBalanceHistory } = useDataProvider({
|
||||
dataProvider: accountsOnlyDataProvider,
|
||||
variables: variablesForOneTimeQuery,
|
||||
skip: !pubKey,
|
||||
});
|
||||
|
||||
const assetsWithBalance = useMemo(
|
||||
() =>
|
||||
assetsWithBalanceHistory.data?.balanceChanges.edges.map(
|
||||
(e) => e?.node.assetId
|
||||
) || [],
|
||||
[assetsWithBalanceHistory.data?.balanceChanges.edges]
|
||||
() => assetsWithBalanceHistory?.map((e) => e?.asset?.id) || [],
|
||||
[assetsWithBalanceHistory]
|
||||
);
|
||||
|
||||
const assets = useMemo(
|
||||
|
@ -125,12 +125,10 @@ const getTotalBalance = (accounts: AccountFieldsFragment[]) =>
|
||||
accounts.reduce((acc, a) => acc + BigInt(a.balance), BigInt(0));
|
||||
|
||||
export const getAccountData = (data: Account[]): AccountFields[] => {
|
||||
return getAssetIds(data)
|
||||
.map((assetId) => {
|
||||
const accounts = data.filter((a) => a.asset.id === assetId);
|
||||
return accounts && getAssetAccountAggregation(accounts, assetId);
|
||||
})
|
||||
.filter((a) => a.deposited !== '0'); // filter empty accounts
|
||||
return getAssetIds(data).map((assetId) => {
|
||||
const accounts = data.filter((a) => a.asset.id === assetId);
|
||||
return accounts && getAssetAccountAggregation(accounts, assetId);
|
||||
});
|
||||
};
|
||||
|
||||
const getAssetAccountAggregation = (
|
||||
|
Loading…
Reference in New Issue
Block a user