Skip to content

Commit

Permalink
Merge branch 'add-volume30d-acc-fees' into summary-by-asset-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstotsky committed Dec 12, 2023
2 parents 4d04e3c + 31875f6 commit 4ed33a9
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 7 deletions.
3 changes: 2 additions & 1 deletion public/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,8 @@
"no_data": "No related data for this period is available or data should be synced.",
"fees": {
"title": "Account Fees",
"sub_title": "Based on your trading volume",
"sub_title": "Based on your 30 days eligible trading volume",
"fee_tier_volume": "Eligible Trading Volume",
"maker": "Maker Fees",
"taker_crypto": "Taker Fees Crypto",
"taker_fiat": "Taker Fees Fiat",
Expand Down
12 changes: 12 additions & 0 deletions src/components/AppSummary/AppSummary.columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,25 @@ import {

export const getFeesColumns = ({
makerFee,
feeTierVolume,
isTurkishSite,
derivTakerFee,
takerFeeToFiat,
takerFeeToStable,
takerFeeToCrypto,
derivMakerRebate,
}) => [
{
id: 'feeTierVolume',
name: 'summary.fees.fee_tier_volume',
width: 100,
renderer: () => (
<Cell>
$
{formatUsdValue(feeTierVolume)}
</Cell>
),
},
{
id: 'makerFee',
name: 'summary.fees.maker',
Expand Down
9 changes: 8 additions & 1 deletion src/components/AppSummary/AppSummary.fees.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { memo } from 'react'
import React, { memo, useMemo } from 'react'
import PropTypes from 'prop-types'
import { isEmpty } from '@bitfinex/lib-js-util-base'

Expand All @@ -7,6 +7,7 @@ import Loading from 'ui/Loading'
import CollapsedTable from 'ui/CollapsedTable'

import { getFeesColumns } from './AppSummary.columns'
import { getFeeTierVolume } from './AppSummary.helpers'

const AppSummaryFees = ({
t,
Expand All @@ -24,8 +25,14 @@ const AppSummaryFees = ({
derivMakerRebate = 0,
} = data

const feeTierVolume = useMemo(
() => getFeeTierVolume(data),
[data],
)

const columns = getFeesColumns({
makerFee,
feeTierVolume,
isTurkishSite,
derivTakerFee,
takerFeeToFiat,
Expand Down
2 changes: 2 additions & 0 deletions src/components/AppSummary/AppSummary.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ export const shouldShowPercentCheck = (balance, balanceChange) => {
}

export const getIsTotal = (currency, t) => currency === t('summary.by_asset.total')

export const getFeeTierVolume = (data) => data?.trade_vol_30d?.at(-1)?.vol_safe ?? 0
2 changes: 1 addition & 1 deletion src/components/AppSummary/AppSummary.value.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const AccountSummaryValue = () => {
{formattedPercValue}
</div>
<Chart
aspect={1.675}
aspect={1.455}
data={chartData}
showLegend={false}
dataKeys={presentCurrencies}
Expand Down
6 changes: 5 additions & 1 deletion src/components/AppSummary/_AppSummary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,18 @@
border-bottom: 1px solid var(--tableBorder);

&:first-child {
width: 45%;
width: 50%;
}

&:last-child {
padding: 4px 5px;
text-align: end;
word-break: break-word;
}

.cell-description {
font-size: 14px;
}
}

&:last-child {
Expand Down
13 changes: 10 additions & 3 deletions src/ui/CollapsedTable/CollapsedTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@ class CollapsedTable extends PureComponent {
<div className='collapsed-table-item' key={rowIndex}>
{tableColumns.map((column) => {
const {
id, name, nameStr, renderer,
id, name, nameStr, renderer, description,
} = column
const cell = renderer(rowIndex)

return (
<div key={id}>
<div>{nameStr || t(name)}</div>
<div>
{nameStr || t(name)}
<br />
{description && (
<span className='cell-description'>
{t(description)}
</span>
)}
</div>
<div>{cell.props.children}</div>
</div>
)
Expand Down

0 comments on commit 4ed33a9

Please sign in to comment.