Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(improvements) Tables states representation #779

Merged
merged 109 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
923c7eb
Adjust placeholder default size
alexstotsky Feb 8, 2024
e51d2fe
Implement unified getCellLoader helper
alexstotsky Feb 8, 2024
3109f8d
Add cols no result key/description
alexstotsky Feb 9, 2024
5324224
Extend cell statates getter for no data cases
alexstotsky Feb 13, 2024
38a5f87
Update ledgers columns configuration
alexstotsky Feb 13, 2024
6ab30d5
Implement getRowsNumber helper utility
alexstotsky Feb 13, 2024
1917583
[wip]Ledgers preloading representation
alexstotsky Feb 13, 2024
c08fb74
Actualize no-data cells styling
alexstotsky Feb 13, 2024
acedfbf
Fix parent cell related warnings, cleanup
alexstotsky Feb 13, 2024
4f02990
Rework ledgers no data handling cases
alexstotsky Feb 13, 2024
461293b
Fix pagination flickering and cleanup
alexstotsky Feb 13, 2024
07e9906
Provide first visible cols handling for ledgers no data case
alexstotsky Feb 13, 2024
e667d50
Implement custom content support for getCellNoData helper
alexstotsky Feb 14, 2024
ced6666
Implement cell description setting for the first visible columns
alexstotsky Feb 14, 2024
5699f91
Enhance data table no data state checkig
alexstotsky Feb 14, 2024
b108414
Actualize ledgers data table config
alexstotsky Feb 14, 2024
f519c56
Actualize first column description for no data case
alexstotsky Feb 14, 2024
d8a8071
Cleanup and lint fixes
alexstotsky Feb 14, 2024
7bfbd05
Lint fix
alexstotsky Feb 14, 2024
8d68e46
Unified getCellLoader utility for better reusability
alexstotsky Feb 15, 2024
258da52
Actualize trades cols configuration
alexstotsky Feb 15, 2024
af36388
Enhance trades no-data/loading states handling
alexstotsky Feb 15, 2024
21bf045
Extend orders columns getter config
alexstotsky Feb 16, 2024
dd9a50d
Fix ledgers rows rendering
alexstotsky Feb 16, 2024
95dc51c
Enhance orders loading/no-data states handling
alexstotsky Feb 16, 2024
017e042
Actualize trades data table config
alexstotsky Feb 16, 2024
97b114c
Improve positions cols getters configs
alexstotsky Feb 19, 2024
3416631
Enhance positions states handling
alexstotsky Feb 19, 2024
02b76bd
Improve active pos tables representation
alexstotsky Feb 19, 2024
394f81c
Rework positions audit states handling
alexstotsky Feb 19, 2024
ca9b947
Extend fund offer cols configs
alexstotsky Feb 22, 2024
fe4f3f7
Rework funding bof states handling
alexstotsky Feb 22, 2024
abf491c
Update loan history columns getters
alexstotsky Feb 22, 2024
59db9d2
Enhance funding loans representation
alexstotsky Feb 22, 2024
f7e0cd2
Actualize credit history cols configs
alexstotsky Feb 22, 2024
25f0c00
Rework funding credits states handling, lint fixes
alexstotsky Feb 22, 2024
c29ba93
Enhance funding earnings states handling
alexstotsky Feb 22, 2024
11a4835
Rework staking earnings states handling, lint fixes
alexstotsky Feb 22, 2024
062bffc
Improve affiliates earnings states handling
alexstotsky Feb 22, 2024
52320d1
Lint fix and cleanup
alexstotsky Feb 22, 2024
a38a897
Actualize invoices cells configurations
alexstotsky Feb 22, 2024
a54d8c5
Rework invoices states handling
alexstotsky Feb 22, 2024
69d14bb
Adjust styling
alexstotsky Feb 23, 2024
2e3d668
Extend movements columns getters
alexstotsky Feb 23, 2024
3742be3
Improve movements states handling
alexstotsky Feb 23, 2024
d03c018
Enhance pub trades cols config & lint fix
alexstotsky Feb 23, 2024
22273b7
Rework public trades states handling, lint fixes
alexstotsky Feb 23, 2024
fe38ac2
Update public funding cols configs
alexstotsky Feb 23, 2024
c72d3c1
Enhance public funding loading/no data states handling
alexstotsky Feb 23, 2024
2024153
Actualize tickers columns getters
alexstotsky Feb 23, 2024
3d09721
Rework spot report states handling
alexstotsky Feb 23, 2024
a4f8d87
Cleanup
alexstotsky Feb 23, 2024
a1fff21
Improve derivatives cols configs
alexstotsky Feb 23, 2024
ba4864d
Rework derivatives states handling
alexstotsky Feb 23, 2024
baacb08
Actualize logins cells configurations
alexstotsky Feb 23, 2024
a70ef4a
Rework logins tables states handling
alexstotsky Feb 23, 2024
331c41c
Extend logs col getters configs
alexstotsky Feb 23, 2024
f25060f
Improve change logs report states representation
alexstotsky Feb 23, 2024
081262c
Update weighted averages cols getters config
alexstotsky Feb 26, 2024
ee7fe70
Actualize weighted averages states handling
alexstotsky Feb 26, 2024
014307e
Update concentration risk configurations
alexstotsky Feb 26, 2024
5ef996a
Rework concentration risk states representation
alexstotsky Feb 26, 2024
09a6a0a
Enhance sum by asset cols getter
alexstotsky Feb 26, 2024
8d6dc0b
Rework and enhance summary by asset states handling
alexstotsky Feb 26, 2024
f2cdeec
Enhance summary by asset styling
alexstotsky Feb 26, 2024
9342660
Update data tables classes
alexstotsky Feb 26, 2024
b785b87
Fix affiliates rows config
alexstotsky Feb 26, 2024
f6ba71a
Enhance data tables styling
alexstotsky Feb 26, 2024
b61bc1e
Rework paid fees cols getters config
alexstotsky Feb 27, 2024
57a8eaf
Rework account summary states handling
alexstotsky Feb 27, 2024
f128364
Cleanup
alexstotsky Feb 27, 2024
890da23
Update paid fees config
alexstotsky Feb 27, 2024
40364c6
Rework derivatives fees states representation
alexstotsky Feb 27, 2024
024206a
Rework fee tier volume section states handling
alexstotsky Feb 27, 2024
622ae72
Fix tier volume default
alexstotsky Feb 27, 2024
e9ad492
Cleanup
alexstotsky Feb 27, 2024
b44a24d
Improve paid fees dta table config
alexstotsky Feb 27, 2024
a4cbb48
Implement acc volume state handling
alexstotsky Feb 27, 2024
3ba803a
Rework and improve account fees states handling
alexstotsky Feb 27, 2024
7f6120f
Update leo level states handling
alexstotsky Feb 27, 2024
fa2c807
Actualize leo level configuration
alexstotsky Feb 27, 2024
dc47cd2
Adjust wallets columns getters
alexstotsky Feb 28, 2024
4b31ee1
Rework wallets data states handling
alexstotsky Feb 28, 2024
3fc96fd
Improve tables items styling
alexstotsky Feb 28, 2024
d1903c1
Rework wallets states handling
alexstotsky Feb 28, 2024
da7a91e
Update checker naming, lint fixes
alexstotsky Feb 28, 2024
d0559f1
Refactor and memoize wallets snapshot
alexstotsky Feb 28, 2024
a6c9ce0
Update wallets snaphot config
alexstotsky Feb 28, 2024
fc46cbd
lint fix
alexstotsky Feb 28, 2024
6a0c46b
Extend getFrameworkPositionsColumns configuration
alexstotsky Feb 28, 2024
f327272
Optimize positions cols getter
alexstotsky Feb 28, 2024
54f76db
Enhance position tickers cols configs
alexstotsky Feb 28, 2024
8a68f2b
Rework getWalletsTickersColumns states handling
alexstotsky Feb 28, 2024
8a1462f
Actualize snapshots configs
alexstotsky Feb 28, 2024
f7c598f
Rework and optimize tickers snapshot section
alexstotsky Feb 28, 2024
063e8d0
Rework and improve positions snapshot
alexstotsky Feb 28, 2024
9909844
Enhance ticker snapshot states handling
alexstotsky Feb 28, 2024
ddfb8f4
Cleanup
alexstotsky Feb 28, 2024
eb4eac1
Enhance tax report snapshots states handling
alexstotsky Feb 28, 2024
c63bc09
Adjust data table num rows handling
alexstotsky Feb 28, 2024
b409bf4
Implement getRowsConfig utility
alexstotsky Feb 28, 2024
d323688
Rework result movements states handling
alexstotsky Feb 28, 2024
b744c8c
Enhace default rows config handling
alexstotsky Feb 28, 2024
c527e63
Adjust positions snapshot config
alexstotsky Feb 28, 2024
e03023b
Actualize rows config
alexstotsky Feb 28, 2024
78fc1b9
Update movements cols config
alexstotsky Feb 29, 2024
0018cfc
Improve tax balances columns getters
alexstotsky Feb 29, 2024
8f90fc0
Actualize getPositionsSnapshot states handling
alexstotsky Feb 29, 2024
cf2538d
Actualize getBalances states ahndling
alexstotsky Feb 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"mobile": "Mobile",
"moreDetails": "More Details",
"movementsTotal": "Movements Total Amount (USD)",
"noResults": "No results",
"note": "Note",
"opened": "Opened",
"orderid": "Order ID",
Expand Down
50 changes: 35 additions & 15 deletions src/components/AccountSummary/AccountSummary.derivFees.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ import PropTypes from 'prop-types'
import { Cell } from '@blueprintjs/table'

