From 53609bf93c2c9b4d9ccf7978cda0caedf4d4ea7b Mon Sep 17 00:00:00 2001
From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com>
Date: Wed, 16 Nov 2022 14:42:53 -0500
Subject: [PATCH] feat(#2039): add tooltips for transfer types in ledger
entries (#2100)
---
libs/ledger/src/lib/ledger-table.tsx | 22 ++++++++++++++++++-
libs/types/src/global-types-mappings.ts | 28 +++++++++++++++++++++++++
2 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/libs/ledger/src/lib/ledger-table.tsx b/libs/ledger/src/lib/ledger-table.tsx
index 658dac4d4..dba4d139a 100644
--- a/libs/ledger/src/lib/ledger-table.tsx
+++ b/libs/ledger/src/lib/ledger-table.tsx
@@ -7,8 +7,25 @@ import {
import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit';
import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
import { AgGridColumn } from 'ag-grid-react';
-import { AccountTypeMapping, TransferTypeMapping } from '@vegaprotocol/types';
+import {
+ AccountTypeMapping,
+ DescriptionTransferTypeMapping,
+ TransferTypeMapping,
+} from '@vegaprotocol/types';
import type { LedgerEntry } from './ledger-entries-data-provider';
+import type { ITooltipParams } from 'ag-grid-community';
+
+export const TransferTooltipCellComponent = ({ value }: ITooltipParams) => {
+ return (
+
+ {value
+ ? DescriptionTransferTypeMapping[
+ value as keyof typeof TransferTypeMapping
+ ]
+ : ''}
+
+ );
+};
export const LedgerTable = ({ ...props }) => (
(
overlayNoRowsTemplate={t('No entries')}
rowHeight={34}
getRowId={({ data }) => data.id}
+ tooltipShowDelay={500}
defaultColDef={{
flex: 1,
resizable: true,
sortable: true,
+ tooltipComponent: TransferTooltipCellComponent,
}}
{...props}
>
@@ -37,6 +56,7 @@ export const LedgerTable = ({ ...props }) => (
) =>
diff --git a/libs/types/src/global-types-mappings.ts b/libs/types/src/global-types-mappings.ts
index 4e5d2da10..7a647c509 100644
--- a/libs/types/src/global-types-mappings.ts
+++ b/libs/types/src/global-types-mappings.ts
@@ -312,3 +312,31 @@ export enum TransferTypeMapping {
TRANSFER_TYPE_CLEAR_ACCOUNT = 'Market is closed, accounts are cleared',
TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE = 'Restore a balance from a checkpoint',
}
+export enum DescriptionTransferTypeMapping {
+ TRANSFER_TYPE_LOSS = `Final settlement loss: Funds deducted after final settlement loss`,
+ TRANSFER_TYPE_WIN = `Final settlement gain: Funds added to your general account after final settlement gain`,
+ TRANSFER_TYPE_MTM_LOSS = `Mark to market loss: Funds deducted from your margin account after mark to market loss`,
+ TRANSFER_TYPE_MTM_WIN = `Mark to market gain: Funds added to your margin account after mark to market gain`,
+ TRANSFER_TYPE_MARGIN_LOW = `Margin topped up: Funds deducted from your general account to meet margin requirement`,
+ TRANSFER_TYPE_MARGIN_HIGH = `Margin returned: Excess margin amount returned to your general account`,
+ TRANSFER_TYPE_MARGIN_CONFISCATED = `Margin confiscated: Margin confiscated from your margin account to fulfil closeout`,
+ TRANSFER_TYPE_MAKER_FEE_PAY = `Maker fee paid: Maker fee paid from your general account when your aggressive trade was filled`,
+ TRANSFER_TYPE_MAKER_FEE_RECEIVE = `Maker fee received: Maker fee received into your general account when your passive trade was filled`,
+ TRANSFER_TYPE_INFRASTRUCTURE_FEE_PAY = `Infrastructure fee paid: Infrastructure fee paid from your general account when your trade was filled`,
+ TRANSFER_TYPE_INFRASTRUCTURE_FEE_DISTRIBUTE = `Infrastructure fee received: Infrastructure fee, paid by traders, received into your general account`,
+ TRANSFER_TYPE_LIQUIDITY_FEE_PAY = `Liquidity fee paid: Liquidity fee paid from your general account to market's liquidity providers`,
+ TRANSFER_TYPE_LIQUIDITY_FEE_DISTRIBUTE = `Liquidity fee received: Liquidity fee received into your general account from traders`,
+ TRANSFER_TYPE_BOND_LOW = `Bond account funded: Funds deducted from your general account to meet your required liquidity bond amount`,
+ TRANSFER_TYPE_BOND_HIGH = `Bond returned: Bond returned to your general account after your liquidity commitment was reduced`,
+ TRANSFER_TYPE_WITHDRAW = `Withdrawal: Funds withdrawn from your general account`,
+ TRANSFER_TYPE_DEPOSIT = `Deposit: Funds deposited to your general account`,
+ TRANSFER_TYPE_BOND_SLASHING = `Bond slashed: Bond account penalized when liquidity commitment not met`,
+ TRANSFER_TYPE_STAKE_REWARD = `Staking reward received: Rewards for staking received into your general account`,
+ TRANSFER_TYPE_TRANSFER_FUNDS_SEND = `Transfer sent: Funds deducted from your general account to fulfil a transfer`,
+ TRANSFER_TYPE_TRANSFER_FUNDS_DISTRIBUTE = `Transfer received: Funds added to your general account to fulfil a transfer`,
+ TRANSFER_TYPE_CLEAR_ACCOUNT = `Market accounts cleared: Market-related accounts emptied, and balances moved, because the market has closed`,
+ TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE = `Balances restored: Your balances were restored after a network restart`,
+ TRANSFER_TYPE_UNSPECIFIED = 'Default value, always invalid',
+ TRANSFER_TYPE_CLOSE = 'Close',
+ TRANSFER_TYPE_WITHDRAW_LOCK = 'Lock amount for withdraw',
+}