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 type { ChangeEvent } from 'react';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import type { AccountHistoryQuery } from './__generated__/AccountHistory';
|
import type { AccountHistoryQuery } from './__generated__/AccountHistory';
|
||||||
import { useAccountsWithBalanceQuery } from './__generated__/AccountHistory';
|
|
||||||
import { useAccountHistoryQuery } from './__generated__/AccountHistory';
|
import { useAccountHistoryQuery } from './__generated__/AccountHistory';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { AssetFieldsFragment } from '@vegaprotocol/assets';
|
import type { AssetFieldsFragment } from '@vegaprotocol/assets';
|
||||||
@ -26,6 +25,8 @@ import {
|
|||||||
import { AccountTypeMapping } from '@vegaprotocol/types';
|
import { AccountTypeMapping } from '@vegaprotocol/types';
|
||||||
import { PriceChart } from 'pennant';
|
import { PriceChart } from 'pennant';
|
||||||
import 'pennant/dist/style.css';
|
import 'pennant/dist/style.css';
|
||||||
|
import { accountsOnlyDataProvider } from '@vegaprotocol/accounts';
|
||||||
|
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
const DateRange = {
|
const DateRange = {
|
||||||
RANGE_1D: '1D',
|
RANGE_1D: '1D',
|
||||||
@ -95,17 +96,15 @@ const AccountHistoryManager = ({
|
|||||||
[pubKey]
|
[pubKey]
|
||||||
);
|
);
|
||||||
|
|
||||||
const assetsWithBalanceHistory = useAccountsWithBalanceQuery({
|
const { data: assetsWithBalanceHistory } = useDataProvider({
|
||||||
|
dataProvider: accountsOnlyDataProvider,
|
||||||
variables: variablesForOneTimeQuery,
|
variables: variablesForOneTimeQuery,
|
||||||
skip: !pubKey,
|
skip: !pubKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
const assetsWithBalance = useMemo(
|
const assetsWithBalance = useMemo(
|
||||||
() =>
|
() => assetsWithBalanceHistory?.map((e) => e?.asset?.id) || [],
|
||||||
assetsWithBalanceHistory.data?.balanceChanges.edges.map(
|
[assetsWithBalanceHistory]
|
||||||
(e) => e?.node.assetId
|
|
||||||
) || [],
|
|
||||||
[assetsWithBalanceHistory.data?.balanceChanges.edges]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const assets = useMemo(
|
const assets = useMemo(
|
||||||
|
@ -125,12 +125,10 @@ const getTotalBalance = (accounts: AccountFieldsFragment[]) =>
|
|||||||
accounts.reduce((acc, a) => acc + BigInt(a.balance), BigInt(0));
|
accounts.reduce((acc, a) => acc + BigInt(a.balance), BigInt(0));
|
||||||
|
|
||||||
export const getAccountData = (data: Account[]): AccountFields[] => {
|
export const getAccountData = (data: Account[]): AccountFields[] => {
|
||||||
return getAssetIds(data)
|
return getAssetIds(data).map((assetId) => {
|
||||||
.map((assetId) => {
|
|
||||||
const accounts = data.filter((a) => a.asset.id === assetId);
|
const accounts = data.filter((a) => a.asset.id === assetId);
|
||||||
return accounts && getAssetAccountAggregation(accounts, assetId);
|
return accounts && getAssetAccountAggregation(accounts, assetId);
|
||||||
})
|
});
|
||||||
.filter((a) => a.deposited !== '0'); // filter empty accounts
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAssetAccountAggregation = (
|
const getAssetAccountAggregation = (
|
||||||
|
Loading…
Reference in New Issue
Block a user