import DataTable from 'ui/DataTable'
import { getTooltipContent } from 'utils/columns'
import { formatAmount, formatFraction } from 'ui/utils'
import { getCellLoader, getCellNoData, getTooltipContent } from 'utils/columns'

const getColor = val => (val > 0 ? 'red' : 'green')

const getColumns = ({ makerFee, takerFee, t }) => {
const getColumns = ({
t,
takerFee,
makerFee,
isNoData,
isLoading,
}) => {
const formattedMakerFee = `${formatFraction(makerFee * 100, { minDigits: 2 })}%`
const formattedTakerFee = `${formatFraction(takerFee * 100, { minDigits: 2 })}%`

Expand All @@ -17,24 +23,32 @@ const getColumns = ({ makerFee, takerFee, t }) => {
id: 'makerFee',
name: makerFee > 0 ? 'column.maker_fees' : 'column.maker_rebate',
width: 100,
renderer: () => (
<Cell tooltip={getTooltipContent(formattedMakerFee, t)}>
{formatAmount(makerFee * 100, { color: getColor(makerFee), minDigits: 2 })}
%
</Cell>
),
renderer: () => {
if (isLoading) return getCellLoader(14, 72)
if (isNoData) return getCellNoData(t('column.noResults'))
return (
<Cell tooltip={getTooltipContent(formattedMakerFee, t)}>
{formatAmount(makerFee * 100, { color: getColor(makerFee), minDigits: 2 })}
%
</Cell>
)
},
copyText: () => formattedMakerFee,
},
{
id: 'takerFee',
name: takerFee > 0 ? 'column.taker_fees' : 'column.taker_rebate',
width: 100,
renderer: () => (
<Cell tooltip={getTooltipContent(formattedTakerFee, t)}>
{formatAmount(takerFee * 100, { color: getColor(takerFee), minDigits: 2 })}
%
</Cell>
),
renderer: () => {
if (isLoading) return getCellLoader(14, 72)
if (isNoData) return getCellNoData()
return (
<Cell tooltip={getTooltipContent(formattedTakerFee, t)}>
{formatAmount(takerFee * 100, { color: getColor(takerFee), minDigits: 2 })}
%
</Cell>
)
},
copyText: () => formattedTakerFee,
},
]
Expand All @@ -45,8 +59,12 @@ const AccountSummaryDerivFees = ({
title,
makerFee,
takerFee,
isNoData,
isLoading,
}) => {
const columns = getColumns({ makerFee, takerFee, t })
const columns = getColumns({
makerFee, takerFee, t, isNoData, isLoading,
})

return (
<div className='section-account-summary-data-item'>
Expand All @@ -67,6 +85,8 @@ AccountSummaryDerivFees.propTypes = {
title: PropTypes.string.isRequired,
makerFee: PropTypes.number.isRequired,
takerFee: PropTypes.number.isRequired,
isNoData: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
}

export default memo(AccountSummaryDerivFees)
13 changes: 11 additions & 2 deletions src/components/AccountSummary/AccountSummary.feeTierVolume.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ import DataTable from 'ui/DataTable'

import { getColumns } from './AccountSummary.paidFees'

const AccountSummaryFeeTierVolume = ({ data, t }) => {
const AccountSummaryFeeTierVolume = ({
t,
data,
isNoData,
isLoading,
}) => {
const lastVolumeItem = get(data, [data.length - 1], {})
const { curr, vol_safe: amount } = lastVolumeItem

const columns = getColumns({ data: [{ curr, amount }], t })
const columns = getColumns({
data: [{ curr, amount }], t, isNoData, isLoading,
})

return (
<div className='section-account-summary-data-item'>
Expand All @@ -28,6 +35,8 @@ AccountSummaryFeeTierVolume.propTypes = {
data: PropTypes.arrayOf(PropTypes.shape({
curr: PropTypes.string,
})).isRequired,
isNoData: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
}

export default memo(AccountSummaryFeeTierVolume)
74 changes: 49 additions & 25 deletions src/components/AccountSummary/AccountSummary.fees.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import PropTypes from 'prop-types'
import { Cell } from '@blueprintjs/table'

import DataTable from 'ui/DataTable'
import { getTooltipContent } from 'utils/columns'
import { formatAmount, formatFraction } from 'ui/utils'
import { getCellLoader, getCellNoData, getTooltipContent } from 'utils/columns'

const getColor = val => (val > 0 ? 'red' : 'green')

const getColumns = ({
t,
isNoData,
isLoading,
makerFee,
takerFeeToFiat,
takerFeeToStable,
Expand All @@ -25,48 +27,64 @@ const getColumns = ({
id: 'makerFee',
name: makerFee > 0 ? 'column.maker_fees' : 'column.maker_rebate',
width: 100,
renderer: () => (
<Cell tooltip={getTooltipContent(formattedMakerFee, t)}>
{formatAmount(makerFee * 100, { color: getColor(makerFee), minDigits: 2 })}
%
</Cell>
),
renderer: () => {
if (isLoading) return getCellLoader(14, 72)
if (isNoData) return getCellNoData(t('column.noResults'))
return (
<Cell tooltip={getTooltipContent(formattedMakerFee, t)}>
{formatAmount(makerFee * 100, { color: getColor(makerFee), minDigits: 2 })}
%
</Cell>
)
},
copyText: () => formattedMakerFee,
},
{
id: 'takerFeeCrypto',
name: takerFeeToCrypto > 0 ? 'column.taker_fees_crypto' : 'column.taker_rebate_crypto',
width: 140,
renderer: () => (
<Cell tooltip={getTooltipContent(formattedTakerFeeToCrypto, t)}>
{formatAmount(takerFeeToCrypto * 100, { color: getColor(takerFeeToCrypto), minDigits: 2 })}
%
</Cell>
),
renderer: () => {
if (isLoading) return getCellLoader(14, 72)
if (isNoData) return getCellNoData()
return (
<Cell tooltip={getTooltipContent(formattedTakerFeeToCrypto, t)}>
{formatAmount(takerFeeToCrypto * 100, { color: getColor(takerFeeToCrypto), minDigits: 2 })}
%
</Cell>
)
},
copyText: () => formattedTakerFeeToCrypto,
},
{
id: 'takerFeeFiat',
name: takerFeeToFiat > 0 ? 'column.taker_fees_fiat' : 'column.taker_rebate_fiat',
width: 140,
renderer: () => (
<Cell tooltip={getTooltipContent(formattedTakerFeeToFiat, t)}>
{formatAmount(takerFeeToFiat * 100, { color: getColor(takerFeeToFiat), minDigits: 2 })}
%
</Cell>
),
renderer: () => {
if (isLoading) return getCellLoader(14, 72)
if (isNoData) return getCellNoData()
return (
<Cell tooltip={getTooltipContent(formattedTakerFeeToFiat, t)}>
{formatAmount(takerFeeToFiat * 100, { color: getColor(takerFeeToFiat), minDigits: 2 })}
%
</Cell>
)
},
copyText: () => formattedTakerFeeToFiat,
},
{
id: 'takerFeeStable',
name: takerFeeToStable > 0 ? 'column.taker_fees_stable' : 'column.taker_rebate_stable',
width: 140,
renderer: () => (
<Cell tooltip={getTooltipContent(formattedTakerFeeToStable, t)}>
{formatAmount(takerFeeToStable * 100, { color: getColor(takerFeeToStable), minDigits: 2 })}
%
</Cell>
),
renderer: () => {
alexstotsky marked this conversation as resolved.
Show resolved Hide resolved
if (isLoading) return getCellLoader(14, 72)
if (isNoData) return getCellNoData()
return (
<Cell tooltip={getTooltipContent(formattedTakerFeeToStable, t)}>
{formatAmount(takerFeeToStable * 100, { color: getColor(takerFeeToStable), minDigits: 2 })}
%
</Cell>
)
},
copyText: () => formattedTakerFeeToStable,
},
]
Expand All @@ -76,6 +94,8 @@ const AccountSummaryFees = ({
t,
data,
title,
isNoData,
isLoading,
}) => {
const {
makerFee,
Expand All @@ -90,6 +110,8 @@ const AccountSummaryFees = ({

const columns = getColumns({
t,
isNoData,
isLoading,
makerFee: makerFee || makerRebate || 0,
takerFeeToCrypto: takerFeeToCrypto || takerRebateToCrypto || 0,
takerFeeToFiat: takerFeeToFiat || takerRebateToFiat || 0,
Expand Down Expand Up @@ -123,6 +145,8 @@ AccountSummaryFees.propTypes = {
}).isRequired,
title: PropTypes.string.isRequired,
t: PropTypes.func.isRequired,
isNoData: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
}

export default memo(AccountSummaryFees)
57 changes: 31 additions & 26 deletions src/components/AccountSummary/AccountSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import PropTypes from 'prop-types'
import { Card, Elevation } from '@blueprintjs/core'
import { get, isEmpty } from '@bitfinex/lib-js-util-base'

import NoData from 'ui/NoData'
import Loading from 'ui/Loading'
import SectionHeader from 'ui/SectionHeader'

import Leo from './AccountSummary.leo'
Expand Down Expand Up @@ -43,7 +41,6 @@ class AccountSummary extends PureComponent {
fetchData: PropTypes.func.isRequired,
isTurkishSite: PropTypes.bool.isRequired,
pageLoading: PropTypes.bool.isRequired,
refresh: PropTypes.func.isRequired,
t: PropTypes.func.isRequired,
}

Expand All @@ -64,39 +61,51 @@ class AccountSummary extends PureComponent {
const {
t,
data,
refresh,
pageLoading,
dataReceived,
isTurkishSite,
} = this.props
const isNoData = isEmpty(data)
const isLoading = !dataReceived && pageLoading

let showContent
if (!dataReceived && pageLoading) {
showContent = <Loading />
} else if (isEmpty(data)) {
showContent = <NoData refresh={refresh} />
} else {
showContent = (
return (
<Card
elevation={Elevation.ZERO}
className='col-lg-12 col-md-12 col-sm-12 col-xs-12 no-table-scroll'
>
<SectionHeader
filter={false}
timeframe={false}
title='accountsummary.title'
/>
<div className='section-account-summary-data'>
<Volume
t={t}
isNoData={isNoData}
isLoading={isLoading}
data={get(data, 'trade_vol_30d', [])}
/>
<Fees
t={t}
data={data}
isNoData={isNoData}
isLoading={isLoading}
title='accountsummary.fees'
/>
{!isTurkishSite && (
<>
<DerivFees
t={t}
isNoData={isNoData}
isLoading={isLoading}
title='accountsummary.fees_deriv'
makerFee={data.derivMakerFee || data.derivMakerRebate || 0}
takerFee={data.derivTakerFee || data.derivTakerRebate || 0}
/>
<PaidFees
t={t}
isNoData={isNoData}
isLoading={isLoading}
title='accountsummary.margin_funds'
data={get(data, 'fees_funding_30d', {})}
total={get(data, 'fees_funding_total_30d', 0)}
Expand All @@ -106,29 +115,25 @@ class AccountSummary extends PureComponent {
<br />
<PaidFees
t={t}
isNoData={isNoData}
isLoading={isLoading}
title='accountsummary.trading_funds'
data={get(data, 'fees_trading_30d', {})}
total={get(data, 'fees_trading_total_30d', 0)}
/>
<FeeTierVolume
t={t}
data={get(data, 'trade_vol_30d', {})}
isNoData={isNoData}
isLoading={isLoading}
data={get(data, 'trade_vol_30d', [])}
/>
<Leo
t={t}
data={data}
isNoData={isNoData}
isLoading={isLoading}
/>
<Leo t={t} data={data} />
</div>
)
}
return (
<Card
elevation={Elevation.ZERO}
className='col-lg-12 col-md-12 col-sm-12 col-xs-12 no-table-scroll'
>
<SectionHeader
filter={false}
timeframe={false}
title='accountsummary.title'
/>
{showContent}
</Card>
)
}
Expand Down
Loading